00001 #ifndef ArmageTron_RESOURCEMANAGER_H 00002 #define ArmageTron_RESOURCEMANAGER_H 00003 00004 #include "tString.h" 00005 #include "tResource.h" 00006 00007 typedef int (*tNewResourceFunc)(const char* path); 00008 00010 class tResourceManager { 00011 public: 00013 00019 static tResource* GetResource(const char *file, int typeID); 00020 00022 00030 static int RegisterResourceType(tNewResourceFunc func); 00031 00033 static tString locateResource(const char *file, const char *uri=""); 00035 static FILE *openResource(const char *pathname, const char *uri=""); 00036 00038 static tString & AccessRepoServer(); 00039 00041 static tString & AccessRepoClient(); 00042 00044 // todo: finish this 00045 static void RegisterLoader(); 00046 }; 00047 00049 class tResourcePath 00050 { 00051 tString m_Author; 00052 tString m_Category; 00053 tString m_Name; 00054 tString m_Version; 00055 tString m_Type; 00056 tString m_Extension; 00057 tString m_URI; 00058 tString m_Path; 00059 00060 bool m_Valid; 00061 public: 00062 tString const &Author () const {return m_Author ;} 00063 tString const &Category () const {return m_Category ;} 00064 tString const &Name () const {return m_Name ;} 00065 tString const &Version () const {return m_Version ;} 00066 tString const &Type () const {return m_Type ;} 00067 tString const &Extension() const {return m_Extension;} 00068 tString const &URI () const {return m_URI ;} 00069 tString const &Path () const {return m_Path ;} 00070 00071 bool Valid() const {return m_Valid;} 00072 00074 tResourcePath():m_Valid(false){} 00075 00077 tResourcePath(tString const &Author, 00078 tString const &Category, 00079 tString const &Name, 00080 tString const &Version, 00081 tString const &Type, 00082 tString const &Extension, 00083 tString const &URI); 00084 00086 tResourcePath(tString const &path); 00087 00088 bool operator==(tResourcePath const &other) const; 00089 bool operator!=(tResourcePath const &other) const; 00090 }; 00091 00092 #endif //ArmageTron_RESOURCEMANAGER_H