MyGUI 3.2.0

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

- File List
- Globals

MyGUI_ResourceManager.h
Go to the documentation of this file.
1
6 /*
7 This file is part of MyGUI.
8
9 MyGUI is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 MyGUI is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_RESOURCE_MANAGER_H__
23 #define __MYGUI_RESOURCE_MANAGER_H__
24
25 #include "MyGUI_Prerequest.h"
26 #include "MyGUI_Singleton.h"
27 #include "MyGUI_Enumerator.h"
28 #include "MyGUI_XmlDocument.h"
29 #include "MyGUI_IResource.h"
30 #include "MyGUI_Delegate.h"
31 #include "MyGUI_BackwardCompatibility.h"
32
33 namespace MyGUI
34 {
35
36 class MYGUI_EXPORT ResourceManager :
37 public Singleton<ResourceManager>,
38 public MemberObsolete<ResourceManager>
39 {
40 public:
41 ResourceManager();
42
43 void initialise();
44 void shutdown();
45
46 public:
48 bool load(const std::string& _file);
49
50 void loadFromXmlNode(xml::ElementPtr _node, const std::string& _file, Version _version);
51
53 void addResource(IResourcePtr _item);
54
56 void removeResource(IResourcePtr _item);
57
58 typedef delegates::CDelegate3<xml::ElementPtr, const std::string&, Version> LoadXmlDelegate;
59
61 LoadXmlDelegate& registerLoadXmlDelegate(const std::string& _key);
62
64 void unregisterLoadXmlDelegate(const std::string& _key);
65
67 bool isExist(const std::string& _name) const;
68
70 IResource* findByName(const std::string& _name) const;
71
73 IResource* getByName(const std::string& _name, bool _throw = true) const;
74
75 bool removeByName(const std::string& _name);
76
77 void clear();
78
79 typedef std::map<std::string, IResource*> MapResource;
80 typedef Enumerator<MapResource> EnumeratorPtr;
81
82 EnumeratorPtr getEnumerator() const;
83
84 size_t getCount() const;
85
86 private:
87 void _loadList(xml::ElementPtr _node, const std::string& _file, Version _version);
88 bool _loadImplement(const std::string& _file, bool _match, const std::string& _type, const std::string& _instance);
89
90 private:
91 // карта с делегатами для парсинга хмл блоков
92 typedef std::map<std::string, LoadXmlDelegate> MapLoadXmlDelegate;
93 MapLoadXmlDelegate mMapLoadXmlDelegate;
94
95 MapResource mResources;
96
97 typedef std::vector<IResource*> VectorResource;
98 VectorResource mRemovedResoures;
99
100 bool mIsInitialise;
101 };
102
103 } // namespace MyGUI
104
105 #endif // __MYGUI_RESOURCE_MANAGER_H__
MyGUI_Enumerator.h
MyGUI_Prerequest.h
MyGUI_Singleton.h
MyGUI::ResourceManager::MapResource
std::map< std::string, IResource * > MapResource
Definition: MyGUI_ResourceManager.h:79
MyGUI::delegates::CDelegate3
Definition: MyGUI_Delegate.h:169
MyGUI::ResourceManager::LoadXmlDelegate
delegates::CDelegate3< xml::ElementPtr, const std::string &, Version > LoadXmlDelegate
Definition: MyGUI_ResourceManager.h:58
MyGUI::Enumerator
Definition: MyGUI_Enumerator.h:63
MyGUI_XmlDocument.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:120
MyGUI::ResourceManager::EnumeratorPtr
Enumerator< MapResource > EnumeratorPtr
Definition: MyGUI_ResourceManager.h:80
MyGUI_BackwardCompatibility.h
MyGUI::xml::Element
Definition: MyGUI_XmlDocument.h:168
MyGUI::ResourceManager
Definition: MyGUI_ResourceManager.h:36
MyGUI_IResource.h
MyGUI::Version
Definition: MyGUI_Version.h:32
MyGUI::MemberObsolete
Definition: MyGUI_DeprecatedTypes.h:28
MyGUI::IResource
Definition: MyGUI_IResource.h:38
MyGUI::Singleton
Definition: MyGUI_Singleton.h:35
MyGUI_Delegate.h