[4597] | 1 | /*! |
---|
[9790] | 2 | * @file new_resource_manager.h |
---|
| 3 | */ |
---|
[3329] | 4 | |
---|
[9790] | 5 | #ifndef _NEW_RESOURCE_MANAGER_H |
---|
| 6 | #define _NEW_RESOURCE_MANAGER_H |
---|
[4534] | 7 | |
---|
[9790] | 8 | #include "resource.h" |
---|
[8330] | 9 | #include "filesys/file.h" |
---|
[9790] | 10 | #include "filesys/directory.h" |
---|
[7661] | 11 | |
---|
[9790] | 12 | class NewResourceManager : public BaseObject |
---|
[4597] | 13 | { |
---|
[9791] | 14 | // ObjectListDeclaration(NewResourceManager); |
---|
[9684] | 15 | public: |
---|
[9790] | 16 | virtual ~NewResourceManager(); |
---|
[4836] | 17 | /** @returns a Pointer to the only object of this Class */ |
---|
[9791] | 18 | inline static NewResourceManager* getInstance() { if (!_singletonRef) _singletonRef = new NewResourceManager(); return _singletonRef; }; |
---|
[1853] | 19 | |
---|
[9791] | 20 | |
---|
| 21 | void setMainGlobalPath(const Directory& directory); |
---|
| 22 | void addGlobalPath(const Directory& directory); |
---|
| 23 | |
---|
| 24 | bool addResourcePath(const std::string& resourceName, const std::string& pathName); |
---|
| 25 | bool addResourceSubPath(const std::string& resourceName, const std::string& pathName); |
---|
| 26 | void registerType(Resources::Type* type); |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | const std::vector<Resources::Type*> resourceTypes() const { return _resourceTypes; }; |
---|
| 30 | const Directory& mainGlobalPath() const { return _mainGlobalPath; }; |
---|
| 31 | /** @returns all global paths without mainGlobalPath */ |
---|
| 32 | const std::vector<Directory>& globalPaths() const { return _globalPaths; }; |
---|
| 33 | |
---|
| 34 | |
---|
[7221] | 35 | bool verifyDataDir(const std::string& fileInside); |
---|
[6640] | 36 | |
---|
[9790] | 37 | bool unloadAllByPriority(); |
---|
[6640] | 38 | |
---|
[4746] | 39 | void debug() const; |
---|
[3245] | 40 | |
---|
[5480] | 41 | // utility functions for handling files in and around the data-directory |
---|
[7221] | 42 | static std::string getFullName(const std::string& fileName); |
---|
| 43 | static bool isInDataDir(const std::string& fileName); |
---|
[9684] | 44 | private: |
---|
[9790] | 45 | NewResourceManager(); |
---|
[3245] | 46 | |
---|
[9684] | 47 | private: |
---|
[9791] | 48 | static NewResourceManager* _singletonRef; //!< singleton Reference |
---|
[3672] | 49 | |
---|
[9791] | 50 | std::vector<Resources::Type*> _resourceTypes; |
---|
| 51 | //! GLOBALS |
---|
| 52 | Directory _mainGlobalPath; |
---|
| 53 | std::vector<Directory> _globalPaths; |
---|
| 54 | |
---|
| 55 | |
---|
[1853] | 56 | }; |
---|
| 57 | |
---|
[3655] | 58 | #endif /* _RESOURCE_MANAGER_H */ |
---|