- Timestamp:
- Sep 24, 2006, 12:06:35 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/util/loading
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/loading/new_resource_manager.cc
r9798 r9799 68 68 } 69 69 70 void NewResourceManager::unregisterType(Resources::Type* type) 71 { 72 std::vector<Resources::Type*>::iterator it = std::find (this->_resourceTypes.begin(), this->_resourceTypes.end(), type); 73 if (it != this->_resourceTypes.end()) 74 { 75 this->_resourceTypes.erase(it); 76 PRINTF(5)("ResourceType '%s' with ID %d removed\n", type->storedClassName().c_str(), type->id()); 77 } 78 } 79 80 70 81 void NewResourceManager::setMainGlobalPath(const Directory& directory) 71 82 { … … 127 138 } 128 139 129 const std::string& NewResourceManager::getKeepLevel ID(unsigned int keepLevelID) const140 const std::string& NewResourceManager::getKeepLevelName(unsigned int keepLevelID) const 130 141 { 131 142 assert(keepLevelID < this->_keepLevelNames.size()); -
branches/new_class_id/src/lib/util/loading/new_resource_manager.h
r9798 r9799 25 25 bool addResourceSubPath(const std::string& resourceName, const std::string& pathName); 26 26 void registerType(Resources::Type* type); 27 void unregisterType(Resources::Type* type); 27 28 28 29 unsigned int addKeepLevelName(const std::string& keepLevelName); 29 30 unsigned int getKeepLevelID(const std::string& keepLevelName) const; 30 const std::string& getKeepLevel ID(unsigned int keepLevelID) const;31 const std::string& getKeepLevelName(unsigned int keepLevelID) const; 31 32 32 33 const std::vector<Resources::Type*> resourceTypes() const { return _resourceTypes; }; -
branches/new_class_id/src/lib/util/loading/resource.cc
r9798 r9799 44 44 std::string NewResource::locateFile(const std::string& fileName) const 45 45 { 46 if (File(fileName).exists()) 47 return fileName; 48 else if ((NewResourceManager::getInstance()->mainGlobalPath() + File(fileName)).exists() ) 46 if ((NewResourceManager::getInstance()->mainGlobalPath() + File(fileName)).exists() ) 49 47 return (NewResourceManager::getInstance()->mainGlobalPath() + File(fileName)).name(); 50 48 … … 56 54 return locatedFile; 57 55 } 56 57 if (File(fileName).exists()) 58 return fileName; 58 59 59 60 return (NewResourceManager::getInstance()->mainGlobalPath() + File(fileName)).name(); … … 114 115 } 115 116 117 const std::string& Resources::KeepLevel::name() const 118 { 119 return NewResourceManager::getInstance()->getKeepLevelName(this->_keepLevel); 120 } 121 116 122 117 123 … … 134 140 NewResourceManager::getInstance()->registerType(this); 135 141 PRINTF(4)("Created ResourceType '%s'\n", typeName.c_str()); 142 } 143 144 Resources::Type::~Type() 145 { 146 NewResourceManager::getInstance()->unregisterType(this); 136 147 } 137 148 … … 176 187 for (unsigned int i = 0; i < this->_resourcePaths.size(); ++i) 177 188 PRINT(0)(" %s\n", this->_resourcePaths[i].name().c_str()); 178 PRINT(0)(" Sub-Paths: \n");189 PRINT(0)(" Sub-Paths:"); 179 190 for (unsigned int i = 0; i < this->_resourceSubPaths.size(); ++i) 180 PRINT(0)(" %s\n", this->_resourceSubPaths[i].name().c_str()); 191 PRINT(0)(" '%s'", this->_resourceSubPaths[i].name().c_str()); 192 PRINT(0)("\n"); 181 193 182 194 } -
branches/new_class_id/src/lib/util/loading/resource.h
r9798 r9799 23 23 24 24 unsigned int keepLevel() const { return _keepLevel; }; 25 const std::string& name() const; 25 26 private: 26 27 unsigned int _keepLevel; … … 43 44 public: 44 45 Type(const std::string& typeName); 46 ~Type(); 45 47 bool operator==(const std::string& resourceName) const { return this->_typeName == resourceName; }; 46 48
Note: See TracChangeset
for help on using the changeset viewer.