Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

ClassFactory.h

Go to the documentation of this file.
00001 // ClassFactory.h: interface for the CClassFactory class.
00002 //
00004 
00005 #if !defined(XML_CLASS_FACTORY_INCLUDE)
00006 #define XML_CLASS_FACTORY_INCLUDE
00007 
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011 
00012 #include "tinyxml\tinyxml.h"
00013 
00101 
00102 
00107 class CClassFactory  
00108 {
00109 public: 
00110 
00111         /* INITIALIZATION ****/
00112 
00114 
00117         CClassFactory();
00118 
00120 
00123         virtual ~CClassFactory();
00124 
00125 
00127 
00130         void clearClasDef();
00131 
00132 
00134 
00137         void clearCurContext();
00138 
00139         /* CLASS MANIPULATION ****/
00140 
00142 
00152         bool addClass (const char * className, const char* extends);
00153 
00154 
00156 
00167         TiXmlNode* findClass(const char* className);
00168 
00169 
00171 
00181         bool deleteClass(const char* className);
00182 
00183         /* ATTRIBUTE MANIPULATION ****/
00184 
00186 
00194         bool addAttribute(const char* className, const char* attributeName);
00195 
00196 
00198 
00206         bool deleteAttribute(const char *className, const char *attributeName);
00207 
00208         
00209         /* INSTANCE MANIPULATION ****/
00210 
00212 
00223         bool newInstance(const char * className, const char* instanceName);
00224 
00226 
00236         TiXmlNode* findInstance(const char * instanceName);
00237 
00239 
00248         bool deleteInstace(const char* instanceName);
00249 
00251 
00262         bool setValue(const char * instanceName, const char* attributeName, 
00263                 const char* value);
00264 
00266 
00276         CString getValue(const char * instanceName, const char* attributeName);
00277 
00278 
00279         /* PERSISTENCE ****/
00281 
00290         bool loadClassDef(const char* filename);
00291 
00293 
00302         bool saveClassDef(const char *filename);
00303 
00304 
00305 
00307 
00316         bool loadContext(const char *filename);
00317 
00318 
00320 
00329         bool saveContext(const char *filename);
00330 
00331 
00332         /* GETs ****/
00333 
00335 
00344         inline TiXmlDocument* getClassDef(){return &classesDefinitions;}
00345 
00347 
00356         inline TiXmlDocument* getCurContext(){return &currentContext;}
00357 
00358 
00359 private:
00360         
00361         /* ATTRIBUTES ****/
00362 
00364 
00367         TiXmlDocument classesDefinitions;
00368 
00370 
00373         TiXmlDocument currentContext;
00374 
00375         /* HELPERS ****/
00376 
00378 
00387         bool addAttributesToInstance(TiXmlElement* element, TiXmlNode* classNode);
00388 
00390 
00394         void error(char message[], ...);
00395         
00396 
00397 };
00398 
00399 #endif // !defined(XML_CLASS_FACTORY_INCLUDE)

Generated on Wed Oct 2 10:33:38 2002 for XML Class Factory by doxygen1.2.15