Changeset 7221 in orxonox.OLD for trunk/src/lib/util/loading/resource_manager.h
- Timestamp:
- Mar 15, 2006, 3:10:45 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/loading/resource_manager.h
r7196 r7221 71 71 unsigned int count; //!< How many times this Resource has been loaded. 72 72 73 char*name; //!< Name of the Resource.73 std::string name; //!< Name of the Resource. 74 74 ResourceType type; //!< ResourceType of this Resource. 75 75 ResourcePriority prio; //!< The Priority of this resource. (This will only be increased) … … 96 96 inline static ResourceManager* getInstance() { if (!singletonRef) singletonRef = new ResourceManager(); return singletonRef; }; 97 97 98 bool setDataDir(const char*dataDir);98 bool setDataDir(const std::string& dataDir); 99 99 /** @returns the Name of the data directory */ 100 inline const char*getDataDir() const { return this->dataDir; };100 inline const std::string& getDataDir() const { return this->dataDir; }; 101 101 102 102 103 bool tryDataDir(const char*dataDir);104 bool verifyDataDir(const char*fileInside);105 bool addImageDir(const char*imageDir);103 bool tryDataDir(const std::string& dataDir); 104 bool verifyDataDir(const std::string& fileInside); 105 bool addImageDir(const std::string& imageDir); 106 106 107 bool cache(const char*fileName, ResourceType type, ResourcePriority prio = RP_NO,107 bool cache(const std::string& fileName, ResourceType type, ResourcePriority prio = RP_NO, 108 108 const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType()); 109 109 BaseObject* copy(BaseObject* resourcePointer); 110 110 111 BaseObject* load(const char*fileName, ResourcePriority prio = RP_NO,111 BaseObject* load(const std::string& fileName, ResourcePriority prio = RP_NO, 112 112 const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType()); 113 BaseObject* load(const char*fileName, ResourceType type, ResourcePriority prio = RP_NO,113 BaseObject* load(const std::string& fileName, ResourceType type, ResourcePriority prio = RP_NO, 114 114 const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType()); 115 115 bool unload(BaseObject* pointer, ResourcePriority prio = RP_NO); … … 117 117 bool unloadAllByPriority(ResourcePriority prio); 118 118 119 Resource* locateResourceByInfo(const char*fileName, ResourceType type,119 Resource* locateResourceByInfo(const std::string& fileName, ResourceType type, 120 120 const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType()) const; 121 121 Resource* locateResourceByPointer(const void* pointer) const; 122 122 123 char*toResourcableString(unsigned int i);124 bool fromResourceableString(const char*resourceableString);123 std::string toResourcableString(unsigned int i); 124 bool fromResourceableString(const std::string& resourceableString); 125 125 /** @returns the Count of Resources the ResourceManager handles */ 126 126 unsigned int resourceCount() const { return this->resourceList.size(); } … … 130 130 131 131 // utility functions for handling files in and around the data-directory 132 static bool isDir(const char*directory);133 static bool isFile(const char*fileName);134 static bool touchFile(const char*fileName);135 static bool deleteFile(const char*fileName);136 static char* homeDirCheck(const char*fileName);137 static char* getFullName(const char*fileName);138 static bool isInDataDir(const char*fileName);139 static char* getAbsDir(const char*fileName);140 static const char*cwd();132 static bool isDir(const std::string& directory); 133 static bool isFile(const std::string& fileName); 134 static bool touchFile(const std::string& fileName); 135 static bool deleteFile(const std::string& fileName); 136 static std::string homeDirCheck(const std::string& fileName); 137 static std::string getFullName(const std::string& fileName); 138 static bool isInDataDir(const std::string& fileName); 139 static std::string getAbsDir(const std::string& fileName); 140 static const std::string& cwd(); 141 141 142 142 static const char* ResourceTypeToChar(ResourceType type); … … 145 145 private: 146 146 ResourceManager(); 147 Resource* loadResource(const char*fileName, ResourceType type, ResourcePriority prio,147 Resource* loadResource(const std::string& fileName, ResourceType type, ResourcePriority prio, 148 148 const MultiType& param0, const MultiType& param1, const MultiType& param2); 149 149 150 150 private: 151 static ResourceManager* singletonRef; //!< singleton Reference151 static ResourceManager* singletonRef; //!< singleton Reference 152 152 153 char*_cwd; //!< The currend Working directory.154 char*dataDir; //!< The Data Directory, where all relevant Data is stored.155 std::vector< char*>imageDirs; //!< A list of directories in which images are stored.153 std::string _cwd; //!< The currend Working directory. 154 std::string dataDir; //!< The Data Directory, where all relevant Data is stored. 155 std::vector<std::string> imageDirs; //!< A list of directories in which images are stored. 156 156 157 std::vector<Resource*> resourceList; //!< The List of Resources, that has already been loaded.157 std::vector<Resource*> resourceList; //!< The List of Resources, that has already been loaded. 158 158 159 static const char* resourceNames[RESOURCE_TYPE_SIZE];159 static const char* resourceNames[RESOURCE_TYPE_SIZE]; 160 160 }; 161 161
Note: See TracChangeset
for help on using the changeset viewer.