00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "FUtils/FUDaeParser.h"
00013
00014 template <class T>
00015 FCDLibrary<T>::FCDLibrary(FCDocument* _document)
00016 {
00017 document = _document;
00018 }
00019
00020 template <class T>
00021 FCDLibrary<T>::~FCDLibrary()
00022 {
00023 CLEAR_POINTER_VECTOR(entities);
00024 }
00025
00026
00027
00028 template <class T>
00029 T* FCDLibrary<T>::AddEntity()
00030 {
00031 T* entity = new T(document);
00032 entities.push_back(entity);
00033 return entity;
00034 }
00035
00036
00037 template <class T>
00038 void FCDLibrary<T>::ReleaseEntity(T* entity)
00039 {
00040
00041
00042 }
00043
00044
00045
00046 template <class T>
00047 FUStatus FCDLibrary<T>::LoadFromXML(xmlNode* node)
00048 {
00049 FUStatus status;
00050 for (xmlNode* entityNode = node->children; entityNode != NULL; entityNode = entityNode->next)
00051 {
00052 if (entityNode->type == XML_ELEMENT_NODE)
00053 {
00054 T* entity = AddEntity();
00055 status.AppendStatus(entity->LoadFromXML(entityNode));
00056 }
00057 }
00058 return status;
00059 }
00060
00061
00062 template <class T>
00063 void FCDLibrary<T>::WriteToXML(xmlNode* node) const
00064 {
00065 for (typename FCDEntityList::const_iterator itEntity = entities.begin(); itEntity != entities.end(); ++itEntity)
00066 {
00067 const T* entity = (const T*) (*itEntity);
00068 entity->WriteToXML(node);
00069 }
00070 }
00071
00072
00073 template <class T>
00074 T* FCDLibrary<T>::FindDaeId(const string& _daeId)
00075 {
00076 const char* daeId = FUDaeParser::SkipPound(_daeId);
00077 for (typename FCDEntityList::iterator itEntity = entities.begin(); itEntity != entities.end(); ++itEntity)
00078 {
00079 if ((*itEntity)->GetDaeId() == daeId) return (*itEntity);
00080 }
00081 return NULL;
00082 }
00083
00084 template <class T>
00085 StringList FCDLibrary<T>::GetPostProcessCmds() const
00086 {
00087 StringList res;
00088 for (typename FCDEntityList::const_iterator itEntity = entities.begin(); itEntity != entities.end(); ++itEntity)
00089 {
00090 res = (*itEntity)->GetPostProcessCmds();
00091 }
00092 return res;
00093 }