00001
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
00112
00114
00117 CClassFactory();
00118
00120
00123 virtual ~CClassFactory();
00124
00125
00127
00130 void clearClasDef();
00131
00132
00134
00137 void clearCurContext();
00138
00139
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
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
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
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
00333
00335
00344 inline TiXmlDocument* getClassDef(){return &classesDefinitions;}
00345
00347
00356 inline TiXmlDocument* getCurContext(){return ¤tContext;}
00357
00358
00359 private:
00360
00361
00362
00364
00367 TiXmlDocument classesDefinitions;
00368
00370
00373 TiXmlDocument currentContext;
00374
00375
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)