00001 00012 #ifndef __CONFIG_PROCESSOR__H__ 00013 #define __CONFIG_PROCESSOR__H__ 00014 00015 #include "../common.h" 00016 #include "../objects/Object.h" 00017 #include "../objects/ObjectAgent.h" 00018 #include "../objects/ObjectFixed.h" 00019 #include "../objects/ObjectTrail.h" 00020 #include "../objects/ObjectTransferable.h" 00021 #include "../FactoryObjectConfigs.h" 00022 #include "../tinyxml/tinyxml.h" 00023 #include "ConfigCanvas.h" 00024 #include "ConfigMatrix.h" 00025 #include "ConfigApplication.h" 00026 00035 class ConfigProcessor { 00036 public: 00040 enum IOMode { 00041 LOAD, 00042 SAVE 00043 }; 00044 00045 public: 00051 ConfigProcessor(string fileName, IOMode io); 00052 00056 ~ConfigProcessor(); 00057 00061 string GetCurrentProcessedFileName() const { 00062 return xmlFileName; 00063 } 00064 00070 ConfigApplication * GetConfigApplication(); 00071 00077 ConfigCanvas * GetConfigCanvas(); 00078 00084 ConfigMatrix * GetConfigMatrix(); 00085 00091 Object::Config * GetConfigObject(); 00092 00097 void SaveConfig(const BaseConfig & config); 00098 00108 static FactoryObjectConfigsDeclar::ProductType * CreateObjectConfig( 00109 const FactoryObjectConfigsDeclar::IdentifierType & name, 00110 const FactoryObjectConfigsDeclar::InitializerType & initializer) { 00111 return FactoryObjectConfigs::Instance().CreateObject(name, initializer); 00112 } 00113 00114 private: 00116 TiXmlDocument xmlFileTiny; 00118 string xmlFileName; 00120 IOMode mode; 00122 TiXmlElement * element; 00124 TiXmlHandle hRoot; 00125 }; 00126 00127 #endif /* #ifndef __CONFIG_PROCESSOR__H__ */ 00128 00129 /* End of file ConfigProcessor.h */