1 | /*! |
---|
2 | * @file new_resource_manager.h |
---|
3 | */ |
---|
4 | |
---|
5 | #ifndef _NEW_RESOURCE_MANAGER_H |
---|
6 | #define _NEW_RESOURCE_MANAGER_H |
---|
7 | |
---|
8 | #include "resource.h" |
---|
9 | #include "filesys/file.h" |
---|
10 | #include "filesys/directory.h" |
---|
11 | |
---|
12 | class NewResourceManager : public BaseObject |
---|
13 | { |
---|
14 | ObjectListDeclaration(NewResourceManager); |
---|
15 | public: |
---|
16 | /** @returns a Pointer to the only object of this Class */ |
---|
17 | inline static NewResourceManager* getInstance() { if (!_singletonRef) _singletonRef = new NewResourceManager(); return _singletonRef; }; |
---|
18 | inline static void deleteInstance() { if (_singletonRef) delete _singletonRef; }; |
---|
19 | |
---|
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 | void unregisterType(Resources::Type* type); |
---|
28 | |
---|
29 | unsigned int addKeepLevelName(const std::string& keepLevelName); |
---|
30 | unsigned int getKeepLevelID(const std::string& keepLevelName) const; |
---|
31 | const std::string& getKeepLevelName(unsigned int keepLevelID) const; |
---|
32 | |
---|
33 | const std::vector<Resources::Type*> resourceTypes() const { return _resourceTypes; }; |
---|
34 | const Directory& mainGlobalPath() const { return _mainGlobalPath; }; |
---|
35 | /** @returns all global paths without mainGlobalPath */ |
---|
36 | const std::vector<Directory>& globalPaths() const { return _globalPaths; }; |
---|
37 | |
---|
38 | |
---|
39 | bool checkFileInMainPath(const File& fileInside); |
---|
40 | |
---|
41 | bool unloadAllByPriority(); |
---|
42 | |
---|
43 | void debug() const; |
---|
44 | |
---|
45 | // utility functions for handling files in and around the data-directory |
---|
46 | static std::string getFullName(const std::string& fileName); |
---|
47 | static bool isInDataDir(const std::string& fileName); |
---|
48 | private: |
---|
49 | NewResourceManager(); |
---|
50 | virtual ~NewResourceManager(); |
---|
51 | |
---|
52 | private: |
---|
53 | static NewResourceManager* _singletonRef; //!< singleton Reference |
---|
54 | |
---|
55 | std::vector<Resources::Type*> _resourceTypes; |
---|
56 | //! GLOBALS |
---|
57 | Directory _mainGlobalPath; |
---|
58 | std::vector<Directory> _globalPaths; |
---|
59 | |
---|
60 | std::vector<std::string> _keepLevelNames; |
---|
61 | }; |
---|
62 | |
---|
63 | #endif /* _RESOURCE_MANAGER_H */ |
---|