MyGUI: MyGUI_ResourceManager.h Source File

MyGUI 3.2.2

MyGUI_ResourceManager.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_RESOURCE_MANAGER_H_
8 #define MYGUI_RESOURCE_MANAGER_H_
9
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_Singleton.h"
12 #include "MyGUI_Enumerator.h"
13 #include "MyGUI_XmlDocument.h"
14 #include "MyGUI_IResource.h"
15 #include "MyGUI_Delegate.h"
16 #include "MyGUI_BackwardCompatibility.h"
17
18 namespace MyGUI
19 {
20
21 class MYGUI_EXPORT ResourceManager :
22 public Singleton<ResourceManager>,
23 public MemberObsolete<ResourceManager>
24 {
25 public:
26 ResourceManager();
27
28 void initialise();
29 void shutdown();
30
31 public:
33 bool load(const std::string& _file);
34
35 void loadFromXmlNode(xml::ElementPtr _node, const std::string& _file, Version _version);
36
38 void addResource(IResourcePtr _item);
39
41 void removeResource(IResourcePtr _item);
42
43 typedef delegates::CDelegate3<xml::ElementPtr, const std::string&, Version> LoadXmlDelegate;
44
46 LoadXmlDelegate& registerLoadXmlDelegate(const std::string& _key);
47
49 void unregisterLoadXmlDelegate(const std::string& _key);
50
52 bool isExist(const std::string& _name) const;
53
55 IResource* findByName(const std::string& _name) const;
56
58 IResource* getByName(const std::string& _name, bool _throw = true) const;
59
60 bool removeByName(const std::string& _name);
61
62 void clear();
63
64 typedef std::map<std::string, IResource*> MapResource;
65 typedef Enumerator<MapResource> EnumeratorPtr;
66
67 EnumeratorPtr getEnumerator() const;
68
69 size_t getCount() const;
70
71 const std::string& getCategoryName() const;
72
73 private:
74 void _loadList(xml::ElementPtr _node, const std::string& _file, Version _version);
75 bool _loadImplement(const std::string& _file, bool _match, const std::string& _type, const std::string& _instance);
76
77 private:
78 // карта с делегатами для парсинга хмл блоков
79 typedef std::map<std::string, LoadXmlDelegate> MapLoadXmlDelegate;
80 MapLoadXmlDelegate mMapLoadXmlDelegate;
81
82 MapResource mResources;
83
84 typedef std::vector<IResource*> VectorResource;
85 VectorResource mRemovedResoures;
86
87 bool mIsInitialise;
88 std::string mCategoryName;
89 std::string mXmlListTagName;
90 };
91
92 } // namespace MyGUI
93
94 #endif // MYGUI_RESOURCE_MANAGER_H_
MyGUI::ResourceManager::MapResource
std::map< std::string, IResource * > MapResource
Definition: MyGUI_ResourceManager.h:64
MyGUI_IResource.h
MyGUI_Delegate.h
MyGUI::ResourceManager::EnumeratorPtr
Enumerator< MapResource > EnumeratorPtr
Definition: MyGUI_ResourceManager.h:65
MyGUI_XmlDocument.h
MyGUI::ResourceManager
Definition: MyGUI_ResourceManager.h:21
MyGUI_Enumerator.h
MyGUI::ResourceManager::LoadXmlDelegate
delegates::CDelegate3< xml::ElementPtr, const std::string &, Version > LoadXmlDelegate
Definition: MyGUI_ResourceManager.h:43
MyGUI::xml::Element
Definition: MyGUI_XmlDocument.h:158
MyGUI::Version
Definition: MyGUI_Version.h:17
MyGUI_Prerequest.h
MyGUI_Singleton.h
MyGUI::Enumerator
Definition: MyGUI_Enumerator.h:48
MyGUI::MemberObsolete
Definition: MyGUI_DeprecatedTypes.h:13
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:103
MyGUI::IResource
Definition: MyGUI_IResource.h:23
MyGUI::Singleton
Definition: MyGUI_Singleton.h:20
MyGUI_BackwardCompatibility.h
MyGUI
Definition: MyGUI_ActionController.h:14