7#ifndef MYGUI_RESOURCE_MANAGER_H_
8#define MYGUI_RESOURCE_MANAGER_H_
33 bool load(
const std::string& _file);
35 void loadFromXmlNode(xml::ElementPtr _node, std::string_view _file, Version _version);
38 void addResource(IResourcePtr _item);
41 void removeResource(IResourcePtr _item);
43 using LoadXmlDelegate = EventPairConvertStringView<
44 delegates::Delegate<xml::ElementPtr, const std::string&, Version>,
45 delegates::Delegate<xml::ElementPtr, std::string_view, Version>>;
48 LoadXmlDelegate& registerLoadXmlDelegate(std::string_view _key);
51 void unregisterLoadXmlDelegate(std::string_view _key);
54 bool isExist(std::string_view _name)
const;
57 IResource* findByName(std::string_view _name)
const;
60 IResource* getByName(std::string_view _name,
bool _throw =
true)
const;
62 bool removeByName(std::string_view _name);
66 using MapResource = std::map<std::string, IResource*, std::less<>>;
68 const MapResource& getResources()
const;
70 size_t getCount()
const;
72 const std::string& getCategoryName()
const;
75 void _loadList(xml::ElementPtr _node, std::string_view _file, Version _version);
76 bool _loadImplement(
const std::string& _file,
bool _match, std::string_view _type, std::string_view _instance);
80 using MapLoadXmlDelegate = std::map<std::string, LoadXmlDelegate, std::less<>>;
81 MapLoadXmlDelegate mMapLoadXmlDelegate;
83 MapResource mResources;
85 using VectorResource = std::vector<IResource*>;
86 VectorResource mRemovedResources;
88 bool mIsInitialise{
false};
89 std::string mCategoryName;
90 std::string mXmlListTagName;
#define MYGUI_SINGLETON_DECLARATION(ClassName)