Qt IOC Container 3.5


qic::XmlObjectDefinitionReader Class Reference

#include <XmlObjectDefinitionReader.h>

Inheritance diagram for qic::XmlObjectDefinitionReader:

Inheritance graph
[legend]
Collaboration diagram for qic::XmlObjectDefinitionReader:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 XmlObjectDefinitionReader (ObjectDefinitionRegistry *objectRegistry)
virtual ~XmlObjectDefinitionReader ()
int loadObjectDefinitions (QString path)
int loadObjectDefinitions (QDomDocument &doc)
int loadObjectDefinitions (QIODevice &source)

Protected Member Functions

void loadInjectorPlugins ()
void loadParserPlugins ()
void unloadParserPlugins ()
void parseObjectTag (QDomElement &)
void parseObjectPropertyTag (QString id, QDomElement &e, ObjectDefinition *def)
void parseFactoryObject (QString id, QDomElement &e, ObjectDefinition *def)
void parseObjectPropertySubTag (QString id, QString name, QDomNode &objNode, ObjectDefinition *def)
void parseParserTag (QDomElement &)
void parseInjectorTag (QDomElement &e)
void parseWireTag (QDomElement &)

Protected Attributes

ObjectDefinitionRegistry_objectRegistry
QString _currentFile
QHash< QString, QObject * > _parser_map
QHash< QString, QPluginLoader * > _parser_loader_map

Static Protected Attributes

static const char * QIC_BASE_DIR = "QIC_DIR"
static const char * OBJECTS_TAG = "objects"
static const char * OBJECT_TAG = "object"
static const char * PARSER_TAG = "parser"
static const char * INJECTOR_TAG = "injector"
static const char * INJECTOR_TYPE_ATTR = "type"
static const char * WIRE_TAG = "wire"
static const char * WIRE_TYPE_ATTR = "type"
static const char * SENDER_TAG = "sender"
static const char * RECEIVER_TAG = "receiver"
static const char * RECEIVER_ID_ATTR = "id"
static const char * SENDER_ID_ATTR = "id"
static const char * SENDER_SIGNAL_ATTR = "signal"
static const char * RECEIVER_METHOD_ATTR = "method"
static const char * TAG_ATTR = "tag"
static const char * PLUGIN_ATTR = "plugin"
static const char * ID_ATTR = "id"
static const char * FACTORY_ATTR = "factory-object"
static const char * FACTORY_METHOD_ATTR = "factory-method"
static const char * INIT_METHOD_ATTR = "init-method"
static const char * DESTROY_METHOD_ATTR = "destroy-method"
static const char * PROPERTY_TAG = "property"
static const char * REF_ATTR = "ref"
static const char * NAME_ATTR = "name"

Detailed Description

Convert XML configuration to ObjectDefinitions in ObjectRegistry.

Author:
Zhihong "John" Wang

Definition at line 23 of file XmlObjectDefinitionReader.h.


Constructor & Destructor Documentation

XmlObjectDefinitionReader::XmlObjectDefinitionReader ObjectDefinitionRegistry objectRegistry  ) 
 

Definition at line 50 of file XmlObjectDefinitionReader.cpp.

References _objectRegistry, loadInjectorPlugins(), and loadParserPlugins().

XmlObjectDefinitionReader::~XmlObjectDefinitionReader  )  [virtual]
 

Definition at line 58 of file XmlObjectDefinitionReader.cpp.

References unloadParserPlugins().


Member Function Documentation

void XmlObjectDefinitionReader::loadInjectorPlugins  )  [protected]
 

Definition at line 108 of file XmlObjectDefinitionReader.cpp.

References qic::Util::getEnvVariable(), loadObjectDefinitions(), and QIC_BASE_DIR.

Referenced by XmlObjectDefinitionReader().

int XmlObjectDefinitionReader::loadObjectDefinitions QIODevice &  source  )  [virtual]
 

Implements qic::ObjectDefinitionReader.

Definition at line 93 of file XmlObjectDefinitionReader.cpp.

References _currentFile.

int XmlObjectDefinitionReader::loadObjectDefinitions QDomDocument &  doc  ) 
 

