MyGUI 3.4.1
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"
17
18namespace MyGUI
19{
20
22 public MemberObsolete<ResourceManager>
23 {
25 public:
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
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;
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_
#define MYGUI_EXPORT
#define MYGUI_SINGLETON_DECLARATION(ClassName)
Enumerator< MapResource > EnumeratorPtr
delegates::CDelegate3< xml::ElementPtr, const std::string &, Version > LoadXmlDelegate
std::map< std::string, IResource * > MapResource