Qt IOC Container 3.5


XmlObjectDefinitionReader.h

Go to the documentation of this file.
00001 
00002 #ifndef QIC_XML_OBJECT_DEFINITION_READER_H_
00003 #define QIC_XML_OBJECT_DEFINITION_READER_H_
00004 
00005 #include "ObjectDefinitionReader.h"
00006 #include "ObjectDefinitionRegistry.h"
00007 
00008 #include <QtXml/QDomDocument>
00009 #include <QHash>
00010 #include <QPluginLoader>
00011 
00012 #include <log4cxx/logger.h>
00013 
00014 namespace qic
00015 {
00016 
00023   class XmlObjectDefinitionReader : public ObjectDefinitionReader
00024   {
00025     static log4cxx::LoggerPtr logger;
00026 
00027   public:
00028 
00029     XmlObjectDefinitionReader (ObjectDefinitionRegistry * objectRegistry);
00030 
00031     virtual ~XmlObjectDefinitionReader();
00032 
00033     int loadObjectDefinitions (QString path);
00034 
00035     int loadObjectDefinitions (QDomDocument & doc);
00036 
00037     int loadObjectDefinitions (QIODevice & source);
00038 
00039   protected:
00040     void loadInjectorPlugins ();
00041 
00042     void loadParserPlugins ();
00043 
00044     void unloadParserPlugins ();
00045 
00046     void parseObjectTag (QDomElement &);
00047 
00048     void parseObjectPropertyTag (QString id, QDomElement & e, ObjectDefinition * def);
00049     void parseFactoryObject (QString id, QDomElement & e, ObjectDefinition * def);
00050     void parseObjectPropertySubTag (QString id, QString name, QDomNode & objNode, ObjectDefinition * def);
00051 
00052     void parseParserTag(QDomElement &);
00053 
00054     void parseInjectorTag(QDomElement & e);
00055 
00056     void parseWireTag(QDomElement &);
00057 
00061     static const char * QIC_BASE_DIR;
00062 
00066     static const char * OBJECTS_TAG;
00067 
00071     static const char * OBJECT_TAG;
00072 
00076     static const char * PARSER_TAG;
00077 
00081     static const char * INJECTOR_TAG;
00082 
00083     static const char * INJECTOR_TYPE_ATTR;
00084 
00088     static const char * WIRE_TAG;
00089 
00094     static const char * WIRE_TYPE_ATTR;
00095 
00099     static const char * SENDER_TAG;
00100 
00104     static const char * RECEIVER_TAG;
00105 
00109     static const char * RECEIVER_ID_ATTR;
00110 
00114     static const char * SENDER_ID_ATTR;
00115 
00121     static const char * SENDER_SIGNAL_ATTR;
00122 
00128     static const char * RECEIVER_METHOD_ATTR;
00129 
00133     static const char * TAG_ATTR;
00134 
00138     static const char * PLUGIN_ATTR;
00139 
00143     static const char * ID_ATTR;
00144 
00148     static const char * FACTORY_ATTR;
00149 
00157     static const char * FACTORY_METHOD_ATTR;
00158 
00166     static const char * INIT_METHOD_ATTR;
00167 
00175     static const char * DESTROY_METHOD_ATTR;
00176 
00180     static const char * PROPERTY_TAG;
00181 
00185     static const char * REF_ATTR;
00186 
00190     static const char * NAME_ATTR;
00191 
00192     ObjectDefinitionRegistry * _objectRegistry;
00193 
00197     QString _currentFile;
00198 
00202     QHash <QString, QObject *> _parser_map;
00203 
00207     QHash <QString, QPluginLoader *> _parser_loader_map;
00208 
00209   }
00210   ; // class XmlObjectDefinitionReader
00211 
00212 }
00213 ; // namespace qic
00214 
00215 #endif