Definition at line 152 of file XmlObjectDefinitionReader.cpp.

References _currentFile.

int XmlObjectDefinitionReader::loadObjectDefinitions QString  path  ) 
 

Definition at line 64 of file XmlObjectDefinitionReader.cpp.

References _currentFile.

Referenced by loadInjectorPlugins(), loadParserPlugins(), and qic::XmlApplicationContextImpl::XmlApplicationContextImpl().

void XmlObjectDefinitionReader::loadParserPlugins  )  [protected]
 

Definition at line 120 of file XmlObjectDefinitionReader.cpp.

References qic::Util::getEnvVariable(), loadObjectDefinitions(), and QIC_BASE_DIR.

Referenced by XmlObjectDefinitionReader().

void XmlObjectDefinitionReader::parseFactoryObject QString  id,
QDomElement &  e,
ObjectDefinition def
[protected]
 

Definition at line 354 of file XmlObjectDefinitionReader.cpp.

References FACTORY_ATTR, and PLUGIN_ATTR.

void XmlObjectDefinitionReader::parseInjectorTag QDomElement &  e  )  [protected]
 

Definition at line 453 of file XmlObjectDefinitionReader.cpp.

References INJECTOR_TYPE_ATTR.

void XmlObjectDefinitionReader::parseObjectPropertySubTag QString  id,
QString  name,
QDomNode &  objNode,
ObjectDefinition def
[protected]
 

Definition at line 277 of file XmlObjectDefinitionReader.cpp.

References _parser_map, qic::Util::asXml(), qic::PropertyParser::parseProperty(), qic::ObjectDefinition::setPropertyValue(), and qic::Util::translateVariable().

void XmlObjectDefinitionReader::parseObjectPropertyTag QString  id,
QDomElement &  e,
ObjectDefinition def
[protected]
 

Definition at line 308 of file XmlObjectDefinitionReader.cpp.

void XmlObjectDefinitionReader::parseObjectTag QDomElement &   )  [protected]
 

Definition at line 381 of file XmlObjectDefinitionReader.cpp.

References DESTROY_METHOD_ATTR, INIT_METHOD_ATTR, qic::DefaultObjectDefinition::setDestroyMethodName(), qic::DefaultObjectDefinition::setId(), and qic::DefaultObjectDefinition::setInitMethodName().

void XmlObjectDefinitionReader::parseParserTag QDomElement &   )  [protected]
 

Definition at line 431 of file XmlObjectDefinitionReader.cpp.

References TAG_ATTR.

void XmlObjectDefinitionReader::parseWireTag QDomElement &   )  [protected]
 

Definition at line 206 of file XmlObjectDefinitionReader.cpp.

References qic::DefaultWireDefinition::setWireType(), and WIRE_TYPE_ATTR.

void XmlObjectDefinitionReader::unloadParserPlugins  )  [protected]
 

Definition at line 132 of file XmlObjectDefinitionReader.cpp.

References _parser_loader_map.

Referenced by ~XmlObjectDefinitionReader().


Member Data Documentation

QString qic::XmlObjectDefinitionReader::_currentFile [protected]
 

Current XML file being parsed. For logging purpose only.

Definition at line 197 of file XmlObjectDefinitionReader.h.

Referenced by loadObjectDefinitions().

ObjectDefinitionRegistry* qic::XmlObjectDefinitionReader::_objectRegistry [protected]
 

Definition at line 192 of file XmlObjectDefinitionReader.h.

Referenced by XmlObjectDefinitionReader().

QHash<QString, QPluginLoader *> qic::XmlObjectDefinitionReader::_parser_loader_map [protected]
 

PluginLoaders for parsers indexed by XML tag name.

Definition at line 207 of file XmlObjectDefinitionReader.h.

Referenced by unloadParserPlugins().

QHash<QString, QObject *> qic::XmlObjectDefinitionReader::_parser_map [protected]
 

XML tag => parser object.

Definition at line 202 of file XmlObjectDefinitionReader.h.

Referenced by parseObjectPropertySubTag().

const char * XmlObjectDefinitionReader::DESTROY_METHOD_ATTR = "destroy-method" [static, protected]
 

Attribute name for destroy method.

Provide destroy method name only (not signature).

