MyGUI: MyGUI_ResourceManager.h Source File

MyGUI 3.4.2

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

- File List
- Globals

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
18namespace MyGUI
19{
20
21 class MYGUI_EXPORT ResourceManager :
22 public MemberObsolete<ResourceManager>
23 {
24 MYGUI_SINGLETON_DECLARATION(ResourceManager);
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_BackwardCompatibility.h
MyGUI_Delegate.h
MyGUI_Enumerator.h
MyGUI_IResource.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_XmlDocument.h
MyGUI::Enumerator
Definition MyGUI_Enumerator.h:49
MyGUI::IResource
Definition MyGUI_IResource.h:25
MyGUI::MemberObsolete
Definition MyGUI_DeprecatedTypes.h:14
MyGUI::ResourceManager
Definition MyGUI_ResourceManager.h:23
MyGUI::ResourceManager::EnumeratorPtr
Enumerator< MapResource > EnumeratorPtr
Definition MyGUI_ResourceManager.h:65
MyGUI::ResourceManager::LoadXmlDelegate
delegates::CDelegate3< xml::ElementPtr, const std::string &, Version > LoadXmlDelegate
Definition MyGUI_ResourceManager.h:43
MyGUI::ResourceManager::MapResource
std::map< std::string, IResource * > MapResource
Definition MyGUI_ResourceManager.h:64
MyGUI::Version
Definition MyGUI_Version.h:18
MyGUI::delegates::Delegate
Definition MyGUI_Delegate.h:136
MyGUI::xml::Element
Definition MyGUI_XmlDocument.h:159
MyGUI
Definition MyGUI_ActionController.h:15