MyGUI  3.4.0
MyGUI_LanguageManager.h
Go to the documentation of this file.
1 /*
2  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3  * Distributed under the MIT License
4  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5  */
6 
7 #ifndef MYGUI_LANGUAGE_MANAGER_H_
8 #define MYGUI_LANGUAGE_MANAGER_H_
9 
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_Singleton.h"
12 #include "MyGUI_XmlDocument.h"
13 #include "MyGUI_Delegate.h"
14 #include "MyGUI_Types.h"
16 
17 namespace MyGUI
18 {
19 
21  public Singleton<LanguageManager>,
22  public MemberObsolete<LanguageManager>
23  {
24  public:
26 
27  void initialise();
28  void shutdown();
29 
31  void setCurrentLanguage(const std::string& _name);
33  const std::string& getCurrentLanguage() const;
35  VectorString getLanguages() const;
36 
39  UString replaceTags(const UString& _line);
40 
42  UString getTag(const UString& _tag);
43 
45  void addUserTag(const UString& _tag, const UString& _replace);
46 
48  void clearUserTags();
49 
51  bool loadUserTags(const std::string& _file);
52 
58 
66 
67  private:
68  void _load(xml::ElementPtr _node, const std::string& _file, Version _version);
69 
70  bool loadLanguage(const std::string& _file, bool _user = false);
71  void _loadLanguage(IDataStream* _stream, bool _user);
72  void _loadLanguageXML(IDataStream* _stream, bool _user);
73 
74  UString replaceTagsPass(const UString& _line, bool& _replaceResult);
75 
76  private:
77  typedef std::map<UString, UString> MapLanguageString;
78 
79  MapLanguageString mMapLanguage;
80  MapLanguageString mUserMapLanguage;
81 
82  std::string mCurrentLanguageName;
83 
84  typedef std::map<std::string, VectorString> MapListString;
85  MapListString mMapFile;
86 
87  bool mIsInitialise;
88  std::string mXmlLanguageTagName;
89  };
90 
91 } // namespace MyGUI
92 
93 #endif // MYGUI_LANGUAGE_MANAGER_H_
MyGUI::LanguageManager::eventChangeLanguage
delegates::CMultiDelegate1< const std::string & > eventChangeLanguage
Definition: MyGUI_LanguageManager.h:57
MyGUI_Delegate.h
MyGUI_XmlDocument.h
MyGUI::LanguageManager
Definition: MyGUI_LanguageManager.h:23
MyGUI::delegates::MultiDelegate
Definition: MyGUI_Delegate.h:183
MyGUI::xml::Element
Definition: MyGUI_XmlDocument.h:159
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition: MyGUI_UString.h:168
MyGUI::delegates::Delegate
Definition: MyGUI_Delegate.h:119
MyGUI::Version
Definition: MyGUI_Version.h:18
MyGUI_Prerequest.h
MyGUI_Singleton.h
MyGUI::MemberObsolete
Definition: MyGUI_DeprecatedTypes.h:14
MyGUI::IDataStream
Definition: MyGUI_IDataStream.h:17
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:89
MyGUI_Types.h
MyGUI::Singleton
Definition: MyGUI_Singleton.h:22
MyGUI_BackwardCompatibility.h
MyGUI::LanguageManager::eventRequestTag
delegates::CDelegate2< const UString &, UString & > eventRequestTag
Definition: MyGUI_LanguageManager.h:65
MyGUI
Definition: MyGUI_ActionController.h:15
MyGUI::VectorString
std::vector< std::string > VectorString
Definition: MyGUI_Types.h:40