Destroy method does not take any parameters.

Definition at line 175 of file XmlObjectDefinitionReader.h.

Referenced by parseObjectTag().

const char * XmlObjectDefinitionReader::FACTORY_ATTR = "factory-object" [static, protected]
 

Attribute name for factory object id.

Definition at line 148 of file XmlObjectDefinitionReader.h.

Referenced by parseFactoryObject().

const char * XmlObjectDefinitionReader::FACTORY_METHOD_ATTR = "factory-method" [static, protected]
 

Attribute name for factory method.

Provide factory method name (not signature).

Factory method does not take any parameters. It returns QObject * as QVariant.

Definition at line 157 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::ID_ATTR = "id" [static, protected]
 

Attribute name for object id;

Definition at line 143 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::INIT_METHOD_ATTR = "init-method" [static, protected]
 

Attribute name for init method.

Provide init method name only (not signature).

Init method does not take any parameters.

Definition at line 166 of file XmlObjectDefinitionReader.h.

Referenced by parseObjectTag().

const char * XmlObjectDefinitionReader::INJECTOR_TAG = "injector" [static, protected]
 

Tag for reference injector plugin.

Definition at line 81 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::INJECTOR_TYPE_ATTR = "type" [static, protected]
 

Definition at line 83 of file XmlObjectDefinitionReader.h.

Referenced by parseInjectorTag().

const char * XmlObjectDefinitionReader::NAME_ATTR = "name" [static, protected]
 

Name attribute of a property.

Definition at line 190 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::OBJECT_TAG = "object" [static, protected]
 

Tag name to define an object.

Definition at line 71 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::OBJECTS_TAG = "objects" [static, protected]
 

Root tag name for the configuration file.

Definition at line 66 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::PARSER_TAG = "parser" [static, protected]
 

Tag name to define a parser.

Definition at line 76 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::PLUGIN_ATTR = "plugin" [static, protected]
 

Attribute name for absolute path to the plugin library file.

Definition at line 138 of file XmlObjectDefinitionReader.h.

Referenced by parseFactoryObject().

const char * XmlObjectDefinitionReader::PROPERTY_TAG = "property" [static, protected]
 

Tag name for object property.

Definition at line 180 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::QIC_BASE_DIR = "QIC_DIR" [static, protected]
 

QtIocContainer root directory.

Definition at line 61 of file XmlObjectDefinitionReader.h.

Referenced by loadInjectorPlugins(), and loadParserPlugins().

const char * XmlObjectDefinitionReader::RECEIVER_ID_ATTR = "id" [static, protected]
 

Attribute name for receiver object id.

Definition at line 109 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::RECEIVER_METHOD_ATTR = "method" [static, protected]
 

Attrbute name for receiver method.

Provide receiver method (signal or slot) signature in the format used in SLOT() macro.

Definition at line 128 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::RECEIVER_TAG = "receiver" [static, protected]
 

Tag name for receiver object of a wire definition.

Definition at line 104 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::REF_ATTR = "ref" [static, protected]
 

Reference attribute of a property.

Definition at line 185 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::SENDER_ID_ATTR = "id" [static, protected]
 

Attribute name for sender object id.

Definition at line 114 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::SENDER_SIGNAL_ATTR = "signal" [static, protected]
 

Attribute name for sender method.

Provide sender method (signal) signature.

Definition at line 121 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::SENDER_TAG = "sender" [static, protected]
 

Tag name for sender object of a wire definition.

Definition at line 99 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::TAG_ATTR = "tag" [static, protected]
 

Attribute name for the XML tag a parser object handles.

Definition at line 133 of file XmlObjectDefinitionReader.h.

Referenced by parseParserTag().

const char * XmlObjectDefinitionReader::WIRE_TAG = "wire" [static, protected]
 

Tag name to define a wire definition.

Definition at line 88 of file XmlObjectDefinitionReader.h.

const char * XmlObjectDefinitionReader::WIRE_TYPE_ATTR = "type" [static, protected]
 

Attribute name for the wire type.

Definition at line 94 of file XmlObjectDefinitionReader.h.

Referenced by parseWireTag().


The documentation for this class was generated from the following files: