oopapidocs  2.0
qobjectreader.h
00001 #ifndef DATAOBJECTREADER_H
00002 #define DATAOBJECTREADER_H
00003 
00004 //start
00005 #include "dobjs_export.h"
00006 #include <QString>
00007 #include <QStack>
00008 #include <QQueue>
00009 #include <QXmlDefaultHandler>
00010 
00011 class AbstractFactory;
00012 
00022 class DOBJS_EXPORT  QObjectReader : public QXmlDefaultHandler {
00023   public:
00033     explicit QObjectReader (AbstractFactory* factory=0) : 
00034                          m_Factory(factory), m_Current(0) { }
00035     explicit QObjectReader (QString filename, AbstractFactory* factory=0);
00036     void parse(QString text);
00037     void parseFile(QString filename);
00044     QObject* getRoot();
00045     ~QObjectReader();
00046 
00047     // callback methods from QXmlDefaultHandler
00048     bool startElement( const QString& namespaceURI,
00049                        const QString& name,
00050                        const QString& qualifiedName,
00051                        const QXmlAttributes& attributes );
00052     bool endElement(  const QString& namespaceURI,
00053                       const QString& localName,
00054                       const QString& qualifiedName);
00055     bool endDocument();
00056   private:
00057     void addCurrentToQueue();
00058     AbstractFactory* m_Factory;
00059     QObject* m_Current;
00060     QQueue<QObject*> m_ObjectList;
00061     QStack<QObject*> m_ParentStack;
00062 };
00063 //end
00064 
00065 #endif        //  #ifndef DATAOBJECTREADER_H
 All Classes Namespaces Functions Enumerations