10 #define IRESOURCEMANAGER_IMPLEMENT
13 #define IRESOURCEMANAGER_IMPLEMENT
33#ifdef IRESOURCEMANAGER_IMPLEMENT
36 for (
auto it = _map.begin(); it != _map.end(); ++it)
delete it->second;
41 auto it = _map.find(key);
42 if (it == _map.end()) {
43 if (LoadResourceByKey(key) < 0) {
44 SetErrMsg(
"Resource does not exist and unable to load by name");
56 for (
auto it = _map.begin(); it != _map.end(); ++it)
57 if (it->second == resource)
return true;
63 if (HasResource(key) || HasResource(resource)) {
64 VAssert(!
"Resource already exists");
67 _map.insert(std::pair<K, T *>(key, resource));
bool HasResource(const T *resource) const
bool HasResource(const K &key) const
bool AddResource(const K &key, T *resource)
void DeleteResource(const K &key)
T * GetResource(const K &key)
virtual ~IResourceManager()
virtual int LoadResourceByKey(const K &key)=0