MyGUI: MyGUI_LanguageManager.h Source File

MyGUI 3.4.2

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

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
17namespace MyGUI
18{
19
20 class MYGUI_EXPORT LanguageManager :
21 public MemberObsolete<LanguageManager>
22 {
23 MYGUI_SINGLETON_DECLARATION(LanguageManager);
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;
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
57 delegates::CMultiDelegate1<const std::string&> eventChangeLanguage;
58
65 delegates::CDelegate2<const UString&, UString&> eventRequestTag;
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_BackwardCompatibility.h
MyGUI_Delegate.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MyGUI_Singleton.h
MYGUI_SINGLETON_DECLARATION
#define MYGUI_SINGLETON_DECLARATION(ClassName)
Definition MyGUI_Singleton.h:111
MyGUI_Types.h
MyGUI_XmlDocument.h
MyGUI::IDataStream
Definition MyGUI_IDataStream.h:17
MyGUI::LanguageManager
Definition MyGUI_LanguageManager.h:22
MyGUI::LanguageManager::eventRequestTag
delegates::CDelegate2< const UString &, UString & > eventRequestTag
Definition MyGUI_LanguageManager.h:65
MyGUI::LanguageManager::eventChangeLanguage
delegates::CMultiDelegate1< const std::string & > eventChangeLanguage
Definition MyGUI_LanguageManager.h:57
MyGUI::MemberObsolete
Definition MyGUI_DeprecatedTypes.h:14
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition MyGUI_UString.h:145
MyGUI::Version
Definition MyGUI_Version.h:18
MyGUI::delegates::Delegate
Definition MyGUI_Delegate.h:136
MyGUI::delegates::MultiDelegate
Definition MyGUI_Delegate.h:200
MyGUI::xml::Element
Definition MyGUI_XmlDocument.h:159
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::VectorString
std::vector< std::string > VectorString
Definition MyGUI_Types.h:41