MyGUI: MyGUI_LanguageManager.h Source File

MyGUI 3.2.2

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"
15 #include "MyGUI_BackwardCompatibility.h"
16
17 namespace MyGUI
18 {
19
20 class MYGUI_EXPORT LanguageManager :
21 public Singleton<LanguageManager>,
22 public MemberObsolete<LanguageManager>
23 {
24 public:
25 LanguageManager();
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
55 delegates::CMultiDelegate1<const std::string&> eventChangeLanguage;
56
63 delegates::CDelegate2<const UString&, UString&> eventRequestTag;
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_
MyGUI::LanguageManager::eventChangeLanguage
delegates::CMultiDelegate1< const std::string & > eventChangeLanguage
Definition: MyGUI_LanguageManager.h:55
MyGUI_Delegate.h
MyGUI_XmlDocument.h
MyGUI::LanguageManager
Definition: MyGUI_LanguageManager.h:20
MyGUI::xml::Element
Definition: MyGUI_XmlDocument.h:158
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition: MyGUI_UString.h:168
MyGUI::Version
Definition: MyGUI_Version.h:17
MyGUI_Prerequest.h
MyGUI_Singleton.h
MyGUI::MemberObsolete
Definition: MyGUI_DeprecatedTypes.h:13
MyGUI::IDataStream
Definition: MyGUI_IDataStream.h:16
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:103
MyGUI_Types.h
MyGUI::Singleton
Definition: MyGUI_Singleton.h:20
MyGUI_BackwardCompatibility.h
MyGUI::LanguageManager::eventRequestTag
delegates::CDelegate2< const UString &, UString & > eventRequestTag
Definition: MyGUI_LanguageManager.h:63
MyGUI
Definition: MyGUI_ActionController.h:14