MyGUI  3.4.1
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 MemberObsolete<LanguageManager>
22  {
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) const;
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_
#define MYGUI_EXPORT
#define MYGUI_SINGLETON_DECLARATION(ClassName)
delegates::CDelegate2< const UString &, UString & > eventRequestTag
delegates::CMultiDelegate1< const std::string & > eventChangeLanguage
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
std::vector< std::string > VectorString
Definition: MyGUI_Types.h:40