Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

D:/Programming/GUI Editor (Source)/ResourceManager.cpp

00001 #include "stdafx.h" 00002 #include "ResourceManager.h" 00003 00004 CResourceManager::CResourceManager() 00005 { 00006 SetEntityType(Entity_ResourceManager); 00007 } 00008 00009 CResourceManager::~CResourceManager() 00010 { 00011 Destroy(); 00012 } 00013 00014 int CResourceManager::LoadXML(TiXmlNode *pDataNode, CString strFilename) 00015 { 00016 TiXmlElement* pXMLElement = NULL; 00017 const char *pcValue = NULL; 00018 00019 int iRetValue = CXMLResource::LoadXML(pDataNode, strFilename); // LoadXML the data of derivative 00020 if(iRetValue !=1) 00021 return iRetValue; 00022 00023 pXMLElement = m_pXMLElement; 00024 00025 return 1; 00026 } 00027 00028 int CResourceManager::SaveXML(TiXmlNode *pDataNode, CString strFilename) 00029 { 00030 00031 return 0; 00032 } 00033 00034 CXMLResource *CResourceManager::AddResource(CString strName, UINT uiID, eEntityType ResourceType) 00035 { 00036 00037 return NULL; 00038 } 00039 00040 CXMLResource *CResourceManager::GetResource(int uiIndex, int uiID, CString strName, CString strFilename) 00041 { 00042 if(uiID !=-1 && uiIndex == -1 && strName == "" && strFilename == "") // get by uiID 00043 { 00044 CXMLResource *ResourcePtr = begin(); 00045 set_ptr(ResourcePtr); 00046 00047 while(ResourcePtr !=NULL) 00048 { 00049 if(ResourcePtr->GetID() == uiID) 00050 return (CXMLResource *)ResourcePtr; 00051 00052 ResourcePtr = next(); 00053 } 00054 } 00055 else if(strName !="" && uiIndex == -1 && uiID == -1 && strFilename == "") // get by name 00056 { 00057 CXMLResource *ResourcePtr = begin(); 00058 set_ptr(ResourcePtr); 00059 00060 while(ResourcePtr !=NULL) 00061 { 00062 if(ResourcePtr->GetName() == strName) 00063 return (CXMLResource *)ResourcePtr; 00064 00065 ResourcePtr = next(); 00066 } 00067 } 00068 else if(uiIndex !=-1 && uiID == -1 && strName == "" && strFilename == "") // get by index 00069 { 00070 if(uiIndex >=0 && uiIndex < size()) 00071 return (CXMLResource *)at(uiIndex); 00072 } 00073 else if(strFilename !="" && uiID == -1 && strName == "" && uiIndex == -1) 00074 { 00075 CXMLResource *ResourcePtr = begin(); 00076 set_ptr(ResourcePtr); 00077 00078 while(ResourcePtr !=NULL) 00079 { 00080 if(ResourcePtr->GetFilename() == strFilename) 00081 return (CXMLResource *)ResourcePtr; 00082 00083 ResourcePtr = next(); 00084 } 00085 } 00086 00087 return NULL; 00088 } 00089 00090 int CResourceManager::RemoveResource(CXMLResource *pResource) 00091 { 00092 00093 return 1; 00094 } 00095 00096 void CResourceManager::Destroy() 00097 { 00098 while(size() !=0) 00099 { 00100 CXMLResource *pResource = pop_back(); 00101 SAFEDEL(pResource) 00102 } 00103 00104 CXMLResource::Destroy(); 00105 } 00106 00107 bool CResourceManager::IsOfType(eEntityType eType) 00108 { 00109 if(eType == Entity_ResourceManager) 00110 return true; 00111 00112 return CXMLResource::IsOfType(eType); 00113 }

Generated on Sun Jul 17 21:34:28 2005 for OpenGL GUI by doxygen 1.3.8