MyGUI  3.2.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 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;
34 
37  UString replaceTags(const UString& _line);
38 
40  UString getTag(const UString& _tag);
41 
43  void addUserTag(const UString& _tag, const UString& _replace);
44 
46  void clearUserTags();
47 
49  bool loadUserTags(const std::string& _file);
50 
56 
64 
65  private:
66  void _load(xml::ElementPtr _node, const std::string& _file, Version _version);
67 
68  bool loadLanguage(const std::string& _file, bool _user = false);
69  void _loadLanguage(IDataStream* _stream, bool _user);
70  void _loadLanguageXML(IDataStream* _stream, bool _user);
71 
72  UString replaceTagsPass(const UString& _line, bool& _replaceResult);
73 
74  private:
75  typedef std::map<UString, UString> MapLanguageString;
76 
77  MapLanguageString mMapLanguage;
78  MapLanguageString mUserMapLanguage;
79 
80  std::string mCurrentLanguageName;
81 
82  typedef std::map<std::string, VectorString> MapListString;
83  MapListString mMapFile;
84 
85  bool mIsInitialise;
86  std::string mXmlLanguageTagName;
87  };
88 
89 } // namespace MyGUI
90 
91 #endif // __MYGUI_LANGUAGE_MANAGER_H__