#include <ConfigProcessor.h>
Public Types | |
LOAD | |
SAVE | |
enum | IOMode { LOAD, SAVE } |
Possible I/O modes for the processor. More... | |
Public Member Functions | |
ConfigProcessor (string fileName, IOMode io) | |
Constructor of this class. | |
~ConfigProcessor () | |
Destructor of this class. | |
string | GetCurrentProcessedFileName () const |
Returns name of the file currently being processed. | |
ConfigApplication * | GetConfigApplication () |
Loads configuration of application from the file. | |
ConfigCanvas * | GetConfigCanvas () |
Loads configuration of canvas from the file. | |
ConfigMatrix * | GetConfigMatrix () |
Loads configuration of matrix from the file. | |
Object::Config * | GetConfigObject () |
Loads configuration of the object from the file. | |
void | SaveConfig (const BaseConfig &config) |
Saves configuration to the file. | |
Static Public Member Functions | |
static FactoryObjectConfigsDeclar::ProductType * | CreateObjectConfig (const FactoryObjectConfigsDeclar::IdentifierType &name, const FactoryObjectConfigsDeclar::InitializerType &initializer) |
According to the name value creates new object's config of that type on the heap passing to its constructor FactoryObjectConfigsDeclar::InitializerType parameter. | |
Private Attributes | |
TiXmlDocument | xmlFileTiny |
TinyXML class for parsing XML documents. | |
string | xmlFileName |
Name of the file currently being processed. | |
IOMode | mode |
I/O mode the processor is in. | |
TiXmlElement * | element |
Root element processor is currently working with. | |
TiXmlHandle | hRoot |
Handler to the root "agents2007" element. |
Use this class for reading/writing configuration info from/to file. Every loading function of this class throws ExceptionConfigBadFile when incompatible file (config) is detected. Every function throws ExceptionConfigBadMode when they are called in bad mode.
ConfigProcessor::ConfigProcessor | ( | string | fileName, | |
IOMode | io | |||
) |
Constructor of this class.
fileName | Name of the file with the configuration. | |
io | I/O mode for the Processor |
ConfigProcessor::~ConfigProcessor | ( | ) |
Destructor of this class.
static FactoryObjectConfigsDeclar::ProductType* ConfigProcessor::CreateObjectConfig | ( | const FactoryObjectConfigsDeclar::IdentifierType & | name, | |
const FactoryObjectConfigsDeclar::InitializerType & | initializer | |||
) | [inline, static] |
According to the name value creates new object's config of that type on the heap passing to its constructor FactoryObjectConfigsDeclar::InitializerType parameter.
name | Name of the object | |
initializer | Argument for constructor of the new object |
ConfigApplication * ConfigProcessor::GetConfigApplication | ( | ) |
Loads configuration of application from the file.
The config is allocated on heap and has to be explicitly deleted!
ConfigCanvas * ConfigProcessor::GetConfigCanvas | ( | ) |
Loads configuration of canvas from the file.
The config is allocated on heap and has to be explicitly deleted!
ConfigMatrix * ConfigProcessor::GetConfigMatrix | ( | ) |
Loads configuration of matrix from the file.
The config is allocated on heap and has to be explicitly deleted!
Object::Config * ConfigProcessor::GetConfigObject | ( | ) |
Loads configuration of the object from the file.
The config is allocated on heap and has to be explicitly fdeleted!
string ConfigProcessor::GetCurrentProcessedFileName | ( | ) | const [inline] |
Returns name of the file currently being processed.
void ConfigProcessor::SaveConfig | ( | const BaseConfig & | config | ) |
Saves configuration to the file.
config | Config with the settings to be saved. |
TiXmlElement* ConfigProcessor::element [private] |
Root element processor is currently working with.
TiXmlHandle ConfigProcessor::hRoot [private] |
Handler to the root "agents2007" element.
IOMode ConfigProcessor::mode [private] |
I/O mode the processor is in.
string ConfigProcessor::xmlFileName [private] |
Name of the file currently being processed.
TiXmlDocument ConfigProcessor::xmlFileTiny [private] |
TinyXML class for parsing XML documents.