summaryrefslogtreecommitdiffstats
path: root/addon/doxmlparser/src
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2001-12-29 18:30:48 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2001-12-29 18:30:48 (GMT)
commitad53b7bebd3042598e5a11b1f3ef29468815138b (patch)
tree048517043e4c90dcc686bc038b480825fe32886c /addon/doxmlparser/src
parent7e4d434c3650bb9f7e5f460b1dbf6fed8be04a5f (diff)
downloadDoxygen-ad53b7bebd3042598e5a11b1f3ef29468815138b.zip
Doxygen-ad53b7bebd3042598e5a11b1f3ef29468815138b.tar.gz
Doxygen-ad53b7bebd3042598e5a11b1f3ef29468815138b.tar.bz2
Release-1.2.13
Diffstat (limited to 'addon/doxmlparser/src')
-rw-r--r--addon/doxmlparser/src/Makefile.in13
-rw-r--r--addon/doxmlparser/src/basehandler.h282
-rw-r--r--addon/doxmlparser/src/baseiterator.h35
-rw-r--r--addon/doxmlparser/src/compoundhandler.cpp148
-rw-r--r--addon/doxmlparser/src/compoundhandler.h101
-rw-r--r--addon/doxmlparser/src/dochandler.cpp1479
-rw-r--r--addon/doxmlparser/src/dochandler.h859
-rw-r--r--addon/doxmlparser/src/doxmlintf.h422
-rw-r--r--addon/doxmlparser/src/doxmlparser.pro.in23
-rw-r--r--addon/doxmlparser/src/linkedtexthandler.cpp107
-rw-r--r--addon/doxmlparser/src/linkedtexthandler.h46
-rw-r--r--addon/doxmlparser/src/mainhandler.cpp126
-rw-r--r--addon/doxmlparser/src/mainhandler.h68
-rw-r--r--addon/doxmlparser/src/memberhandler.cpp299
-rw-r--r--addon/doxmlparser/src/memberhandler.h193
-rw-r--r--addon/doxmlparser/src/paramhandler.cpp98
-rw-r--r--addon/doxmlparser/src/paramhandler.h71
-rw-r--r--addon/doxmlparser/src/sectionhandler.cpp61
-rw-r--r--addon/doxmlparser/src/sectionhandler.h62
19 files changed, 4493 insertions, 0 deletions
diff --git a/addon/doxmlparser/src/Makefile.in b/addon/doxmlparser/src/Makefile.in
new file mode 100644
index 0000000..049f969
--- /dev/null
+++ b/addon/doxmlparser/src/Makefile.in
@@ -0,0 +1,13 @@
+all clean depend: Makefile.doxmlparser
+ $(MAKE) -f Makefile.doxmlparser $@
+
+distclean: clean
+ $(RM) -rf Makefile.doxmlparser doxmlparser.pro Makefile obj
+
+tmake:
+ $(ENV) $(PERL) $(TMAKE) doxmlparser.pro >Makefile.doxmlparser
+
+Makefile.doxmlparser: doxmlparser.pro
+ $(ENV) $(PERL) $(TMAKE) doxmlparser.pro >Makefile.doxmlparser
+
+install:
diff --git a/addon/doxmlparser/src/basehandler.h b/addon/doxmlparser/src/basehandler.h
new file mode 100644
index 0000000..d62cf74
--- /dev/null
+++ b/addon/doxmlparser/src/basehandler.h
@@ -0,0 +1,282 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#ifndef _BASEHANDLER_H
+#define _BASEHANDLER_H
+
+#include <qxml.h>
+#include <qdict.h>
+#include <qstring.h>
+
+class IBaseHandler
+{
+ public:
+ virtual void setDelegate(QXmlDefaultHandler *delegate) = 0;
+ virtual QXmlDefaultHandler *delegate() const = 0;
+};
+
+class IFallBackHandler
+{
+ public:
+ virtual bool handleStartElement(const QString & name,
+ const QXmlAttributes & attrib) = 0;
+ virtual bool handleEndElement(const QString &name) = 0;
+};
+
+template<class T> class ElementMapper
+{
+ class StartElementHandler
+ {
+ typedef void (T::*Handler)(const QXmlAttributes &attrib);
+ public:
+ StartElementHandler() : m_parent(0) {}
+ StartElementHandler(T *parent, Handler h)
+ : m_parent(parent), m_handler(h) {}
+ void operator()(const QXmlAttributes &attrib)
+ { if (m_parent) (m_parent->*m_handler)(attrib); }
+ private:
+ T *m_parent;
+ Handler m_handler;
+ };
+
+ class EndElementHandler
+ {
+ typedef void (T::*Handler)();
+ public:
+ EndElementHandler() : m_parent(0) {}
+ EndElementHandler(T *parent, Handler h)
+ : m_parent(parent), m_handler(h) {}
+ void operator()()
+ { if (m_parent) (m_parent->*m_handler)(); }
+ private:
+ T *m_parent;
+ Handler m_handler;
+ };
+
+ typedef StartElementHandler<T> StartElementHandlerT;
+ typedef EndElementHandler<T> EndElementHandlerT;
+
+ public:
+ ElementMapper() : m_startHandlers(67), m_endHandlers(67)
+ {
+ m_startHandlers.setAutoDelete(TRUE);
+ m_endHandlers.setAutoDelete(TRUE);
+ }
+ virtual ~ElementMapper()
+ {
+ }
+
+ void addStartHandler(const char *key)
+ {
+ m_startHandlers.insert(key,new StartElementHandlerT);
+ }
+
+ void addStartHandler(const char *key, T *obj, void (T::*handler)(const QXmlAttributes &))
+ {
+ m_startHandlers.insert(key,new StartElementHandlerT(obj,handler));
+ }
+
+ void addEndHandler(const char *key)
+ {
+ m_endHandlers.insert(key,new EndElementHandlerT);
+ }
+
+ void addEndHandler(const char *key, T *obj, void (T::*handler)())
+ {
+ m_endHandlers.insert(key,new EndElementHandlerT(obj,handler));
+ }
+
+
+ protected:
+ QDict<StartElementHandlerT> m_startHandlers;
+ QDict<EndElementHandlerT> m_endHandlers;
+};
+
+template<class T> class BaseHandler : public IBaseHandler,
+ public QXmlDefaultHandler,
+ public ElementMapper<T>
+{
+ public:
+ BaseHandler() : m_delegateHandler(0), m_fallBackHandler(0)
+ {
+ }
+
+ virtual ~BaseHandler()
+ {
+ ASSERT(m_delegateHandler==0);
+ }
+
+ virtual bool startDocument()
+ {
+ return TRUE;
+ }
+
+ virtual bool startElement( const QString & namespaceURI,
+ const QString & localName,
+ const QString & name,
+ const QXmlAttributes & attrib
+ )
+ {
+ if (m_delegateHandler)
+ {
+ return m_delegateHandler->startElement(namespaceURI,localName,name,attrib);
+ }
+ if (!m_skipUntil.isEmpty()) // skip mode
+ {
+ if (m_skipUntil==name) m_skipCount++;
+ printf("skipping start tag %s count=%d\n",name.data(),m_skipCount);
+ return TRUE;
+ }
+
+ StartElementHandlerT *handler = m_startHandlers[name];
+ if (handler)
+ {
+ (*handler)(attrib);
+ //printf("found start tag %s\n",name.data());
+ }
+ else if (!m_fallBackHandler ||
+ !m_fallBackHandler->handleStartElement(name,attrib)
+ )
+ {
+ printf("found unexpected tag `%s', skipping until matching end tag\n",name.data());
+ m_skipUntil = name;
+ m_skipCount=1;
+ }
+ return TRUE;
+ }
+
+ virtual bool endElement( const QString& namespaceURI, const QString& localName, const QString& name )
+ {
+ if (m_delegateHandler)
+ {
+ return m_delegateHandler->endElement(namespaceURI,localName,name);
+ }
+
+ if (name==m_skipUntil)
+ {
+ m_skipCount--;
+ printf("skipping end tag %s count=%d\n",name.data(),m_skipCount);
+ if (m_skipCount==0)
+ {
+ m_skipUntil="";
+ }
+ //printf("found end tag %s\n",name.data());
+ }
+ else if (m_skipUntil.isEmpty())
+ {
+ EndElementHandlerT *handler = m_endHandlers[name];
+ if (handler)
+ {
+ (*handler)();
+ //printf("found end tag %s\n",name.data());
+ }
+ else if (m_fallBackHandler)
+ {
+ m_fallBackHandler->handleEndElement(name);
+ }
+ }
+ m_curString="";
+ return TRUE;
+ }
+
+ bool skippedEntity ( const QString &s )
+ {
+ if (m_delegateHandler)
+ {
+ return m_delegateHandler->skippedEntity(s);
+ }
+
+ printf("Skipped unhandled entity %s\n",s.data());
+ return TRUE;
+ }
+
+ /*! called when a number of characters are received by the parser.
+ * \param ch the characters.
+ */
+ virtual bool characters ( const QString & ch )
+ {
+ if (m_delegateHandler)
+ {
+ return m_delegateHandler->characters(ch);
+ }
+
+ //printf("Found characters \"%s\"\n",ch.data());
+ m_curString+=ch;
+ return TRUE;
+ }
+
+ void setDelegate(QXmlDefaultHandler *delegate)
+ {
+ m_delegateHandler = delegate;
+ }
+
+ QXmlDefaultHandler *delegate() const
+ {
+ return m_delegateHandler;
+ }
+
+ void setFallBackHandler(IFallBackHandler *h)
+ {
+ m_fallBackHandler = h;
+ }
+
+ IFallBackHandler *fallBackHandler() const
+ {
+ return m_fallBackHandler;
+ }
+
+ protected:
+ QString m_curString;
+ QString m_skipUntil;
+ int m_skipCount;
+ QXmlDefaultHandler *m_delegateHandler;
+ IFallBackHandler *m_fallBackHandler;
+};
+
+template<class T> class BaseFallBackHandler : public ElementMapper<T>,
+ public IFallBackHandler
+{
+ public:
+ BaseFallBackHandler()
+ {
+ }
+ virtual ~BaseFallBackHandler()
+ {
+ }
+ bool handleStartElement(const QString & name,
+ const QXmlAttributes & attrib)
+ {
+ StartElementHandlerT *handler = m_startHandlers[name];
+ if (handler)
+ {
+ (*handler)(attrib);
+ return TRUE;
+ }
+ return FALSE;
+ }
+ bool handleEndElement(const QString &name)
+ {
+ EndElementHandlerT *handler = m_endHandlers[name];
+ if (handler)
+ {
+ (*handler)();
+ return TRUE;
+ }
+ return FALSE;
+ }
+};
+
+
+#endif
diff --git a/addon/doxmlparser/src/baseiterator.h b/addon/doxmlparser/src/baseiterator.h
new file mode 100644
index 0000000..52a4c4e
--- /dev/null
+++ b/addon/doxmlparser/src/baseiterator.h
@@ -0,0 +1,35 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+#ifndef BASEITERATOR_H
+#define BASEITERATOR_H
+
+#include <qlist.h>
+#include <doxmlintf.h>
+
+template<class Intf,class ElemIntf,class ElemImpl> class BaseIterator :
+ public Intf, public QListIterator<ElemImpl>
+{
+ public:
+ BaseIterator(const QList<ElemImpl> &list) : QListIterator<ElemImpl>(list) {}
+ virtual ~BaseIterator() {}
+ virtual ElemIntf *toFirst() { return QListIterator<ElemImpl>::toFirst(); }
+ virtual ElemIntf *toLast() { return QListIterator<ElemImpl>::toLast(); }
+ virtual ElemIntf *toNext() { return QListIterator<ElemImpl>::operator++(); }
+ virtual ElemIntf *toPrev() { return QListIterator<ElemImpl>::operator--(); }
+ virtual ElemIntf *current() const { return QListIterator<ElemImpl>::current(); }
+ virtual void release() { delete this; }
+};
+
+#endif
diff --git a/addon/doxmlparser/src/compoundhandler.cpp b/addon/doxmlparser/src/compoundhandler.cpp
new file mode 100644
index 0000000..0b420bf
--- /dev/null
+++ b/addon/doxmlparser/src/compoundhandler.cpp
@@ -0,0 +1,148 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#include "mainhandler.h"
+#include "compoundhandler.h"
+#include "dochandler.h"
+
+CompoundHandler::CompoundHandler(IBaseHandler *parent)
+ : m_parent(parent), m_brief(0), m_detailed(0), m_programListing(0)
+{
+ m_superClasses.setAutoDelete(TRUE);
+ m_subClasses.setAutoDelete(TRUE);
+ m_sections.setAutoDelete(TRUE);
+
+ addEndHandler("compounddef",this,&CompoundHandler::endCompound);
+
+ addStartHandler("compoundname");
+ addEndHandler("compoundname",this,&CompoundHandler::endCompoundName);
+
+ addStartHandler("derivedcompoundref",this,&CompoundHandler::addSubClass);
+ addEndHandler("derivedcompoundref");
+
+ addStartHandler("basecompoundref",this,&CompoundHandler::addSuperClass);
+ addEndHandler("basecompoundref");
+
+ addStartHandler("briefdescription",this,&CompoundHandler::startBriefDesc);
+
+ addStartHandler("detaileddescription",this,&CompoundHandler::startDetailedDesc);
+
+ addStartHandler("sectiondef",this,&CompoundHandler::startSection);
+
+ addStartHandler("location",this,&CompoundHandler::startLocation);
+ addEndHandler("location");
+
+ addStartHandler("programlisting",this,&CompoundHandler::startProgramListing);
+}
+
+CompoundHandler::~CompoundHandler()
+{
+ delete m_brief;
+ delete m_detailed;
+ delete m_programListing;
+}
+
+void CompoundHandler::startSection(const QXmlAttributes& attrib)
+{
+ SectionHandler *sectHandler = new SectionHandler(this);
+ sectHandler->startSection(attrib);
+ m_sections.append(sectHandler);
+}
+
+void CompoundHandler::startBriefDesc(const QXmlAttributes& attrib)
+{
+ DocHandler *docHandler = new DocHandler(this);
+ docHandler->startDoc(attrib);
+ m_brief = docHandler;
+}
+
+void CompoundHandler::startDetailedDesc(const QXmlAttributes& attrib)
+{
+ DocHandler *docHandler = new DocHandler(this);
+ docHandler->startDoc(attrib);
+ m_detailed = docHandler;
+}
+
+void CompoundHandler::startProgramListing(const QXmlAttributes& attrib)
+{
+ ProgramListingHandler *plHandler = new ProgramListingHandler(this);
+ plHandler->startProgramListing(attrib);
+ m_programListing = plHandler;
+}
+
+void CompoundHandler::startCompound(const QXmlAttributes& attrib)
+{
+ m_parent->setDelegate(this);
+ m_id = attrib.value("id");
+ m_kind = attrib.value("kind");
+ printf("startCompound(id=`%s' type=`%s')\n",m_id.data(),m_kind.data());
+}
+
+void CompoundHandler::startLocation(const QXmlAttributes& attrib)
+{
+ m_defFile = attrib.value("file");
+ m_defLine = attrib.value("line").toInt();
+}
+
+void CompoundHandler::endCompound()
+{
+ printf("endCompound()\n");
+ m_parent->setDelegate(0);
+}
+
+void CompoundHandler::endCompoundName()
+{
+ m_name = m_curString.stripWhiteSpace();
+ printf("Compound name `%s'\n",m_name.data());
+}
+
+void CompoundHandler::addSuperClass(const QXmlAttributes& attrib)
+{
+ SuperClass *sc=new SuperClass(
+ attrib.value("idref"),
+ attrib.value("prot"),
+ attrib.value("virt")
+ );
+ printf("super class id=`%s' prot=`%s' virt=`%s'\n",
+ sc->m_id.data(),
+ sc->m_protection.data(),
+ sc->m_virtualness.data());
+ m_superClasses.append(sc);
+}
+
+void CompoundHandler::addSubClass(const QXmlAttributes& attrib)
+{
+ SubClass *sc = new SubClass(
+ attrib.value("idref"),
+ attrib.value("prot"),
+ attrib.value("virt")
+ );
+ printf("sub class id=`%s' prot=`%s' virt=`%s'\n",
+ sc->m_id.data(),
+ sc->m_protection.data(),
+ sc->m_virtualness.data());
+ m_subClasses.append(sc);
+}
+
+void CompoundHandler::initialize(MainHandler *m)
+{
+ QListIterator<ISection> msi(m_sections);
+ SectionHandler *sec;
+ for (;(sec=(SectionHandler *)msi.current());++msi)
+ {
+ sec->initialize(m);
+ }
+}
+
diff --git a/addon/doxmlparser/src/compoundhandler.h b/addon/doxmlparser/src/compoundhandler.h
new file mode 100644
index 0000000..99db5d8
--- /dev/null
+++ b/addon/doxmlparser/src/compoundhandler.h
@@ -0,0 +1,101 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+#ifndef _COMPOUNDHANDLER_H
+#define _COMPOUNDHANDLER_H
+
+#include <qstring.h>
+#include <qlist.h>
+#include <qxml.h>
+#include <doxmlintf.h>
+
+#include "basehandler.h"
+#include "baseiterator.h"
+#include "sectionhandler.h"
+
+class MainHandler;
+class DocHandler;
+class ProgramListingHandler;
+
+class CompoundIterator : public BaseIterator<ICompoundIterator,ICompound,ICompound>
+{
+ public:
+ CompoundIterator(const QList<ICompound> &list) :
+ BaseIterator<ICompoundIterator,ICompound,ICompound>(list) {}
+};
+
+class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler>
+{
+ public:
+ virtual void startSection(const QXmlAttributes& attrib);
+ virtual void startCompound(const QXmlAttributes& attrib);
+ virtual void addSuperClass(const QXmlAttributes& attrib);
+ virtual void addSubClass(const QXmlAttributes& attrib);
+ virtual void endCompound();
+ virtual void endCompoundName();
+ virtual void startBriefDesc(const QXmlAttributes& attrib);
+ virtual void startDetailedDesc(const QXmlAttributes& attrib);
+ virtual void startLocation(const QXmlAttributes& attrib);
+ virtual void startProgramListing(const QXmlAttributes& attrib);
+
+ CompoundHandler(IBaseHandler *parent);
+ virtual ~CompoundHandler();
+ void initialize(MainHandler *m);
+
+ // ICompound implementation
+ QString name() const { return m_name; }
+ QString id() const { return m_id; }
+ QString kind() const { return m_kind; }
+ ISectionIterator *sections() const
+ { return new SectionIterator(m_sections); }
+ virtual IDocRoot *briefDescription() const
+ { return m_brief; }
+ virtual IDocRoot *detailedDescription() const
+ { return m_detailed; }
+
+
+ private:
+ struct SuperClass
+ {
+ SuperClass(const QString &id,const QString &prot,const QString &virt) :
+ m_id(id),m_protection(prot),m_virtualness(virt) {}
+
+ QString m_id;
+ QString m_protection;
+ QString m_virtualness;
+ };
+ struct SubClass
+ {
+ SubClass(const QString &id,const QString &prot,const QString &virt) :
+ m_id(id),m_protection(prot),m_virtualness(virt) {}
+
+ QString m_id;
+ QString m_protection;
+ QString m_virtualness;
+ };
+ QList<SuperClass> m_superClasses;
+ QList<SubClass> m_subClasses;
+ QList<ISection> m_sections;
+ IBaseHandler *m_parent;
+ DocHandler *m_brief;
+ DocHandler *m_detailed;
+ ProgramListingHandler *m_programListing;
+ QString m_id;
+ QString m_kind;
+ QString m_name;
+ QString m_defFile;
+ int m_defLine;
+};
+
+#endif
diff --git a/addon/doxmlparser/src/dochandler.cpp b/addon/doxmlparser/src/dochandler.cpp
new file mode 100644
index 0000000..3350cf4
--- /dev/null
+++ b/addon/doxmlparser/src/dochandler.cpp
@@ -0,0 +1,1479 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#include "dochandler.h"
+#include <qmap.h>
+
+class TypeNameMapper
+{
+ public:
+ TypeNameMapper()
+ {
+ m_typeNameMap.insert("see", SimpleSectHandler::See);
+ m_typeNameMap.insert("return", SimpleSectHandler::Return);
+ m_typeNameMap.insert("author", SimpleSectHandler::Author);
+ m_typeNameMap.insert("version", SimpleSectHandler::Version);
+ m_typeNameMap.insert("since", SimpleSectHandler::Since);
+ m_typeNameMap.insert("date", SimpleSectHandler::Date);
+ m_typeNameMap.insert("bug", SimpleSectHandler::Bug);
+ m_typeNameMap.insert("note", SimpleSectHandler::Note);
+ m_typeNameMap.insert("warning", SimpleSectHandler::Warning);
+ m_typeNameMap.insert("par", SimpleSectHandler::Par);
+ m_typeNameMap.insert("deprecated",SimpleSectHandler::Deprecated);
+ m_typeNameMap.insert("pre", SimpleSectHandler::Pre);
+ m_typeNameMap.insert("post", SimpleSectHandler::Post);
+ m_typeNameMap.insert("invariant", SimpleSectHandler::Invar);
+ m_typeNameMap.insert("remark", SimpleSectHandler::Remark);
+ m_typeNameMap.insert("attention", SimpleSectHandler::Attention);
+ m_typeNameMap.insert("todo", SimpleSectHandler::Todo);
+ m_typeNameMap.insert("test", SimpleSectHandler::Test);
+ m_typeNameMap.insert("rcs", SimpleSectHandler::RCS);
+ m_typeNameMap.insert("enumvalues",SimpleSectHandler::EnumValues);
+ m_typeNameMap.insert("examples", SimpleSectHandler::Examples);
+ }
+ SimpleSectHandler::Types stringToType(const QString &typeStr)
+ {
+ return m_typeNameMap[typeStr];
+ }
+ private:
+ QMap<QString,SimpleSectHandler::Types> m_typeNameMap;
+};
+
+static TypeNameMapper g_typeMapper;
+
+
+//----------------------------------------------------------------------
+// MarkupHandler
+//----------------------------------------------------------------------
+
+MarkupHandler::MarkupHandler(QList<IDoc> &children,QString &curString)
+ : m_children(children), m_curString(curString), m_curMarkup(IDocMarkup::Normal)
+{
+ addStartHandler("bold",this,&MarkupHandler::startBold);
+ addEndHandler("bold",this,&MarkupHandler::endBold);
+
+ addStartHandler("emphasis",this,&MarkupHandler::startEmphasis);
+ addEndHandler("emphasis",this,&MarkupHandler::endEmphasis);
+
+ addStartHandler("computeroutput",this,&MarkupHandler::startComputerOutput);
+ addEndHandler("computeroutput",this,&MarkupHandler::endComputerOutput);
+
+ addStartHandler("center",this,&MarkupHandler::startCenter);
+ addEndHandler("center",this,&MarkupHandler::endCenter);
+
+ addStartHandler("small",this,&MarkupHandler::startSmallFont);
+ addEndHandler("small",this,&MarkupHandler::endSmallFont);
+
+ addStartHandler("subscript",this,&MarkupHandler::startSubscript);
+ addEndHandler("subscript",this,&MarkupHandler::endSubscript);
+
+ addStartHandler("superscript",this,&MarkupHandler::startSuperscript);
+ addEndHandler("superscript",this,&MarkupHandler::endSuperscript);
+}
+
+MarkupHandler::~MarkupHandler()
+{
+}
+
+void MarkupHandler::addTextNode()
+{
+ if (!m_curString.isEmpty())
+ {
+ m_children.append(new TextNode(m_curString,m_curMarkup));
+ printf("addTextNode() text=%s markup=%x\n",m_curString.data(),m_curMarkup);
+ m_curString="";
+ }
+}
+
+void MarkupHandler::startBold(const QXmlAttributes & /*attrib*/)
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::Bold,TRUE));
+ m_curMarkup |= IDocMarkup::Bold;
+}
+
+void MarkupHandler::endBold()
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::Bold,FALSE));
+ m_curMarkup &= ~IDocMarkup::Bold;
+}
+
+void MarkupHandler::startEmphasis(const QXmlAttributes & /*attrib*/)
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::Emphasis,TRUE));
+ m_curMarkup |= IDocMarkup::Emphasis;
+}
+
+void MarkupHandler::endEmphasis()
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::Emphasis,FALSE));
+ m_curMarkup &= ~IDocMarkup::Emphasis;
+}
+
+void MarkupHandler::startComputerOutput(const QXmlAttributes & /*attrib*/)
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::ComputerOutput,TRUE));
+ m_curMarkup |= IDocMarkup::ComputerOutput;
+}
+
+void MarkupHandler::endComputerOutput()
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::ComputerOutput,FALSE));
+ m_curMarkup &= ~IDocMarkup::ComputerOutput;
+}
+
+void MarkupHandler::startCenter(const QXmlAttributes & /*attrib*/)
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::Center,TRUE));
+ m_curMarkup |= IDocMarkup::Center;
+}
+
+void MarkupHandler::endCenter()
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::Center,FALSE));
+ m_curMarkup &= ~IDocMarkup::Center;
+}
+
+void MarkupHandler::startSmallFont(const QXmlAttributes & /*attrib*/)
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::SmallFont,TRUE));
+ m_curMarkup |= IDocMarkup::SmallFont;
+}
+
+void MarkupHandler::endSmallFont()
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::SmallFont,FALSE));
+ m_curMarkup &= ~IDocMarkup::SmallFont;
+}
+
+void MarkupHandler::startSubscript(const QXmlAttributes & /*attrib*/)
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::Subscript,TRUE));
+ m_curMarkup |= IDocMarkup::Subscript;
+}
+
+void MarkupHandler::endSubscript()
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::Subscript,FALSE));
+ m_curMarkup &= ~IDocMarkup::Subscript;
+}
+
+void MarkupHandler::startSuperscript(const QXmlAttributes & /*attrib*/)
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::Superscript,TRUE));
+ m_curMarkup |= IDocMarkup::Superscript;
+}
+
+void MarkupHandler::endSuperscript()
+{
+ addTextNode();
+ m_children.append(new MarkupModifierNode(IDocMarkup::Superscript,FALSE));
+ m_curMarkup &= ~IDocMarkup::Superscript;
+}
+
+//----------------------------------------------------------------------
+// ListItemHandler
+//----------------------------------------------------------------------
+
+ListItemHandler::ListItemHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ m_children.setAutoDelete(TRUE);
+
+ addEndHandler("listitem",this,&ListItemHandler::endListItem);
+
+ addStartHandler("para",this,&ListItemHandler::startParagraph);
+}
+
+ListItemHandler::~ListItemHandler()
+{
+}
+
+void ListItemHandler::startListItem(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("start list item handler\n");
+}
+
+void ListItemHandler::endListItem()
+{
+ printf("end list item handler\n");
+ m_parent->setDelegate(0);
+}
+
+void ListItemHandler::startParagraph(const QXmlAttributes& attrib)
+{
+ ParagraphHandler *parHandler = new ParagraphHandler(this);
+ parHandler->startParagraph(attrib);
+ m_children.append(parHandler);
+}
+
+//----------------------------------------------------------------------
+// ListHandler
+//----------------------------------------------------------------------
+
+ListHandler::ListHandler(Kind k,IBaseHandler *parent)
+ : m_parent(parent), m_kind(k)
+{
+ m_children.setAutoDelete(TRUE);
+ const char *endListName=0;
+ switch(k)
+ {
+ case ItemizedList : endListName="itemizedlist"; break;
+ case OrderedList : endListName="orderedlist"; break;
+ default: ASSERT(0);
+ }
+ addEndHandler(endListName,this,&ListHandler::endList);
+
+ addStartHandler("listitem",this,&ListHandler::startListItem);
+}
+
+ListHandler::~ListHandler()
+{
+}
+
+void ListHandler::startList(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+}
+
+void ListHandler::endList()
+{
+ m_parent->setDelegate(0);
+}
+
+void ListHandler::startListItem(const QXmlAttributes& attrib)
+{
+ ListItemHandler *liHandler = new ListItemHandler(this);
+ liHandler->startListItem(attrib);
+ m_children.append(liHandler);
+}
+
+//----------------------------------------------------------------------
+// ParameterHandler
+//----------------------------------------------------------------------
+
+ParameterHandler::ParameterHandler(IBaseHandler *parent) :
+ m_parent(parent), m_description(0)
+{
+ addEndHandler("parametername",this,&ParameterHandler::endParameterName);
+ addEndHandler("parameterdescription",this,&ParameterHandler::endParameterDescription);
+ addStartHandler("para",this,&ParameterHandler::startParagraph);
+}
+
+ParameterHandler::~ParameterHandler()
+{
+ delete m_description;
+}
+
+void ParameterHandler::startParameterName(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+}
+
+void ParameterHandler::endParameterName()
+{
+ m_name = m_curString;
+ printf("parameter %s\n",m_name.data());
+ m_curString="";
+ m_parent->setDelegate(0);
+}
+
+void ParameterHandler::startParameterDescription(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+}
+
+void ParameterHandler::endParameterDescription()
+{
+ m_parent->setDelegate(0);
+}
+
+void ParameterHandler::startParagraph(const QXmlAttributes& attrib)
+{
+ ASSERT(m_description==0);
+ m_description = new ParagraphHandler(this);
+ m_description->startParagraph(attrib);
+}
+
+//----------------------------------------------------------------------
+// ParameterListHandler
+//----------------------------------------------------------------------
+
+ParameterListHandler::ParameterListHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ addEndHandler("parameterlist",this,&ParameterListHandler::endParameterList);
+ addStartHandler("parametername",this,&ParameterListHandler::startParameterName);
+ addStartHandler("parameterdescription",this,&ParameterListHandler::startParameterDescription);
+ addStartHandler("title");
+ addEndHandler("title");
+ m_parameters.setAutoDelete(TRUE);
+ m_curParam=0;
+}
+
+ParameterListHandler::~ParameterListHandler()
+{
+}
+
+void ParameterListHandler::startParameterList(const QXmlAttributes& attrib)
+{
+ QString kind = attrib.value("kind");
+ if (kind=="retval") m_type=RetVal;
+ else if (kind=="exception") m_type=Exception;
+ else if (kind=="param") m_type=Param;
+ else
+ {
+ printf("Error: invalid parameterlist type: %s\n",kind.data());
+ }
+ printf("parameterlist kind=%s\n",kind.data());
+ m_parent->setDelegate(this);
+}
+
+void ParameterListHandler::endParameterList()
+{
+ m_parent->setDelegate(0);
+}
+
+void ParameterListHandler::startParameterName(const QXmlAttributes& attrib)
+{
+ m_curParam = new ParameterHandler(this);
+ m_parameters.append(m_curParam);
+ m_curParam->startParameterName(attrib);
+}
+
+void ParameterListHandler::startParameterDescription(const QXmlAttributes& attrib)
+{
+ ASSERT(m_curParam!=0);
+ m_curParam->startParameterDescription(attrib);
+}
+
+//----------------------------------------------------------------------
+// LinkHandler
+//----------------------------------------------------------------------
+
+LinkHandler::LinkHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ addEndHandler("link",this,&LinkHandler::endLink);
+}
+
+LinkHandler::~LinkHandler()
+{
+}
+
+void LinkHandler::startLink(const QXmlAttributes& attrib)
+{
+ m_parent->setDelegate(this);
+ printf("Start link\n");
+ m_ref = attrib.value("linkend");
+ m_curString="";
+}
+
+void LinkHandler::endLink()
+{
+ m_text = m_curString;
+ m_curString="";
+ m_parent->setDelegate(0);
+ printf("End link\n");
+}
+
+//----------------------------------------------------------------------
+// EMailHandler
+//----------------------------------------------------------------------
+
+EMailHandler::EMailHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ addEndHandler("email",this,&EMailHandler::endEMail);
+}
+
+EMailHandler::~EMailHandler()
+{
+}
+
+void EMailHandler::startEMail(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("Start email\n");
+ m_curString="";
+}
+
+void EMailHandler::endEMail()
+{
+ m_address = m_curString;
+ m_curString="";
+ m_parent->setDelegate(0);
+ printf("End email\n");
+}
+
+//----------------------------------------------------------------------
+// ULinkHandler
+//----------------------------------------------------------------------
+
+ULinkHandler::ULinkHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ addEndHandler("ulink",this,&ULinkHandler::endULink);
+}
+
+ULinkHandler::~ULinkHandler()
+{
+}
+
+void ULinkHandler::startULink(const QXmlAttributes& attrib)
+{
+ m_parent->setDelegate(this);
+ printf("Start ulink\n");
+ m_url = attrib.value("url");
+ m_curString="";
+}
+
+void ULinkHandler::endULink()
+{
+ m_text = m_curString;
+ m_curString="";
+ m_parent->setDelegate(0);
+ printf("End ulink\n");
+}
+
+//----------------------------------------------------------------------
+// LineBreakHandler
+//----------------------------------------------------------------------
+
+LineBreakHandler::LineBreakHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ addEndHandler("linebreak",this,&LineBreakHandler::endLineBreak);
+}
+
+LineBreakHandler::~LineBreakHandler()
+{
+}
+
+void LineBreakHandler::startLineBreak(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("Start linebreak\n");
+}
+
+void LineBreakHandler::endLineBreak()
+{
+ m_parent->setDelegate(0);
+ printf("End linebreak\n");
+}
+
+//----------------------------------------------------------------------
+// HRulerHandler
+//----------------------------------------------------------------------
+
+HRulerHandler::HRulerHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ addEndHandler("hruler",this,&HRulerHandler::endHRuler);
+}
+
+HRulerHandler::~HRulerHandler()
+{
+}
+
+void HRulerHandler::startHRuler(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("Start hruler\n");
+}
+
+void HRulerHandler::endHRuler()
+{
+ m_parent->setDelegate(0);
+ printf("End hruler\n");
+}
+
+//----------------------------------------------------------------------
+// RefHandler
+//----------------------------------------------------------------------
+
+RefHandler::RefHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ addEndHandler("ref",this,&RefHandler::endRef);
+}
+
+RefHandler::~RefHandler()
+{
+}
+
+void RefHandler::startRef(const QXmlAttributes& attrib)
+{
+ m_parent->setDelegate(this);
+ m_refId = attrib.value("idref");
+ m_anchor = attrib.value("anchor");
+ printf("Start ref refId=%s anchor=%s\n",m_refId.data(),m_anchor.data());
+ m_curString="";
+}
+
+void RefHandler::endRef()
+{
+ m_linkText = m_curString;
+ m_parent->setDelegate(0);
+ printf("End ref: text=`%s'\n",m_linkText.data());
+}
+
+
+//----------------------------------------------------------------------
+// TitleHandler
+//----------------------------------------------------------------------
+
+TitleHandler::TitleHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ m_children.setAutoDelete(TRUE);
+ m_markupHandler = new MarkupHandler(m_children,m_curString);
+ setFallBackHandler(m_markupHandler);
+ addStartHandler("ref",this,&TitleHandler::startRef);
+ addEndHandler("title",this,&TitleHandler::endTitle);
+}
+
+TitleHandler::~TitleHandler()
+{
+ delete m_markupHandler;
+}
+
+void TitleHandler::startTitle(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("Start title\n");
+ m_curString="";
+}
+
+void TitleHandler::endTitle()
+{
+ addTextNode();
+ m_parent->setDelegate(0);
+ printf("End title\n");
+}
+
+void TitleHandler::addTextNode()
+{
+ if (!m_curString.isEmpty())
+ {
+ m_children.append(new TextNode(m_curString,m_markupHandler->markup()));
+ printf("addTextNode() text=\"%s\" markup=%x\n",
+ m_curString.data(),m_markupHandler->markup());
+ m_curString="";
+ }
+}
+
+void TitleHandler::startRef(const QXmlAttributes& attrib)
+{
+ RefHandler *ref = new RefHandler(this);
+ ref->startRef(attrib);
+ m_children.append(ref);
+}
+
+IDocIterator *TitleHandler::title() const
+{
+ return new TitleIterator(*this);
+}
+
+//----------------------------------------------------------------------
+// SimpleSectHandler
+//----------------------------------------------------------------------
+
+SimpleSectHandler::SimpleSectHandler(IBaseHandler *parent)
+ : m_parent(parent), m_paragraph(0), m_title(0)
+{
+ addStartHandler("title",this,&SimpleSectHandler::startTitle);
+ addStartHandler("para",this,&SimpleSectHandler::startParagraph);
+ addEndHandler("simplesect",this,&SimpleSectHandler::endSimpleSect);
+}
+
+SimpleSectHandler::~SimpleSectHandler()
+{
+}
+
+void SimpleSectHandler::startSimpleSect(const QXmlAttributes& attrib)
+{
+ m_type = g_typeMapper.stringToType(attrib.value("kind"));
+ printf("start simple section %s\n",attrib.value("kind").data());
+ m_parent->setDelegate(this);
+}
+
+void SimpleSectHandler::endSimpleSect()
+{
+ printf("end simple section\n");
+ m_parent->setDelegate(0);
+}
+
+void SimpleSectHandler::startTitle(const QXmlAttributes& attrib)
+{
+ ASSERT(m_title==0);
+ m_title = new TitleHandler(this);
+ m_title->startTitle(attrib);
+}
+
+void SimpleSectHandler::startParagraph(const QXmlAttributes& attrib)
+{
+ ASSERT(m_paragraph==0);
+ m_paragraph = new ParagraphHandler(this);
+ m_paragraph->startParagraph(attrib);
+}
+
+//----------------------------------------------------------------------
+// VariableListEntryHandler
+//----------------------------------------------------------------------
+
+VariableListEntryHandler::VariableListEntryHandler(IBaseHandler *parent)
+ : m_parent(parent), m_description(0)
+{
+ addStartHandler("term",this,&VariableListEntryHandler::startTerm);
+ addEndHandler("term",this,&VariableListEntryHandler::endTerm);
+ addStartHandler("para",this,&VariableListEntryHandler::startParagraph);
+ addEndHandler("varlistentry",this,&VariableListEntryHandler::endVarListEntry);
+ addEndHandler("listitem",this,&VariableListEntryHandler::endListItem);
+}
+
+VariableListEntryHandler::~VariableListEntryHandler()
+{
+ delete m_description;
+}
+
+void VariableListEntryHandler::startVarListEntry(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("start varlistentry\n");
+}
+
+void VariableListEntryHandler::endVarListEntry()
+{
+ m_parent->setDelegate(0);
+ printf("end varlistentry\n");
+}
+
+void VariableListEntryHandler::startListItem(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("start listitem\n");
+}
+
+void VariableListEntryHandler::endListItem()
+{
+ m_parent->setDelegate(0);
+ printf("end listitem\n");
+}
+
+void VariableListEntryHandler::startTerm(const QXmlAttributes& /*attrib*/)
+{
+ m_curString="";
+}
+
+void VariableListEntryHandler::endTerm()
+{
+ m_term = m_curString;
+ printf("term=%s\n",m_term.data());
+}
+
+void VariableListEntryHandler::startParagraph(const QXmlAttributes& attrib)
+{
+ ASSERT(m_description==0);
+ m_description = new ParagraphHandler(this);
+ m_description->startParagraph(attrib);
+}
+
+
+
+//----------------------------------------------------------------------
+// VariableListHandler
+//----------------------------------------------------------------------
+
+VariableListHandler::VariableListHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ m_entries.setAutoDelete(TRUE);
+ addStartHandler("varlistentry",this,&VariableListHandler::startVarListEntry);
+ addStartHandler("listitem",this,&VariableListHandler::startListItem);
+ addEndHandler("variablelist",this,&VariableListHandler::endVariableList);
+}
+
+VariableListHandler::~VariableListHandler()
+{
+}
+
+void VariableListHandler::startVariableList(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("start variablelist\n");
+}
+
+void VariableListHandler::endVariableList()
+{
+ printf("end variablelist\n");
+ m_parent->setDelegate(0);
+}
+
+void VariableListHandler::startVarListEntry(const QXmlAttributes& attrib)
+{
+ VariableListEntryHandler *vle = new VariableListEntryHandler(this);
+ vle->startVarListEntry(attrib);
+ m_curEntry = vle;
+ m_entries.append(vle);
+}
+
+void VariableListHandler::startListItem(const QXmlAttributes& attrib)
+{
+ ASSERT(m_curEntry!=0);
+ m_curEntry->startListItem(attrib);
+}
+
+//----------------------------------------------------------------------
+// HighlightHandler
+//----------------------------------------------------------------------
+
+HighlightHandler::HighlightHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ addEndHandler("highlight",this,&HighlightHandler::endHighlight);
+}
+
+HighlightHandler::~HighlightHandler()
+{
+}
+
+void HighlightHandler::startHighlight(const QXmlAttributes& attrib)
+{
+ m_class = attrib.value("class");
+ m_curString="";
+ m_parent->setDelegate(this);
+}
+
+void HighlightHandler::endHighlight()
+{
+ m_text = m_curString;
+ printf("highlight class=`%s' text=`%s'\n",m_class.data(),m_text.data());
+ m_parent->setDelegate(0);
+}
+
+//----------------------------------------------------------------------
+// CodeLineHandler
+//----------------------------------------------------------------------
+
+CodeLineHandler::CodeLineHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ m_children.setAutoDelete(TRUE);
+ addEndHandler("codeline",this,&CodeLineHandler::endCodeLine);
+ addEndHandler("linenumber",this,&CodeLineHandler::endLineNumber);
+ addStartHandler("highlight",this,&CodeLineHandler::startHighlight);
+ addStartHandler("ref",this,&CodeLineHandler::startRef);
+ m_lineNumber = 0;
+}
+
+CodeLineHandler::~CodeLineHandler()
+{
+}
+
+void CodeLineHandler::startCodeLine(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("start codeline\n");
+}
+
+void CodeLineHandler::endCodeLine()
+{
+ addTextNode();
+ printf("end codeline\n");
+ m_parent->setDelegate(0);
+}
+
+void CodeLineHandler::startLineNumber(const QXmlAttributes& attrib)
+{
+ m_parent->setDelegate(this);
+ printf("start linenumber\n");
+ m_lineNumber = attrib.value("line").toInt();
+ m_refId = attrib.value("refid");
+}
+
+void CodeLineHandler::endLineNumber()
+{
+ m_parent->setDelegate(0);
+}
+
+void CodeLineHandler::startHighlight(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ HighlightHandler *hlh = new HighlightHandler(this);
+ m_children.append(hlh);
+ hlh->startHighlight(attrib);
+}
+
+void CodeLineHandler::startRef(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ RefHandler *rh = new RefHandler(this);
+ m_children.append(rh);
+ rh->startRef(attrib);
+}
+
+void CodeLineHandler::addTextNode()
+{
+ if (!m_curString.isEmpty())
+ {
+ m_children.append(new TextNode(m_curString,IDocMarkup::Normal));
+ printf("addTextNode() text=\"%s\"\n",
+ m_curString.data());
+ m_curString="";
+ }
+}
+
+//----------------------------------------------------------------------
+// ProgramListingHandler
+//----------------------------------------------------------------------
+
+ProgramListingHandler::ProgramListingHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ m_children.setAutoDelete(TRUE);
+ m_hasLineNumber=FALSE;
+ addEndHandler("programlisting",this,&ProgramListingHandler::endProgramListing);
+
+ addStartHandler("linenumber",this,&ProgramListingHandler::startLineNumber);
+ addStartHandler("codeline",this,&ProgramListingHandler::startCodeLine);
+}
+
+ProgramListingHandler::~ProgramListingHandler()
+{
+}
+
+void ProgramListingHandler::startProgramListing(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("start programlisting\n");
+}
+
+void ProgramListingHandler::endProgramListing()
+{
+ printf("end programlisting\n");
+ m_parent->setDelegate(0);
+}
+
+void ProgramListingHandler::startLineNumber(const QXmlAttributes& attrib)
+{
+ CodeLineHandler *clh = new CodeLineHandler(this);
+ m_children.append(clh);
+ m_hasLineNumber=TRUE;
+ clh->startLineNumber(attrib);
+}
+
+void ProgramListingHandler::startCodeLine(const QXmlAttributes& attrib)
+{
+ CodeLineHandler *clh = 0;
+ if (!m_hasLineNumber)
+ {
+ clh = new CodeLineHandler(this);
+ m_children.append(clh);
+ }
+ else
+ {
+ clh = m_children.getLast();
+ }
+ ASSERT(clh!=0);
+ clh->startCodeLine(attrib);
+ m_hasLineNumber=FALSE;
+}
+
+//----------------------------------------------------------------------
+// FormulaHandler
+//----------------------------------------------------------------------
+
+FormulaHandler::FormulaHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ addEndHandler("formula",this,&FormulaHandler::endFormula);
+}
+
+FormulaHandler::~FormulaHandler()
+{
+}
+
+void FormulaHandler::startFormula(const QXmlAttributes& attrib)
+{
+ m_id = attrib.value("id");
+ m_curString="";
+ m_parent->setDelegate(this);
+}
+
+void FormulaHandler::endFormula()
+{
+ m_text = m_curString;
+ printf("formula id=`%s' text=`%s'\n",m_id.data(),m_text.data());
+ m_parent->setDelegate(0);
+}
+
+//----------------------------------------------------------------------
+// ImageHandler
+//----------------------------------------------------------------------
+
+ImageHandler::ImageHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ addEndHandler("image",this,&ImageHandler::endImage);
+}
+
+ImageHandler::~ImageHandler()
+{
+}
+
+void ImageHandler::startImage(const QXmlAttributes& attrib)
+{
+ m_name = attrib.value("name");
+ m_curString="";
+ m_parent->setDelegate(this);
+}
+
+void ImageHandler::endImage()
+{
+ m_caption = m_curString;
+ printf("image name=`%s' caption=`%s'\n",m_name.data(),m_caption.data());
+ m_parent->setDelegate(0);
+}
+
+//----------------------------------------------------------------------
+// DotFileHandler
+//----------------------------------------------------------------------
+
+DotFileHandler::DotFileHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ addEndHandler("image",this,&DotFileHandler::endDotFile);
+}
+
+DotFileHandler::~DotFileHandler()
+{
+}
+
+void DotFileHandler::startDotFile(const QXmlAttributes& attrib)
+{
+ m_name = attrib.value("name");
+ m_curString="";
+ m_parent->setDelegate(this);
+}
+
+void DotFileHandler::endDotFile()
+{
+ m_caption = m_curString;
+ printf("image name=`%s' caption=`%s'\n",m_name.data(),m_caption.data());
+ m_parent->setDelegate(0);
+}
+
+//----------------------------------------------------------------------
+// IndexEntryHandler
+//----------------------------------------------------------------------
+
+IndexEntryHandler::IndexEntryHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ addEndHandler("indexentry",this,&IndexEntryHandler::endIndexEntry);
+ addStartHandler("primaryie",this,&IndexEntryHandler::startPrimaryIE);
+ addEndHandler("primaryie",this,&IndexEntryHandler::endPrimaryIE);
+ addStartHandler("secondaryie",this,&IndexEntryHandler::startSecondaryIE);
+ addEndHandler("secondaryie",this,&IndexEntryHandler::endSecondaryIE);
+}
+
+IndexEntryHandler::~IndexEntryHandler()
+{
+}
+
+void IndexEntryHandler::startIndexEntry(const QXmlAttributes& /*attrib*/)
+{
+ printf("start index entry\n");
+ m_parent->setDelegate(this);
+}
+
+void IndexEntryHandler::endIndexEntry()
+{
+ printf("index entry primary=`%s' secondary=`%s'\n",
+ m_primary.data(),m_secondary.data());
+ m_parent->setDelegate(0);
+}
+
+void IndexEntryHandler::startPrimaryIE(const QXmlAttributes& /*attrib*/)
+{
+ m_curString="";
+}
+
+void IndexEntryHandler::endPrimaryIE()
+{
+ m_primary = m_curString;
+}
+
+void IndexEntryHandler::startSecondaryIE(const QXmlAttributes& /*attrib*/)
+{
+ m_curString="";
+}
+
+void IndexEntryHandler::endSecondaryIE()
+{
+ m_secondary = m_curString;
+}
+
+//----------------------------------------------------------------------
+// EntryHandler
+//----------------------------------------------------------------------
+
+EntryHandler::EntryHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ m_children.setAutoDelete(TRUE);
+ addEndHandler("entry",this,&EntryHandler::endEntry);
+ addStartHandler("para",this,&EntryHandler::startParagraph);
+}
+
+EntryHandler::~EntryHandler()
+{
+}
+
+void EntryHandler::startEntry(const QXmlAttributes&)
+{
+ m_parent->setDelegate(this);
+}
+
+void EntryHandler::endEntry()
+{
+ m_parent->setDelegate(0);
+}
+
+void EntryHandler::startParagraph(const QXmlAttributes& attrib)
+{
+ ParagraphHandler *ph = new ParagraphHandler(this);
+ ph->startParagraph(attrib);
+ m_children.append(ph);
+}
+
+//----------------------------------------------------------------------
+// RowHandler
+//----------------------------------------------------------------------
+
+RowHandler::RowHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ m_children.setAutoDelete(TRUE);
+ addEndHandler("row",this,&RowHandler::endRow);
+ addStartHandler("entry",this,&RowHandler::startEntry);
+}
+
+RowHandler::~RowHandler()
+{
+}
+
+void RowHandler::startRow(const QXmlAttributes&)
+{
+ m_parent->setDelegate(this);
+}
+
+void RowHandler::endRow()
+{
+ m_parent->setDelegate(0);
+}
+
+void RowHandler::startEntry(const QXmlAttributes& attrib)
+{
+ EntryHandler *eh = new EntryHandler(this);
+ eh->startEntry(attrib);
+ m_children.append(eh);
+}
+
+//----------------------------------------------------------------------
+// TableHandler
+//----------------------------------------------------------------------
+
+TableHandler::TableHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ m_children.setAutoDelete(TRUE);
+ addEndHandler("table",this,&TableHandler::endTable);
+ addStartHandler("row",this,&TableHandler::startRow);
+}
+
+TableHandler::~TableHandler()
+{
+}
+
+void TableHandler::startTable(const QXmlAttributes& attrib)
+{
+ m_parent->setDelegate(this);
+ m_numColumns = attrib.value("cols").toInt();
+ printf("table cols=%d\n",m_numColumns);
+}
+
+void TableHandler::endTable()
+{
+ m_parent->setDelegate(0);
+}
+
+void TableHandler::startRow(const QXmlAttributes& attrib)
+{
+ RowHandler *rh = new RowHandler(this);
+ rh->startRow(attrib);
+ m_children.append(rh);
+}
+
+//----------------------------------------------------------------------
+// ParagraphHandler
+//----------------------------------------------------------------------
+
+ParagraphHandler::ParagraphHandler(IBaseHandler *parent)
+ : m_parent(parent)
+{
+ m_children.setAutoDelete(TRUE);
+
+ m_markupHandler = new MarkupHandler(m_children,m_curString);
+ setFallBackHandler(m_markupHandler);
+
+ addEndHandler("para",this,&ParagraphHandler::endParagraph);
+
+ addStartHandler("itemizedlist",this,&ParagraphHandler::startItemizedList);
+ addStartHandler("orderedlist",this,&ParagraphHandler::startOrderedList);
+ addStartHandler("parameterlist",this,&ParagraphHandler::startParameterList);
+ addStartHandler("simplesect",this,&ParagraphHandler::startSimpleSect);
+ addStartHandler("ref",this,&ParagraphHandler::startRef);
+ addStartHandler("variablelist",this,&ParagraphHandler::startVariableList);
+ addStartHandler("hruler",this,&ParagraphHandler::startHRuler);
+ addStartHandler("linebreak",this,&ParagraphHandler::startLineBreak);
+ addStartHandler("ulink",this,&ParagraphHandler::startULink);
+ addStartHandler("email",this,&ParagraphHandler::startEMail);
+ addStartHandler("link",this,&ParagraphHandler::startLink);
+ addStartHandler("programlisting",this,&ParagraphHandler::startProgramListing);
+ addStartHandler("formula",this,&ParagraphHandler::startFormula);
+ addStartHandler("image",this,&ParagraphHandler::startImage);
+ addStartHandler("dotfile",this,&ParagraphHandler::startDotFile);
+ addStartHandler("indexentry",this,&ParagraphHandler::startIndexEntry);
+ addStartHandler("table",this,&ParagraphHandler::startTable);
+}
+
+ParagraphHandler::~ParagraphHandler()
+{
+ delete m_markupHandler;
+}
+
+void ParagraphHandler::startParagraph(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("para\n");
+}
+
+void ParagraphHandler::endParagraph()
+{
+ addTextNode();
+ printf("end para\n");
+ m_parent->setDelegate(0);
+}
+
+void ParagraphHandler::startItemizedList(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ ListHandler *listHandler = new ListHandler(ItemizedList,this);
+ listHandler->startList(attrib);
+ m_children.append(listHandler);
+}
+
+void ParagraphHandler::startOrderedList(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ ListHandler *listHandler = new ListHandler(OrderedList,this);
+ listHandler->startList(attrib);
+ m_children.append(listHandler);
+}
+
+void ParagraphHandler::startParameterList(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ ParameterListHandler *parListHandler = new ParameterListHandler(this);
+ parListHandler->startParameterList(attrib);
+ m_children.append(parListHandler);
+}
+
+void ParagraphHandler::startSimpleSect(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ SimpleSectHandler *sectHandler = new SimpleSectHandler(this);
+ sectHandler->startSimpleSect(attrib);
+ m_children.append(sectHandler);
+}
+
+void ParagraphHandler::startRef(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ RefHandler *ref = new RefHandler(this);
+ ref->startRef(attrib);
+ m_children.append(ref);
+}
+
+void ParagraphHandler::startVariableList(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ VariableListHandler *vl = new VariableListHandler(this);
+ vl->startVariableList(attrib);
+ m_children.append(vl);
+}
+
+void ParagraphHandler::startHRuler(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ HRulerHandler *hr = new HRulerHandler(this);
+ hr->startHRuler(attrib);
+ m_children.append(hr);
+}
+
+void ParagraphHandler::startLineBreak(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ LineBreakHandler *lb = new LineBreakHandler(this);
+ lb->startLineBreak(attrib);
+ m_children.append(lb);
+}
+
+void ParagraphHandler::startULink(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ ULinkHandler *uh = new ULinkHandler(this);
+ uh->startULink(attrib);
+ m_children.append(uh);
+}
+
+void ParagraphHandler::startEMail(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ EMailHandler *eh = new EMailHandler(this);
+ eh->startEMail(attrib);
+ m_children.append(eh);
+}
+
+void ParagraphHandler::startLink(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ LinkHandler *lh = new LinkHandler(this);
+ lh->startLink(attrib);
+ m_children.append(lh);
+}
+
+void ParagraphHandler::startProgramListing(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ ProgramListingHandler *pl = new ProgramListingHandler(this);
+ pl->startProgramListing(attrib);
+ m_children.append(pl);
+}
+
+void ParagraphHandler::startFormula(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ FormulaHandler *fh = new FormulaHandler(this);
+ fh->startFormula(attrib);
+ m_children.append(fh);
+}
+
+void ParagraphHandler::startImage(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ ImageHandler *ih = new ImageHandler(this);
+ ih->startImage(attrib);
+ m_children.append(ih);
+}
+
+void ParagraphHandler::startDotFile(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ DotFileHandler *df = new DotFileHandler(this);
+ df->startDotFile(attrib);
+ m_children.append(df);
+}
+
+void ParagraphHandler::startIndexEntry(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ IndexEntryHandler *df = new IndexEntryHandler(this);
+ df->startIndexEntry(attrib);
+ m_children.append(df);
+}
+
+void ParagraphHandler::startTable(const QXmlAttributes& attrib)
+{
+ addTextNode();
+ TableHandler *th = new TableHandler(this);
+ th->startTable(attrib);
+ m_children.append(th);
+}
+
+void ParagraphHandler::addTextNode()
+{
+ if (!m_curString.isEmpty())
+ {
+ m_children.append(new TextNode(m_curString,m_markupHandler->markup()));
+ printf("addTextNode() text=\"%s\" markup=%x\n",
+ m_curString.data(),m_markupHandler->markup());
+ m_curString="";
+ }
+}
+
+IDocIterator *ParagraphHandler::contents() const
+{
+ return new ParagraphIterator(*this);
+}
+
+//----------------------------------------------------------------------
+// DocSectionHandler
+//----------------------------------------------------------------------
+
+DocSectionHandler::DocSectionHandler(IBaseHandler *parent,int level)
+ : m_parent(parent), m_level(level)
+{
+ m_children.setAutoDelete(TRUE);
+ m_markupHandler = new MarkupHandler(m_children,m_curString);
+ setFallBackHandler(m_markupHandler);
+ addStartHandler("ref",this,&DocSectionHandler::startRef);
+ QString sectionKey;
+ sectionKey.sprintf("sect%d",level);
+ addEndHandler(sectionKey,this,&DocSectionHandler::endDocSection);
+}
+
+DocSectionHandler::~DocSectionHandler()
+{
+ delete m_markupHandler;
+}
+
+void DocSectionHandler::startDocSection(const QXmlAttributes& attrib)
+{
+ m_parent->setDelegate(this);
+ printf("Start docsection\n");
+ m_id = attrib.value("id");
+ m_curString="";
+}
+
+void DocSectionHandler::endDocSection()
+{
+ addTextNode();
+ m_parent->setDelegate(0);
+ printf("End docsection\n");
+}
+
+void DocSectionHandler::addTextNode()
+{
+ if (!m_curString.isEmpty())
+ {
+ m_children.append(new TextNode(m_curString,m_markupHandler->markup()));
+ printf("addTextNode() text=\"%s\" markup=%x\n",
+ m_curString.data(),m_markupHandler->markup());
+ m_curString="";
+ }
+}
+
+void DocSectionHandler::startRef(const QXmlAttributes& attrib)
+{
+ RefHandler *ref = new RefHandler(this);
+ ref->startRef(attrib);
+ m_children.append(ref);
+}
+
+IDocIterator *DocSectionHandler::title() const
+{
+ return new DocSectionIterator(*this);
+}
+
+//----------------------------------------------------------------------
+// DocHandler
+//----------------------------------------------------------------------
+
+DocHandler::DocHandler(IBaseHandler *parent) : m_parent(parent)
+{
+ m_children.setAutoDelete(TRUE);
+
+ addEndHandler("briefdescription",this,&DocHandler::endDoc);
+ addEndHandler("detaileddescription",this,&DocHandler::endDoc);
+
+ addStartHandler("para",this,&DocHandler::startParagraph);
+ addStartHandler("sect1",this,&DocHandler::startSect1);
+ addStartHandler("sect2",this,&DocHandler::startSect2);
+ addStartHandler("sect3",this,&DocHandler::startSect3);
+ addStartHandler("title",this,&DocHandler::startTitle);
+}
+
+DocHandler::~DocHandler()
+{
+}
+
+void DocHandler::startDoc(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("start dochandler\n");
+}
+
+void DocHandler::endDoc()
+{
+ printf("end dochandler\n");
+ m_parent->setDelegate(0);
+}
+
+void DocHandler::startParagraph(const QXmlAttributes& attrib)
+{
+ ParagraphHandler *parHandler = new ParagraphHandler(this);
+ parHandler->startParagraph(attrib);
+ m_children.append(parHandler);
+}
+
+void DocHandler::startSect1(const QXmlAttributes& attrib)
+{
+ DocSectionHandler *secHandler = new DocSectionHandler(this,1);
+ secHandler->startDocSection(attrib);
+ m_children.append(secHandler);
+}
+
+void DocHandler::startSect2(const QXmlAttributes& attrib)
+{
+ DocSectionHandler *secHandler = new DocSectionHandler(this,2);
+ secHandler->startDocSection(attrib);
+ m_children.append(secHandler);
+}
+
+void DocHandler::startSect3(const QXmlAttributes& attrib)
+{
+ DocSectionHandler *secHandler = new DocSectionHandler(this,3);
+ secHandler->startDocSection(attrib);
+ m_children.append(secHandler);
+}
+
+void DocHandler::startTitle(const QXmlAttributes& attrib)
+{
+ TitleHandler *titleHandler = new TitleHandler(this);
+ titleHandler->startTitle(attrib);
+ m_children.append(titleHandler);
+}
+
+IDocIterator *DocHandler::contents() const
+{
+ return new DocIterator(*this);
+}
+
diff --git a/addon/doxmlparser/src/dochandler.h b/addon/doxmlparser/src/dochandler.h
new file mode 100644
index 0000000..3425288
--- /dev/null
+++ b/addon/doxmlparser/src/dochandler.h
@@ -0,0 +1,859 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#ifndef _DOCHANDLER_H
+#define _DOCHANDLER_H
+
+#include <qstring.h>
+#include <qlist.h>
+#include <qxml.h>
+
+#include <doxmlintf.h>
+#include "basehandler.h"
+#include "baseiterator.h"
+
+class ParagraphHandler;
+
+//-----------------------------------------------------------------------------
+
+
+/*! \brief Node representing a piece of text.
+ *
+ */
+class TextNode : public IDocText
+{
+ public:
+ TextNode(const QString &t,int markup)
+ : m_text(t), m_markup(markup) {}
+ virtual ~TextNode() {}
+
+ // IDocText
+ virtual Kind kind() const { return Text; }
+ virtual QString text() const { return m_text; }
+ virtual int markup() const { return m_markup; }
+
+ private:
+ QString m_text;
+ int m_markup;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing a change in the markup style.
+ *
+ */
+class MarkupModifierNode : public IDocMarkupModifier
+{
+ public:
+ MarkupModifierNode(int markup,bool enabled)
+ : m_markup(markup), m_enabled(enabled) {}
+ virtual ~MarkupModifierNode() {}
+
+ // IDocMarkupModifier
+ virtual Kind kind() const { return MarkupModifier; }
+
+ private:
+ int m_markup;
+ bool m_enabled;
+};
+
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Handles markup commands in the XML input.
+ *
+ */
+class MarkupHandler : public BaseFallBackHandler<MarkupHandler>
+{
+ public:
+ MarkupHandler(QList<IDoc> &children,QString &curString);
+ virtual ~MarkupHandler();
+ int markup() const { return m_curMarkup; }
+
+ virtual void startBold(const QXmlAttributes &attrib);
+ virtual void endBold();
+ virtual void startEmphasis(const QXmlAttributes &attrib);
+ virtual void endEmphasis();
+ virtual void startComputerOutput(const QXmlAttributes &attrib);
+ virtual void endComputerOutput();
+ virtual void startCenter(const QXmlAttributes &attrib);
+ virtual void endCenter();
+ virtual void startSmallFont(const QXmlAttributes &attrib);
+ virtual void endSmallFont();
+ virtual void startSubscript(const QXmlAttributes &attrib);
+ virtual void endSubscript();
+ virtual void startSuperscript(const QXmlAttributes &attrib);
+ virtual void endSuperscript();
+
+
+ private:
+ void addTextNode();
+
+ QList<IDoc> &m_children;
+ QString &m_curString;
+ int m_curMarkup;
+};
+
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing a list item.
+ *
+ */
+class ListItemHandler : public IDocListItem, public BaseHandler<ListItemHandler>
+{
+ public:
+ ListItemHandler(IBaseHandler *parent);
+ virtual ~ListItemHandler();
+ virtual void startListItem(const QXmlAttributes& attrib);
+ virtual void endListItem();
+ virtual void startParagraph(const QXmlAttributes& attrib);
+
+ // IDocItem
+ virtual Kind kind() const { return ListItem; }
+
+ private:
+ IBaseHandler *m_parent;
+ QList<IDoc> m_children;
+};
+
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing list of items.
+ *
+ */
+class ListHandler : public IDocList, public BaseHandler<ListHandler>
+{
+ public:
+ ListHandler(Kind k,IBaseHandler *parent);
+ virtual ~ListHandler();
+ virtual void startList(const QXmlAttributes& attrib);
+ virtual void endList();
+ virtual void startListItem(const QXmlAttributes& attrib);
+
+ // IDocList
+ virtual Kind kind() const { return m_kind; }
+
+ private:
+ IBaseHandler *m_parent;
+ QList<IDoc> m_children;
+ Kind m_kind;
+};
+
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing a parameter.
+ *
+ */
+class ParameterHandler : public IDocParameter,
+ public BaseHandler<ParameterHandler>
+{
+ public:
+ ParameterHandler(IBaseHandler *parent);
+ virtual ~ParameterHandler();
+ virtual void startParameterName(const QXmlAttributes& attrib);
+ virtual void endParameterName();
+ virtual void startParameterDescription(const QXmlAttributes& attrib);
+ virtual void endParameterDescription();
+ virtual void startParagraph(const QXmlAttributes& attrib);
+
+ // IDocParameter
+ virtual Kind kind() const { return Parameter; }
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_name;
+ ParagraphHandler *m_description;
+};
+
+
+//-----------------------------------------------------------------------------
+
+/* \brief Node representing a parameter list.
+ *
+ */
+class ParameterListHandler : public IDocParameter,
+ public BaseHandler<ParameterListHandler>
+{
+ public:
+ enum Types { Param, RetVal, Exception };
+ ParameterListHandler(IBaseHandler *parent);
+ virtual ~ParameterListHandler();
+ virtual void startParameterList(const QXmlAttributes& attrib);
+ virtual void endParameterList();
+ virtual void startParameterName(const QXmlAttributes& attrib);
+ virtual void startParameterDescription(const QXmlAttributes& attrib);
+
+ // IDocParameterList
+ virtual Kind kind() const { return ParameterList; }
+
+ private:
+ IBaseHandler *m_parent;
+ QList<ParameterHandler> m_parameters;
+ ParameterHandler *m_curParam;
+ Types m_type;
+};
+
+//-----------------------------------------------------------------------------
+
+/* \brief Node representing a horizontal ruler
+ *
+ */
+class LineBreakHandler : public IDocLineBreak, public BaseHandler<LineBreakHandler>
+{
+ public:
+ LineBreakHandler(IBaseHandler *parent);
+ virtual ~LineBreakHandler();
+
+ void startLineBreak(const QXmlAttributes& attrib);
+ void endLineBreak();
+
+ // IDocLineBreak
+ virtual Kind kind() const { return LineBreak; }
+
+ private:
+ IBaseHandler *m_parent;
+};
+
+//-----------------------------------------------------------------------------
+
+/* \brief Node representing a link to section
+ *
+ */
+class LinkHandler : public IDocLink, public BaseHandler<LinkHandler>
+{
+ public:
+ LinkHandler(IBaseHandler *parent);
+ virtual ~LinkHandler();
+
+ void startLink(const QXmlAttributes& attrib);
+ void endLink();
+
+ // IDocLink
+ virtual Kind kind() const { return Link; }
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_ref;
+ QString m_text;
+};
+
+
+//-----------------------------------------------------------------------------
+
+/* \brief Node representing a link to an email address
+ *
+ */
+class EMailHandler : public IDocEMail, public BaseHandler<EMailHandler>
+{
+ public:
+ EMailHandler(IBaseHandler *parent);
+ virtual ~EMailHandler();
+
+ void startEMail(const QXmlAttributes& attrib);
+ void endEMail();
+
+ // IDocEMail
+ virtual Kind kind() const { return EMail; }
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_address;
+};
+
+
+//-----------------------------------------------------------------------------
+
+/* \brief Node representing a link to an URL
+ *
+ */
+class ULinkHandler : public IDocULink, public BaseHandler<ULinkHandler>
+{
+ public:
+ ULinkHandler(IBaseHandler *parent);
+ virtual ~ULinkHandler();
+
+ void startULink(const QXmlAttributes& attrib);
+ void endULink();
+
+ // IDocULink
+ virtual Kind kind() const { return ULink; }
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_url;
+ QString m_text;
+};
+
+//-----------------------------------------------------------------------------
+
+/* \brief Node representing a horizontal ruler
+ *
+ */
+class HRulerHandler : public IDocHRuler, public BaseHandler<HRulerHandler>
+{
+ public:
+ HRulerHandler(IBaseHandler *parent);
+ virtual ~HRulerHandler();
+
+ void startHRuler(const QXmlAttributes& attrib);
+ void endHRuler();
+
+ // IDocHRuler
+ virtual Kind kind() const { return HRuler; }
+
+ private:
+ IBaseHandler *m_parent;
+};
+
+//-----------------------------------------------------------------------------
+
+/* \brief Node representing a reference to another item
+ *
+ */
+class RefHandler : public IDocRef, public BaseHandler<RefHandler>
+{
+ public:
+ RefHandler(IBaseHandler *parent);
+ virtual ~RefHandler();
+ void startRef(const QXmlAttributes& attrib);
+ void endRef();
+
+ // IDocRef
+ virtual Kind kind() const { return Ref; }
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_refId;
+ QString m_anchor;
+ QString m_linkText;
+};
+
+//-----------------------------------------------------------------------------
+
+/* \brief Node representing the title of a section
+ *
+ */
+// children: text, ref
+// children handled by MarkupHandler:
+// bold, computeroutput, emphasis, center,
+// small, subscript, superscript.
+class TitleHandler : public IDocTitle, public BaseHandler<TitleHandler>
+{
+ friend class TitleIterator;
+ public:
+ TitleHandler(IBaseHandler *parent);
+ virtual ~TitleHandler();
+ virtual void startTitle(const QXmlAttributes& attrib);
+ virtual void endTitle();
+ virtual void startRef(const QXmlAttributes& attrib);
+ void addTextNode();
+
+ // IDocTitle
+ virtual Kind kind() const { return Title; }
+ virtual IDocIterator *title() const;
+
+ private:
+ IBaseHandler *m_parent;
+ QList<IDoc> m_children;
+ MarkupHandler *m_markupHandler;
+};
+
+class TitleIterator : public BaseIterator<IDocIterator,IDoc,IDoc>
+{
+ public:
+ TitleIterator(const TitleHandler &handler) :
+ BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {}
+};
+
+//-----------------------------------------------------------------------------
+
+/* \brief Node representing a simple section with an unnumbered header.
+ *
+ */
+// children: title, para
+class SimpleSectHandler : public IDocSimpleSect,
+ public BaseHandler<SimpleSectHandler>
+{
+ public:
+ enum Types { Invalid = 0,
+ See, Return, Author, Version,
+ Since, Date, Bug, Note,
+ Warning, Par, Deprecated, Pre,
+ Post, Invar, Remark, Attention,
+ Todo, Test, RCS, EnumValues,
+ Examples
+ };
+ SimpleSectHandler(IBaseHandler *parent);
+ virtual ~SimpleSectHandler();
+ virtual void startSimpleSect(const QXmlAttributes& attrib);
+ virtual void endSimpleSect();
+ virtual void startTitle(const QXmlAttributes& attrib);
+ virtual void startParagraph(const QXmlAttributes& attrib);
+
+ // IDocSimpleSect
+ virtual Kind kind() const { return SimpleSect; }
+
+ private:
+ IBaseHandler *m_parent;
+ ParagraphHandler *m_paragraph;
+ Types m_type;
+ TitleHandler *m_title;
+};
+
+//-----------------------------------------------------------------------------
+
+/* \brief Node representing an named item of a VariableList.
+ *
+ */
+class VariableListEntryHandler : public IDocVariableListEntry, public BaseHandler<VariableListEntryHandler>
+{
+ public:
+ virtual void startVarListEntry(const QXmlAttributes& attrib);
+ virtual void endVarListEntry();
+ virtual void startListItem(const QXmlAttributes& attrib);
+ virtual void endListItem();
+ virtual void startTerm(const QXmlAttributes& attrib);
+ virtual void endTerm();
+ virtual void startParagraph(const QXmlAttributes& attrib);
+
+ VariableListEntryHandler(IBaseHandler *parent);
+ virtual ~VariableListEntryHandler();
+
+ // IDocVariableListEntry
+ virtual Kind kind() const { return VariableListEntry; }
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_term;
+ ParagraphHandler *m_description;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing a list of named items.
+ *
+ */
+// children: varlistentry, listitem
+class VariableListHandler : public IDocVariableList, public BaseHandler<VariableListHandler>
+{
+ public:
+ virtual void startVariableList(const QXmlAttributes& attrib);
+ virtual void endVariableList();
+ virtual void startVarListEntry(const QXmlAttributes& attrib);
+ virtual void startListItem(const QXmlAttributes& attrib);
+
+ VariableListHandler(IBaseHandler *parent);
+ virtual ~VariableListHandler();
+
+ // IDocVariableList
+ virtual Kind kind() const { return VariableList; }
+
+ private:
+ IBaseHandler *m_parent;
+ QList<VariableListEntryHandler> m_entries;
+ VariableListEntryHandler *m_curEntry;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing a highlighted text fragment.
+ *
+ */
+// children: -
+class HighlightHandler : public IDocHighlight, public BaseHandler<HighlightHandler>
+{
+ public:
+ HighlightHandler(IBaseHandler *parent);
+ virtual ~HighlightHandler();
+ void startHighlight(const QXmlAttributes& attrib);
+ void endHighlight();
+
+ // IDocHighlight
+ virtual Kind kind() const { return Highlight; }
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_class;
+ QString m_text;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing a line of code.
+ *
+ */
+// children: linenumber, highlight, anchor, ref
+class CodeLineHandler : public IDocCodeLine, public BaseHandler<CodeLineHandler>
+{
+ public:
+
+ virtual void startCodeLine(const QXmlAttributes&);
+ virtual void endCodeLine();
+ virtual void startLineNumber(const QXmlAttributes&);
+ virtual void endLineNumber();
+ virtual void startHighlight(const QXmlAttributes&);
+ virtual void startRef(const QXmlAttributes&);
+
+ CodeLineHandler(IBaseHandler *parent);
+ virtual ~CodeLineHandler();
+
+ // IDocCodeLine
+ virtual Kind kind() const { return CodeLine; }
+
+ private:
+ void addTextNode();
+
+ IBaseHandler *m_parent;
+ int m_lineNumber;
+ QString m_refId;
+ QList<IDoc> m_children;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing a program listing
+ *
+ */
+// children: codeline, linenumber
+class ProgramListingHandler : public IDocProgramListing, public BaseHandler<ProgramListingHandler>
+{
+ public:
+ virtual void startProgramListing(const QXmlAttributes& attrib);
+ virtual void endProgramListing();
+ virtual void startCodeLine(const QXmlAttributes&);
+ virtual void startLineNumber(const QXmlAttributes&);
+
+ ProgramListingHandler(IBaseHandler *parent);
+ virtual ~ProgramListingHandler();
+
+ // IDocProgramListing
+ virtual Kind kind() const { return ProgramListing; }
+
+ private:
+ IBaseHandler *m_parent;
+ QList<CodeLineHandler> m_children;
+ bool m_hasLineNumber;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing a formula.
+ *
+ */
+// children: -
+class FormulaHandler : public IDocFormula, public BaseHandler<FormulaHandler>
+{
+ public:
+ FormulaHandler(IBaseHandler *parent);
+ virtual ~FormulaHandler();
+ void startFormula(const QXmlAttributes& attrib);
+ void endFormula();
+
+ // IDocFormula
+ virtual Kind kind() const { return Formula; }
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_id;
+ QString m_text;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing an image.
+ *
+ */
+// children: -
+class ImageHandler : public IDocImage, public BaseHandler<ImageHandler>
+{
+ public:
+ ImageHandler(IBaseHandler *parent);
+ virtual ~ImageHandler();
+ void startImage(const QXmlAttributes& attrib);
+ void endImage();
+
+ // IDocImage
+ virtual Kind kind() const { return Image; }
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_name;
+ QString m_caption;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing a dot file.
+ *
+ */
+// children: -
+class DotFileHandler : public IDocDotFile, public BaseHandler<DotFileHandler>
+{
+ public:
+ DotFileHandler(IBaseHandler *parent);
+ virtual ~DotFileHandler();
+ void startDotFile(const QXmlAttributes& attrib);
+ void endDotFile();
+
+ // IDocDotFile
+ virtual Kind kind() const { return DotFile; }
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_name;
+ QString m_caption;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing an entry in the index.
+ *
+ */
+// children: -
+class IndexEntryHandler : public IDocIndexEntry, public BaseHandler<IndexEntryHandler>
+{
+ public:
+ IndexEntryHandler(IBaseHandler *parent);
+ virtual ~IndexEntryHandler();
+ void startIndexEntry(const QXmlAttributes& attrib);
+ void endIndexEntry();
+ void startPrimaryIE(const QXmlAttributes& attrib);
+ void endPrimaryIE();
+ void startSecondaryIE(const QXmlAttributes& attrib);
+ void endSecondaryIE();
+
+ // IDocIndexEntry
+ virtual Kind kind() const { return IndexEntry; }
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_primary;
+ QString m_secondary;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing an entry in the table entry.
+ *
+ */
+// children: para
+class EntryHandler : public IDocEntry, public BaseHandler<EntryHandler>
+{
+ public:
+ EntryHandler(IBaseHandler *parent);
+ virtual ~EntryHandler();
+ void startEntry(const QXmlAttributes& attrib);
+ void endEntry();
+ void startParagraph(const QXmlAttributes& attrib);
+
+ // IDocEntry
+ virtual Kind kind() const { return Entry; }
+
+ private:
+ IBaseHandler *m_parent;
+ QList<IDoc> m_children;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing an entry in the table row.
+ *
+ */
+// children: entry
+class RowHandler : public IDocRow, public BaseHandler<RowHandler>
+{
+ public:
+ RowHandler(IBaseHandler *parent);
+ virtual ~RowHandler();
+ void startRow(const QXmlAttributes& attrib);
+ void endRow();
+ void startEntry(const QXmlAttributes& attrib);
+
+ // IDocRow
+ virtual Kind kind() const { return Row; }
+
+ private:
+ IBaseHandler *m_parent;
+ QList<EntryHandler> m_children;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing an entry in the table.
+ *
+ */
+// children: row
+class TableHandler : public IDocTable, public BaseHandler<TableHandler>
+{
+ public:
+ TableHandler(IBaseHandler *parent);
+ virtual ~TableHandler();
+ void startTable(const QXmlAttributes& attrib);
+ void endTable();
+ void startRow(const QXmlAttributes& attrib);
+
+ // IDocTable
+ virtual Kind kind() const { return Table; }
+
+ private:
+ IBaseHandler *m_parent;
+ QList<RowHandler> m_children;
+ int m_numColumns;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing a paragraph of text and commands.
+ *
+ */
+// children: itemizedlist, orderedlist, parameterlist, simplesect, ref,
+// variablelist, hruler, linebreak, ulink, email, link
+// programlisting, formula, image, dotfile, indexentry,
+// table
+//
+// children handled by MarkupHandler:
+// bold, computeroutput, emphasis, center,
+// small, subscript, superscript.
+//
+class ParagraphHandler : public IDocPara,
+ public BaseHandler<ParagraphHandler>
+{
+ friend class ParagraphIterator;
+
+ public:
+ virtual void startParagraph(const QXmlAttributes& attrib);
+ virtual void endParagraph();
+ virtual void startItemizedList(const QXmlAttributes& attrib);
+ virtual void startOrderedList(const QXmlAttributes& attrib);
+ virtual void startParameterList(const QXmlAttributes& attrib);
+ virtual void startSimpleSect(const QXmlAttributes& attrib);
+ virtual void startRef(const QXmlAttributes& attrib);
+ virtual void startVariableList(const QXmlAttributes& attrib);
+ virtual void startHRuler(const QXmlAttributes& attrib);
+ virtual void startLineBreak(const QXmlAttributes& attrib);
+ virtual void startULink(const QXmlAttributes& attrib);
+ virtual void startEMail(const QXmlAttributes& attrib);
+ virtual void startLink(const QXmlAttributes& attrib);
+ virtual void startProgramListing(const QXmlAttributes& attrib);
+ virtual void startFormula(const QXmlAttributes& attrib);
+ virtual void startImage(const QXmlAttributes& attrib);
+ virtual void startDotFile(const QXmlAttributes& attrib);
+ virtual void startIndexEntry(const QXmlAttributes& attrib);
+ virtual void startTable(const QXmlAttributes& attrib);
+
+ ParagraphHandler(IBaseHandler *parent);
+ virtual ~ParagraphHandler();
+
+ // IDocPara
+ virtual Kind kind() const { return Para; }
+ virtual IDocIterator *contents() const;
+
+ private:
+ void addTextNode();
+ IBaseHandler *m_parent;
+ QList<IDoc> m_children;
+ MarkupHandler *m_markupHandler;
+};
+
+class ParagraphIterator : public BaseIterator<IDocIterator,IDoc,IDoc>
+{
+ public:
+ ParagraphIterator(const ParagraphHandler &handler) :
+ BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {}
+};
+
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing a section.
+ *
+ */
+// children: text, ref
+// children handled by MarkupHandler:
+// bold, computeroutput, emphasis, center,
+// small, subscript, superscript.
+class DocSectionHandler : public IDocSection, public BaseHandler<DocSectionHandler>
+{
+ friend class DocSectionIterator;
+ public:
+ DocSectionHandler(IBaseHandler *parent,int level);
+ virtual ~DocSectionHandler();
+ virtual void startDocSection(const QXmlAttributes& attrib);
+ virtual void endDocSection();
+ virtual void startRef(const QXmlAttributes& attrib);
+ void addTextNode();
+
+ // IDocSection
+ virtual Kind kind() const { return Section; }
+ virtual QString id() const { return m_id; }
+ virtual int level() const { return m_level; }
+ virtual IDocIterator *title() const;
+
+ private:
+ IBaseHandler *m_parent;
+ QList<IDoc> m_children;
+ MarkupHandler *m_markupHandler;
+ QString m_id;
+ int m_level;
+};
+
+class DocSectionIterator : public BaseIterator<IDocIterator,IDoc,IDoc>
+{
+ public:
+ DocSectionIterator(const DocSectionHandler &handler) :
+ BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {}
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing a documentation block.
+ *
+ */
+// children: para, title, sect1, sect2, sect3
+class DocHandler : public IDocRoot, public BaseHandler<DocHandler>
+{
+ friend class DocIterator;
+ public:
+ virtual void startDoc(const QXmlAttributes& attrib);
+ virtual void endDoc();
+ virtual void startParagraph(const QXmlAttributes& attrib);
+ virtual void startSect1(const QXmlAttributes& attrib);
+ virtual void startSect2(const QXmlAttributes& attrib);
+ virtual void startSect3(const QXmlAttributes& attrib);
+ virtual void startTitle(const QXmlAttributes& attrib);
+
+ DocHandler(IBaseHandler *parent);
+ virtual ~DocHandler();
+
+ // IDocRoot
+ virtual Kind kind() const { return Root; }
+ virtual IDocIterator *contents() const;
+
+ private:
+ IBaseHandler *m_parent;
+ QList<IDoc> m_children;
+};
+
+class DocIterator : public BaseIterator<IDocIterator,IDoc,IDoc>
+{
+ public:
+ DocIterator(const DocHandler &handler) :
+ BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {}
+};
+
+#endif
diff --git a/addon/doxmlparser/src/doxmlintf.h b/addon/doxmlparser/src/doxmlintf.h
new file mode 100644
index 0000000..ec2950c
--- /dev/null
+++ b/addon/doxmlparser/src/doxmlintf.h
@@ -0,0 +1,422 @@
+#ifndef _DOXMLINTF_H
+#define _DOXMLINTF_H
+
+#include <qstring.h>
+
+class IMember;
+class IDocIterator;
+
+class ILinkedText
+{
+ public:
+ enum Kind { Kind_Text, Kind_Ref };
+ virtual Kind kind() const = 0;
+};
+
+class ILT_Text : public ILinkedText
+{
+ public:
+ virtual QString text() const = 0;
+};
+
+class ILT_Ref : public ILinkedText
+{
+ public:
+ virtual QString id() const = 0;
+ virtual QString external() const = 0;
+ virtual QString text() const = 0;
+};
+
+class ILinkedTextIterator
+{
+ public:
+ virtual ILinkedText *toFirst() = 0;
+ virtual ILinkedText *toLast() = 0;
+ virtual ILinkedText *toNext() = 0;
+ virtual ILinkedText *toPrev() = 0;
+ virtual ILinkedText *current() const = 0;
+ virtual void release() = 0;
+};
+
+class IParam
+{
+ public:
+ virtual ILinkedTextIterator *type() const = 0;
+ virtual QString declarationName() const = 0;
+ virtual QString definitionName() const = 0;
+ virtual QString attrib() const = 0;
+ virtual QString arraySpecifier() const = 0;
+ virtual ILinkedTextIterator *defaultValue() const = 0;
+};
+
+class IParamIterator
+{
+ public:
+ virtual IParam *toFirst() = 0;
+ virtual IParam *toLast() = 0;
+ virtual IParam *toNext() = 0;
+ virtual IParam *toPrev() = 0;
+ virtual IParam *current() const = 0;
+ virtual void release() = 0;
+};
+
+class IMemberReference
+{
+ public:
+ virtual IMember *member() const = 0;
+ virtual QString memberName() const = 0;
+};
+
+class IMemberReferenceIterator
+{
+ public:
+ virtual IMemberReference *toFirst() = 0;
+ virtual IMemberReference *toLast() = 0;
+ virtual IMemberReference *toNext() = 0;
+ virtual IMemberReference *toPrev() = 0;
+ virtual IMemberReference *current() const = 0;
+ virtual void release() = 0;
+};
+
+class IEnumValue
+{
+ public:
+ virtual QString name() const = 0;
+ virtual QString initializer() const = 0;
+};
+
+class IEnumValueIterator
+{
+ public:
+ virtual IEnumValue *toFirst() = 0;
+ virtual IEnumValue *toLast() = 0;
+ virtual IEnumValue *toNext() = 0;
+ virtual IEnumValue *toPrev() = 0;
+ virtual IEnumValue *current() const = 0;
+ virtual void release() = 0;
+};
+
+class IDoc
+{
+ public:
+ enum Kind
+ {
+ Para, // 0 -> IDocPara
+ Text, // 1 -> IDocText
+ MarkupModifier, // 2 -> IDocMarkupModifier
+ ItemizedList, // 3 -> IDocList
+ OrderedList, // 4 -> IDocList
+ ListItem, // 5 -> IDocListItem
+ ParameterList, // 6 -> IDocParameterList
+ Parameter, // 7 -> IDocParameter
+ SimpleSect, // 8 -> IDocSimpleSect
+ Title, // 9 -> IDocTitle
+ Ref, // 10 -> IDocRef
+ VariableList, // 11 -> IDocVariableList
+ VariableListEntry, // 12 -> IDocVariableListEntry
+ HRuler, // 13 -> IDocHRuler
+ LineBreak, // 14 -> IDocLineBreak
+ ULink, // 15 -> IDocULink
+ EMail, // 16 -> IDocEMail
+ Link, // 17 -> IDocLink
+ ProgramListing, // 18 -> IDocProgramListing
+ CodeLine, // 19 -> IDocCodeLine
+ Highlight, // 20 -> IDocHighlight
+ Anchor, // 21 -> IDocAnchor
+ Formula, // 22 -> IDocFormula
+ Image, // 23 -> IDocImage
+ DotFile, // 24 -> IDocDotFile
+ IndexEntry, // 25 -> IDocIndexEntry
+ Table, // 26 -> IDocTable
+ Row, // 27 -> IDocRow
+ Entry, // 28 -> IDocEntry
+ Section, // 29 -> IDocSection
+ Root // 30 -> IDocRoot
+ };
+ virtual Kind kind() const = 0;
+};
+
+class IDocMarkup : public IDoc
+{
+ public:
+ enum Markup
+ {
+ Normal = 0x00,
+ Bold = 0x01,
+ Emphasis = 0x02,
+ ComputerOutput = 0x04,
+ Subscript = 0x08,
+ Superscript = 0x10,
+ SmallFont = 0x20,
+ Center = 0x40
+ };
+
+};
+
+class IDocPara : public IDoc
+{
+ public:
+ virtual IDocIterator *contents() const = 0;
+};
+
+class IDocText : public IDocMarkup
+{
+ public:
+ virtual QString text() const = 0;
+ virtual int markup() const = 0;
+};
+
+class IDocMarkupModifier : public IDoc
+{
+};
+
+class IDocList : public IDoc
+{
+};
+
+class IDocListItem : public IDoc
+{
+};
+
+class IDocParameterList : public IDoc
+{
+};
+
+class IDocParameter : public IDoc
+{
+};
+
+class IDocSimpleSect : public IDoc
+{
+};
+
+class IDocTitle : public IDoc
+{
+ public:
+ virtual IDocIterator *title() const = 0;
+};
+
+class IDocRef : public IDoc
+{
+};
+
+class IDocVariableList : public IDoc
+{
+};
+
+class IDocVariableListEntry : public IDoc
+{
+};
+
+class IDocHRuler : public IDoc
+{
+};
+
+class IDocLineBreak : public IDoc
+{
+};
+
+class IDocULink : public IDoc
+{
+};
+
+class IDocEMail : public IDoc
+{
+};
+
+class IDocLink : public IDoc
+{
+};
+
+class IDocProgramListing : public IDoc
+{
+};
+
+class IDocCodeLine : public IDoc
+{
+};
+
+class IDocHighlight : public IDoc
+{
+};
+
+class IDocAnchor : public IDoc
+{
+};
+
+class IDocFormula : public IDoc
+{
+};
+
+class IDocImage : public IDoc
+{
+};
+
+class IDocDotFile : public IDoc
+{
+};
+
+class IDocIndexEntry : public IDoc
+{
+};
+
+class IDocTable : public IDoc
+{
+};
+
+class IDocRow : public IDoc
+{
+};
+
+class IDocEntry : public IDoc
+{
+};
+
+class IDocSection : public IDoc
+{
+ public:
+ virtual QString id() const = 0;
+ virtual int level() const = 0;
+ virtual IDocIterator *title() const = 0;
+};
+
+class IDocRoot : public IDoc
+{
+ public:
+ virtual IDocIterator *contents() const = 0;
+};
+
+class IDocIterator
+{
+ public:
+ virtual IDoc *toFirst() = 0;
+ virtual IDoc *toLast() = 0;
+ virtual IDoc *toNext() = 0;
+ virtual IDoc *toPrev() = 0;
+ virtual IDoc *current() const = 0;
+ virtual void release() = 0;
+};
+
+class IMember
+{
+ public:
+ virtual QString kind() const = 0;
+ virtual QString id() const = 0;
+ virtual QString protection() const = 0;
+ virtual QString virtualness() const = 0;
+ virtual ILinkedTextIterator *type() const = 0;
+ virtual QString name() const = 0;
+ virtual bool isConst() const = 0;
+ virtual bool isVolatile() const = 0;
+ virtual IParamIterator *params() const = 0;
+ virtual ILinkedTextIterator *initializer() const = 0;
+ virtual ILinkedTextIterator *exceptions() const = 0;
+ virtual IMemberReferenceIterator *references() const = 0;
+ virtual IMemberReferenceIterator *referencedBy() const = 0;
+ virtual int bodyStart() const = 0;
+ virtual int bodyEnd() const = 0;
+ virtual QString definitionFile() const = 0;
+ virtual int definitionLine() const = 0;
+ virtual IMemberReference *reimplements() const = 0;
+ virtual IMemberReferenceIterator *reimplementedBy() const = 0;
+ virtual IEnumValueIterator *enumValues() const = 0;
+ virtual IDocRoot *briefDescription() const = 0;
+ virtual IDocRoot *detailedDescription() const = 0;
+};
+
+class IMemberIterator
+{
+ public:
+ virtual IMember *toFirst() = 0;
+ virtual IMember *toLast() = 0;
+ virtual IMember *toNext() = 0;
+ virtual IMember *toPrev() = 0;
+ virtual IMember *current() const = 0;
+ virtual void release() = 0;
+};
+
+class ISection
+{
+ public:
+ virtual QString kind() const = 0;
+ virtual IMemberIterator *members() const = 0;
+};
+
+class ISectionIterator
+{
+ public:
+ virtual ISection *toFirst() = 0;
+ virtual ISection *toLast() = 0;
+ virtual ISection *toNext() = 0;
+ virtual ISection *toPrev() = 0;
+ virtual ISection *current() const = 0;
+ virtual void release() = 0;
+};
+
+class ICompound
+{
+ public:
+ virtual QString name() const = 0;
+ virtual QString id() const = 0;
+ virtual QString kind() const = 0;
+ virtual ISectionIterator *sections() const = 0;
+ virtual IDocRoot *briefDescription() const = 0;
+ virtual IDocRoot *detailedDescription() const = 0;
+};
+
+class ICompoundIterator
+{
+ public:
+ virtual ICompound *toFirst() = 0;
+ virtual ICompound *toLast() = 0;
+ virtual ICompound *toNext() = 0;
+ virtual ICompound *toPrev() = 0;
+ virtual ICompound *current() const = 0;
+ virtual void release() = 0;
+};
+
+/*! Root node of the object model. */
+class IDoxygen
+{
+ public:
+ /*! Returns an iterator that can be used to iterate over the list
+ * of compounds found in the project.
+ */
+ virtual ICompoundIterator *compounds() const = 0;
+
+ /*! Returns a compound given its unique \a id. If you have a
+ * compound id this function is much more efficient than iterating
+ * over the compound list. Returns 0 if the id is not valid.
+ */
+ virtual ICompound *compoundById(const QString &id) const = 0;
+
+ /*! Returns a compound given its name (including the scope).
+ * Returns 0 if the name is not found in the project.
+ */
+ virtual ICompound *compoundByName(const QString &name) const = 0;
+
+ /*! Returns an interface to a member given its id.
+ * @param id The member id.
+ */
+ virtual IMember *memberById(const QString &id) const = 0;
+
+ /*! Returns a list of all members with a certain name.
+ * @param name The name of the member.
+ */
+ virtual IMemberIterator *memberByName(const QString &name) const = 0;
+
+ /*! Releases the memory for the object hierarchy obtained by
+ * createdObjecModelFromXML(). First release all iterators before calling
+ * this function.
+ */
+ virtual void release() = 0;
+};
+
+/*! Factory method that creates an object model given an XML file generated
+ * by doxygen.
+ * @param xmlFileName The name of the XML to parse.
+ * @returns An iterface to the object model.
+ */
+IDoxygen *createObjectModelFromXML(const char *xmlFileName);
+
+#endif
diff --git a/addon/doxmlparser/src/doxmlparser.pro.in b/addon/doxmlparser/src/doxmlparser.pro.in
new file mode 100644
index 0000000..7724b47
--- /dev/null
+++ b/addon/doxmlparser/src/doxmlparser.pro.in
@@ -0,0 +1,23 @@
+TEMPLATE = lib.t
+CONFIG = console staticlib warn_on $extraopts
+HEADERS = basehandler.h mainhandler.h \
+ compoundhandler.h sectionhandler.h \
+ memberhandler.h paramhandler.h \
+ dochandler.h linkedtexthandler.h
+SOURCES = mainhandler.cpp \
+ compoundhandler.cpp sectionhandler.cpp \
+ memberhandler.cpp paramhandler.cpp \
+ dochandler.cpp linkedtexthandler.cpp
+unix:LIBS += -L../../../lib -lqtools
+win32:INCLUDEPATH += .
+win32-mingw:LIBS += -L../../../lib -lqtools
+win32-msvc:LIBS += qtools.lib shell32.lib
+win32-msvc:TMAKE_LFLAGS += /LIBPATH:....\\..\lib
+win32-borland:LIBS += qtools.lib doxycfg.lib shell32.lib
+win32-borland:TMAKE_LFLAGS += -L..\..\..\lib
+win32:TMAKE_CXXFLAGS += -DQT_NODLL
+DESTDIR = ../lib
+OBJECTS_DIR = ../objects
+TARGET = doxmlparser
+INCLUDEPATH += ../../../qtools ../include
+
diff --git a/addon/doxmlparser/src/linkedtexthandler.cpp b/addon/doxmlparser/src/linkedtexthandler.cpp
new file mode 100644
index 0000000..b142188
--- /dev/null
+++ b/addon/doxmlparser/src/linkedtexthandler.cpp
@@ -0,0 +1,107 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+#include "linkedtexthandler.h"
+#include <doxmlintf.h>
+
+class LT_Text : public ILT_Text
+{
+ public:
+ LT_Text(const QString &text) : m_text(text) {}
+ virtual ~LT_Text() {}
+
+ // ILT_Text
+ virtual QString text() const { return m_text; }
+ virtual Kind kind() const { return Kind_Text; }
+ private:
+ QString m_text;
+};
+
+class LT_Ref : public ILT_Ref
+{
+ public:
+ LT_Ref() {}
+ virtual ~LT_Ref() {}
+ void setRefId(const QString &refId) { m_refId=refId; }
+ void setText(const QString &text) { m_text=text; }
+ void setExtId(const QString &extId) { m_extId=extId; }
+
+ // ILT_Ref
+ virtual QString text() const { return m_text; }
+ virtual QString id() const { return m_refId; }
+ virtual QString external() const { return m_extId; }
+ virtual Kind kind() const { return Kind_Ref; }
+
+ private:
+ QString m_refId;
+ QString m_extId;
+ QString m_text;
+};
+
+LinkedTextHandler::LinkedTextHandler(IBaseHandler *parent,
+ QList<ILinkedText> &children
+ )
+ : m_parent(parent), m_children(children)
+{
+ addStartHandler("ref",this,&LinkedTextHandler::startRef);
+ addEndHandler("ref",this,&LinkedTextHandler::endRef);
+ m_children.setAutoDelete(TRUE);
+ m_ref=0;
+}
+
+LinkedTextHandler::~LinkedTextHandler()
+{
+}
+
+void LinkedTextHandler::start(const char *endTag)
+{
+ addEndHandler(endTag,this,&LinkedTextHandler::end);
+ m_parent->setDelegate(this);
+ m_curString="";
+}
+
+void LinkedTextHandler::end()
+{
+ if (!m_curString.isEmpty())
+ {
+ m_children.append(new LT_Text(m_curString));
+ printf("LinkedTextHandler: add text `%s'\n",m_curString.data());
+ m_curString="";
+ }
+ m_parent->setDelegate(0);
+}
+
+void LinkedTextHandler::startRef(const QXmlAttributes& attrib)
+{
+ if (!m_curString.isEmpty())
+ {
+ m_children.append(new LT_Text(m_curString));
+ printf("LinkedTextHandler: add text `%s'\n",m_curString.data());
+ m_curString="";
+ }
+ ASSERT(m_ref==0);
+ m_ref = new LT_Ref;
+ m_ref->setRefId(attrib.value("idref"));
+ m_ref->setExtId(attrib.value("external"));
+}
+
+void LinkedTextHandler::endRef()
+{
+ m_ref->setText(m_curString);
+ m_children.append(m_ref);
+ printf("LinkedTextHandler: add ref `%s'\n",m_ref->text().data());
+ m_ref=0;
+}
+
+
diff --git a/addon/doxmlparser/src/linkedtexthandler.h b/addon/doxmlparser/src/linkedtexthandler.h
new file mode 100644
index 0000000..0569b00
--- /dev/null
+++ b/addon/doxmlparser/src/linkedtexthandler.h
@@ -0,0 +1,46 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+#ifndef LINKEDTEXTHANDLER_H
+#define LINKEDTEXTHANDLER_H
+
+#include "baseiterator.h"
+#include "basehandler.h"
+
+class LT_Ref;
+
+class LinkedTextIterator : public BaseIterator<ILinkedTextIterator,ILinkedText,ILinkedText>
+{
+ public:
+ LinkedTextIterator(const QList<ILinkedText> &list) :
+ BaseIterator<ILinkedTextIterator,ILinkedText,ILinkedText>(list) {}
+};
+
+class LinkedTextHandler : public BaseHandler<LinkedTextHandler>
+{
+ public:
+ LinkedTextHandler(IBaseHandler *parent,QList<ILinkedText> &children);
+ virtual ~LinkedTextHandler();
+ virtual void start(const char *endTag);
+ virtual void end();
+ virtual void startRef(const QXmlAttributes& attrib);
+ virtual void endRef();
+
+ private:
+ IBaseHandler *m_parent;
+ QList<ILinkedText> &m_children;
+ LT_Ref *m_ref;
+};
+
+#endif
diff --git a/addon/doxmlparser/src/mainhandler.cpp b/addon/doxmlparser/src/mainhandler.cpp
new file mode 100644
index 0000000..7d0e682
--- /dev/null
+++ b/addon/doxmlparser/src/mainhandler.cpp
@@ -0,0 +1,126 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#include <qxml.h>
+#include "mainhandler.h"
+
+MainHandler::MainHandler() : m_compoundDict(10007), m_compoundNameDict(10007)
+{
+ m_compounds.setAutoDelete(TRUE);
+ addStartHandler("doxygen");
+ addStartHandler("compounddef",this,&MainHandler::startCompound);
+ addEndHandler("doxygen");
+ addEndHandler("compounddef");
+}
+
+MainHandler::~MainHandler()
+{
+ printf("MainHandler::~MainHandler()\n");
+}
+
+void MainHandler::startCompound(const QXmlAttributes& attrib)
+{
+ CompoundHandler *compHandler = new CompoundHandler(this);
+ compHandler->startCompound(attrib);
+ m_compounds.append(compHandler);
+}
+
+void MainHandler::insertMemberById(const QString &id,IMember *h)
+{
+ m_memberDict.insert(id,h);
+}
+
+void MainHandler::insertMemberByName(const QString &name,IMember *h)
+{
+ QList<IMember> *ml = m_memberNameDict[name];
+ if (ml)
+ {
+ ml->append(h);
+ }
+ else
+ {
+ ml = new QList<IMember>;
+ ml->append(h);
+ m_memberNameDict.insert(name,ml);
+ }
+}
+
+void MainHandler::initialize()
+{
+ QListIterator<ICompound> mci(m_compounds);
+ CompoundHandler *compHandler;
+ for (;(compHandler=(CompoundHandler *)mci.current());++mci)
+ {
+ compHandler->initialize(this);
+ m_compoundNameDict.insert(compHandler->name(),compHandler);
+ m_compoundDict.insert(compHandler->id(),compHandler);
+ }
+
+ // for each member
+ QDictIterator< QList<IMember> > mndi(m_memberNameDict);
+ QList<IMember> *ml;
+ for (;(ml=mndi.current());++mndi)
+ {
+ QListIterator<IMember> mli(*ml);
+ IMember *mem;
+ for (;(mem=mli.current());++mli)
+ {
+ ((MemberHandler*)mem)->initialize(this);
+ }
+ }
+
+}
+
+class ErrorHandler : public QXmlErrorHandler
+{
+ public:
+ virtual ~ErrorHandler() {}
+ bool warning( const QXmlParseException & )
+ {
+ return FALSE;
+ }
+ bool error( const QXmlParseException & )
+ {
+ return FALSE;
+ }
+ bool fatalError( const QXmlParseException &exception )
+ {
+ fprintf(stderr,"Fatal error at line %d column %d: %s\n",
+ exception.lineNumber(),exception.columnNumber(),
+ exception.message().data());
+ return FALSE;
+ }
+ QString errorString() { return ""; }
+
+ private:
+ QString errorMsg;
+};
+
+IDoxygen *createObjectModelFromXML(const char * xmlFileName)
+{
+ QFile xmlFile(xmlFileName);
+ MainHandler * handler = new MainHandler;
+ ErrorHandler errorHandler;
+ QXmlInputSource source( xmlFile );
+ QXmlSimpleReader reader;
+ reader.setContentHandler( handler );
+ reader.setErrorHandler( &errorHandler );
+ reader.parse( source );
+ printf("<---------- initialize ----------->\n");
+ handler->initialize();
+ printf("<-------- end initialize --------->\n");
+ return handler;
+}
+
diff --git a/addon/doxmlparser/src/mainhandler.h b/addon/doxmlparser/src/mainhandler.h
new file mode 100644
index 0000000..e466b6f
--- /dev/null
+++ b/addon/doxmlparser/src/mainhandler.h
@@ -0,0 +1,68 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#ifndef _MAINHANDLER_H
+#define _MAINHANDLER_H
+
+#include <qlist.h>
+#include "basehandler.h"
+#include "compoundhandler.h"
+#include <doxmlintf.h>
+#include "memberhandler.h"
+
+class MainHandler : public IDoxygen, public BaseHandler<MainHandler>
+{
+ public:
+ virtual void startCompound(const QXmlAttributes& attrib);
+ MainHandler();
+ virtual ~MainHandler();
+
+ ICompoundIterator *compounds() const
+ {
+ return new CompoundIterator(m_compounds);
+ }
+ ICompound *compoundById(const QString &id) const
+ {
+ return m_compoundDict[id];
+ }
+ virtual ICompound *compoundByName(const QString &name) const
+ {
+ return name.isEmpty() ? 0 : m_compoundNameDict[name];
+ }
+ virtual IMember *memberById(const QString &id) const
+ {
+ return m_memberDict[id];
+ }
+ virtual IMemberIterator *memberByName(const QString &name) const
+ {
+ QList<IMember> *ml = m_memberNameDict[name];
+ if (ml==0) return 0;
+ return new MemberIterator(*ml);
+ }
+ virtual void release() { delete this; }
+ void insertMemberById(const QString &id,IMember *h);
+ void insertMemberByName(const QString &name,IMember *h);
+
+ void initialize();
+
+ private:
+ QList<ICompound> m_compounds;
+ QDict<ICompound> m_compoundDict;
+ QDict<ICompound> m_compoundNameDict;
+ QDict<IMember> m_memberDict;
+ QDict<QList<IMember> > m_memberNameDict;
+};
+
+#endif
diff --git a/addon/doxmlparser/src/memberhandler.cpp b/addon/doxmlparser/src/memberhandler.cpp
new file mode 100644
index 0000000..f211f8e
--- /dev/null
+++ b/addon/doxmlparser/src/memberhandler.cpp
@@ -0,0 +1,299 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#include "memberhandler.h"
+#include "sectionhandler.h"
+#include "dochandler.h"
+#include "mainhandler.h"
+#include "linkedtexthandler.h"
+
+//------------------------------------------------------------------------------
+
+void MemberReference::initialize(MainHandler *mh)
+{
+ m_mainHandler = mh;
+}
+
+IMember *MemberReference::member() const
+{
+ return m_mainHandler->memberById(m_memId);
+}
+
+//------------------------------------------------------------------------------
+
+
+EnumValueHandler::EnumValueHandler(IBaseHandler *parent) : m_parent(parent)
+{
+ addEndHandler("enumvalue",this,&EnumValueHandler::endEnumValue);
+
+ addStartHandler("name",this,&EnumValueHandler::startName);
+ addEndHandler("name",this,&EnumValueHandler::endName);
+ addStartHandler("initializer",this,&EnumValueHandler::startInitializer);
+ addEndHandler("initializer",this,&EnumValueHandler::endInitializer);
+}
+
+void EnumValueHandler::startEnumValue(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+}
+
+void EnumValueHandler::endEnumValue()
+{
+ m_parent->setDelegate(0);
+}
+
+void EnumValueHandler::startName(const QXmlAttributes& /*attrib*/)
+{
+ m_curString="";
+}
+
+void EnumValueHandler::endName()
+{
+ m_name = m_curString;
+}
+
+void EnumValueHandler::startInitializer(const QXmlAttributes& /*attrib*/)
+{
+ m_curString="";
+}
+
+void EnumValueHandler::endInitializer()
+{
+ m_initializer = m_curString;
+}
+
+//------------------------------------------------------------------------------
+
+MemberHandler::MemberHandler(IBaseHandler *parent)
+ : m_parent(parent), m_brief(0), m_detailed(0)
+{
+ addEndHandler("memberdef",this,&MemberHandler::endMember);
+
+ addStartHandler("type",this,&MemberHandler::startType);
+ addStartHandler("initializer",this,&MemberHandler::startInitializer);
+ addStartHandler("exception",this,&MemberHandler::startException);
+ addStartHandler("enumvalue",this,&MemberHandler::startEnumValue);
+
+ addStartHandler("name");
+ addEndHandler("name",this,&MemberHandler::endName);
+
+ addStartHandler("param",this,&MemberHandler::startParam);
+
+ addStartHandler("briefdescription",this,&MemberHandler::startBriefDesc);
+
+ addStartHandler("detaileddescription",this,&MemberHandler::startDetailedDesc);
+
+ addStartHandler("references",this,&MemberHandler::startReferences);
+ addEndHandler("references",this,&MemberHandler::endReferences);
+
+ addStartHandler("referencedby",this,&MemberHandler::startReferencedBy);
+ addEndHandler("referencedby",this,&MemberHandler::endReferencedBy);
+
+ addStartHandler("reimplements",this,&MemberHandler::startReimplements);
+ addEndHandler("reimplements",this,&MemberHandler::endReimplements);
+
+ addStartHandler("reimplementedby",this,&MemberHandler::startReimplementedBy);
+ addEndHandler("reimplementedby",this,&MemberHandler::endReimplementedBy);
+
+ addStartHandler("location",this,&MemberHandler::startLocation);
+ addEndHandler("location");
+
+ m_params.setAutoDelete(TRUE);
+ m_references.setAutoDelete(TRUE);
+ m_referencedBy.setAutoDelete(TRUE);
+ m_reimplements = 0;
+ m_reimplementedBy.setAutoDelete(TRUE);
+ m_enumValues.setAutoDelete(TRUE);
+ m_linkedTextHandler = 0;
+ m_defLine=0;
+ m_bodyStart=0;
+ m_bodyEnd=0;
+}
+
+MemberHandler::~MemberHandler()
+{
+ delete m_brief;
+ delete m_detailed;
+ delete m_linkedTextHandler;
+}
+
+void MemberHandler::startMember(const QXmlAttributes& attrib)
+{
+ m_parent->setDelegate(this);
+ m_kind = attrib.value("kind");
+ m_id = attrib.value("id");
+ m_virtualness = attrib.value("virt");
+ m_protection = attrib.value("prot");
+ m_isConst = attrib.value("const")=="yes";
+ m_isVolatile = attrib.value("volatile")=="yes";
+ printf("member kind=`%s' id=`%s' prot=`%s' virt=`%s'\n",
+ m_kind.data(),m_id.data(),m_protection.data(),m_virtualness.data());
+}
+
+void MemberHandler::startBriefDesc(const QXmlAttributes& attrib)
+{
+ DocHandler *docHandler = new DocHandler(this);
+ docHandler->startDoc(attrib);
+ m_brief = docHandler;
+}
+
+void MemberHandler::startDetailedDesc(const QXmlAttributes& attrib)
+{
+ DocHandler *docHandler = new DocHandler(this);
+ docHandler->startDoc(attrib);
+ m_detailed = docHandler;
+}
+
+void MemberHandler::startLocation(const QXmlAttributes& attrib)
+{
+ m_defFile = attrib.value("file");
+ QCString s;
+ s = attrib.value("line");
+ if (!s.isEmpty()) m_defLine=s.toInt();
+ s = attrib.value("bodystart");
+ if (!s.isEmpty()) m_bodyStart=s.toInt();
+ s = attrib.value("bodyend");
+ if (!s.isEmpty()) m_bodyEnd=s.toInt();
+}
+
+void MemberHandler::startReferences(const QXmlAttributes& attrib)
+{
+ MemberReference *mr = new MemberReference;
+ mr->m_memId = attrib.value("id");
+ m_references.append(mr);
+ m_curString="";
+}
+
+void MemberHandler::endReferences()
+{
+ m_references.getLast()->m_name = m_curString;
+}
+
+void MemberHandler::startReferencedBy(const QXmlAttributes& attrib)
+{
+ MemberReference *mr = new MemberReference;
+ mr->m_memId = attrib.value("id");
+ m_referencedBy.append(mr);
+ m_curString="";
+}
+
+void MemberHandler::endReferencedBy()
+{
+ m_referencedBy.getLast()->m_name = m_curString;
+}
+
+void MemberHandler::startReimplements(const QXmlAttributes& attrib)
+{
+ m_reimplements = new MemberReference;
+ m_reimplements->m_memId = attrib.value("id");
+ m_curString="";
+}
+
+void MemberHandler::endReimplements()
+{
+ m_reimplements->m_name = m_curString;
+}
+
+void MemberHandler::startReimplementedBy(const QXmlAttributes& attrib)
+{
+ MemberReference *mr = new MemberReference;
+ mr->m_memId = attrib.value("id");
+ m_reimplementedBy.append(mr);
+ m_curString="";
+}
+
+void MemberHandler::endReimplementedBy()
+{
+ m_reimplementedBy.getLast()->m_name = m_curString;
+}
+
+void MemberHandler::endMember()
+{
+ m_parent->setDelegate(0);
+}
+
+void MemberHandler::startType(const QXmlAttributes &)
+{
+ printf("startType!\n");
+ delete m_linkedTextHandler;
+ m_linkedTextHandler = new LinkedTextHandler(this,m_type);
+ m_linkedTextHandler->start("type");
+}
+
+void MemberHandler::startInitializer(const QXmlAttributes &)
+{
+ printf("startInitializer!\n");
+ delete m_linkedTextHandler;
+ m_linkedTextHandler = new LinkedTextHandler(this,m_initializer);
+ m_linkedTextHandler->start("initializer");
+}
+
+void MemberHandler::startException(const QXmlAttributes &)
+{
+ printf("startException!\n");
+ delete m_linkedTextHandler;
+ m_linkedTextHandler = new LinkedTextHandler(this,m_exception);
+ m_linkedTextHandler->start("exception");
+}
+
+void MemberHandler::endName()
+{
+ m_name = m_curString.stripWhiteSpace();
+ printf("member name=`%s'\n",m_name.data());
+}
+
+void MemberHandler::startParam(const QXmlAttributes& attrib)
+{
+ ParamHandler *paramHandler = new ParamHandler(this);
+ paramHandler->startParam(attrib);
+ m_params.append(paramHandler);
+}
+
+void MemberHandler::startEnumValue(const QXmlAttributes& attrib)
+{
+ EnumValueHandler *evh = new EnumValueHandler(this);
+ evh->startEnumValue(attrib);
+ m_enumValues.append(evh);
+}
+
+void MemberHandler::initialize(MainHandler *mh)
+{
+ {
+ QListIterator<MemberReference> mli(m_references);
+ MemberReference *mr;
+ for (;(mr=mli.current());++mli)
+ {
+ mr->initialize(mh);
+ }
+ }
+ {
+ QListIterator<MemberReference> mli(m_referencedBy);
+ MemberReference *mr;
+ for (;(mr=mli.current());++mli)
+ {
+ mr->initialize(mh);
+ }
+ }
+ {
+ QListIterator<MemberReference> mli(m_reimplementedBy);
+ MemberReference *mr;
+ for (;(mr=mli.current());++mli)
+ {
+ mr->initialize(mh);
+ }
+ }
+ if (m_reimplements) m_reimplements->initialize(mh);
+}
+
diff --git a/addon/doxmlparser/src/memberhandler.h b/addon/doxmlparser/src/memberhandler.h
new file mode 100644
index 0000000..b599e2f
--- /dev/null
+++ b/addon/doxmlparser/src/memberhandler.h
@@ -0,0 +1,193 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#ifndef _MEMBERHANDLER_H
+#define _MEMBERHANDLER_H
+
+#include <qstring.h>
+#include <qlist.h>
+#include <qxml.h>
+#include <doxmlintf.h>
+
+#include "basehandler.h"
+#include "baseiterator.h"
+#include "paramhandler.h"
+#include "linkedtexthandler.h"
+#include "dochandler.h"
+
+class MainHandler;
+
+struct MemberReference : public IMemberReference
+{
+ virtual ~MemberReference() {}
+ virtual IMember *member() const;
+ virtual QString memberName() const { return m_name; }
+ void initialize(MainHandler *m);
+
+ QString m_memId;
+ QString m_name;
+ MainHandler *m_mainHandler;
+};
+
+class MemberReferenceIterator : public BaseIterator<IMemberReferenceIterator,IMemberReference,MemberReference>
+{
+ public:
+ MemberReferenceIterator(const QList<MemberReference> &list) :
+ BaseIterator<IMemberReferenceIterator,IMemberReference,MemberReference>(list) {}
+};
+
+class MemberIterator : public BaseIterator<IMemberIterator,IMember,IMember>
+{
+ public:
+ MemberIterator(const QList<IMember> &list) :
+ BaseIterator<IMemberIterator,IMember,IMember>(list) {}
+};
+
+class EnumValueHandler : public IEnumValue, public BaseHandler<EnumValueHandler>
+{
+ public:
+ virtual void startName(const QXmlAttributes& attrib);
+ virtual void endName();
+ virtual void startInitializer(const QXmlAttributes& attrib);
+ virtual void endInitializer();
+ virtual void startEnumValue(const QXmlAttributes& attrib);
+ virtual void endEnumValue();
+
+ // IEnumValue
+ virtual QString name() const { return m_name; }
+ virtual QString initializer() const { return m_initializer; }
+
+ void setName(const QString &name) { m_name=name; }
+ void setInitializer(const QString &init) { m_initializer=init; }
+
+ virtual ~EnumValueHandler() {}
+ EnumValueHandler(IBaseHandler *parent);
+
+ private:
+ QString m_name;
+ QString m_initializer;
+ IBaseHandler *m_parent;
+};
+
+class EnumValueIterator : public BaseIterator<IEnumValueIterator,IEnumValue,EnumValueHandler>
+{
+ public:
+ EnumValueIterator(const QList<EnumValueHandler> &list) :
+ BaseIterator<IEnumValueIterator,IEnumValue,EnumValueHandler>(list) {}
+};
+
+
+class MemberHandler : public IMember, public BaseHandler<MemberHandler>
+{
+ public:
+ virtual void startMember(const QXmlAttributes& attrib);
+ virtual void endMember();
+ virtual void startParam(const QXmlAttributes& attrib);
+ virtual void startType(const QXmlAttributes& attrib);
+ virtual void endName();
+ virtual void startBriefDesc(const QXmlAttributes& attrib);
+ virtual void startDetailedDesc(const QXmlAttributes& attrib);
+ virtual void startLocation(const QXmlAttributes& attrib);
+ virtual void startReferences(const QXmlAttributes& attrib);
+ virtual void endReferences();
+ virtual void startReferencedBy(const QXmlAttributes& attrib);
+ virtual void endReferencedBy();
+ virtual void startReimplements(const QXmlAttributes& attrib);
+ virtual void endReimplements();
+ virtual void startReimplementedBy(const QXmlAttributes& attrib);
+ virtual void endReimplementedBy();
+ virtual void startInitializer(const QXmlAttributes& attrib);
+ virtual void startException(const QXmlAttributes& attrib);
+ virtual void startEnumValue(const QXmlAttributes& attrib);
+
+ MemberHandler(IBaseHandler *parent);
+ virtual ~MemberHandler();
+
+ // IMember implementation
+ virtual QString kind() const
+ { return m_kind; }
+ virtual QString id() const
+ { return m_id; }
+ virtual QString protection() const
+ { return m_protection; }
+ virtual QString virtualness() const
+ { return m_virtualness; }
+ virtual QString name() const
+ { return m_name; }
+ virtual bool isConst() const
+ { return m_isConst; }
+ virtual bool isVolatile() const
+ { return m_isVolatile; }
+ virtual ILinkedTextIterator *type() const
+ { return new LinkedTextIterator(m_type); }
+ virtual IParamIterator *params() const
+ { return new ParamIterator(m_params); }
+ virtual IMemberReferenceIterator *references() const
+ { return new MemberReferenceIterator(m_references); }
+ virtual IMemberReferenceIterator *referencedBy() const
+ { return new MemberReferenceIterator(m_referencedBy); }
+ virtual ILinkedTextIterator *initializer() const
+ { return new LinkedTextIterator(m_initializer); }
+ virtual ILinkedTextIterator *exceptions() const
+ { return new LinkedTextIterator(m_exception); }
+ virtual int bodyStart() const
+ { return m_bodyStart; }
+ virtual int bodyEnd() const
+ { return m_bodyEnd; }
+ virtual QString definitionFile() const
+ { return m_defFile; }
+ virtual int definitionLine() const
+ { return m_defLine; }
+ virtual IMemberReference *reimplements() const
+ { return m_reimplements; }
+ virtual IMemberReferenceIterator *reimplementedBy() const
+ { return new MemberReferenceIterator(m_reimplementedBy); }
+ virtual IEnumValueIterator *enumValues() const
+ { return new EnumValueIterator(m_enumValues); }
+ virtual IDocRoot *briefDescription() const
+ { return m_brief; }
+ virtual IDocRoot *detailedDescription() const
+ { return m_detailed; }
+
+ void initialize(MainHandler *m);
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_kind;
+ QString m_id;
+ QString m_protection;
+ QString m_virtualness;
+ QList<ILinkedText> m_type;
+ QList<ILinkedText> m_initializer;
+ QList<ILinkedText> m_exception;
+ QString m_name;
+ DocHandler *m_brief;
+ DocHandler *m_detailed;
+ QList<IParam> m_params;
+ QList<MemberReference> m_references;
+ QList<MemberReference> m_referencedBy;
+ MemberReference *m_reimplements;
+ QList<MemberReference> m_reimplementedBy;
+ QString m_defFile;
+ int m_defLine;
+ int m_bodyStart;
+ int m_bodyEnd;
+ bool m_isConst;
+ bool m_isVolatile;
+ LinkedTextHandler *m_linkedTextHandler;
+ QList<EnumValueHandler> m_enumValues;
+};
+
+#endif
diff --git a/addon/doxmlparser/src/paramhandler.cpp b/addon/doxmlparser/src/paramhandler.cpp
new file mode 100644
index 0000000..0cf00e4
--- /dev/null
+++ b/addon/doxmlparser/src/paramhandler.cpp
@@ -0,0 +1,98 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#include "paramhandler.h"
+#include "memberhandler.h"
+
+ParamHandler::ParamHandler(IBaseHandler *parent) : m_parent(parent)
+{
+ addEndHandler("param",this,&ParamHandler::endParam);
+
+ addStartHandler("type",this,&ParamHandler::startType);
+
+ addStartHandler("declname");
+ addEndHandler("declname",this,&ParamHandler::endDeclName);
+
+ addStartHandler("defname");
+ addEndHandler("defname",this,&ParamHandler::endDefName);
+
+ addStartHandler("array");
+ addEndHandler("array",this,&ParamHandler::endArray);
+
+ addStartHandler("attrib");
+ addEndHandler("attrib",this,&ParamHandler::endAttrib);
+
+ addStartHandler("defval",this,&ParamHandler::startDefVal);
+
+ m_linkedTextHandler = 0;
+}
+
+ParamHandler::~ParamHandler()
+{
+}
+
+void ParamHandler::startParam(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("param\n");
+}
+
+void ParamHandler::endParam()
+{
+ m_parent->setDelegate(0);
+}
+
+void ParamHandler::startType(const QXmlAttributes& /*attrib*/)
+{
+ delete m_linkedTextHandler;
+ m_linkedTextHandler = new LinkedTextHandler(this,m_type);
+ m_linkedTextHandler->start("type");
+ printf("param type\n");
+}
+
+void ParamHandler::endDeclName()
+{
+ m_declName = m_curString.stripWhiteSpace();
+ printf("member declName=`%s'\n",m_declName.data());
+}
+
+void ParamHandler::endDefName()
+{
+ m_defName = m_curString.stripWhiteSpace();
+ printf("member defName=`%s'\n",m_defName.data());
+}
+
+void ParamHandler::endAttrib()
+{
+ m_attrib = m_curString.stripWhiteSpace();
+ printf("member attrib=`%s'\n",m_attrib.data());
+}
+
+void ParamHandler::endArray()
+{
+ m_array = m_curString.stripWhiteSpace();
+ printf("member array=`%s'\n",m_array.data());
+}
+
+void ParamHandler::startDefVal(const QXmlAttributes& /*attrib*/)
+{
+ delete m_linkedTextHandler;
+ m_linkedTextHandler = new LinkedTextHandler(this,m_defVal);
+ m_linkedTextHandler->start("type");
+ printf("member defVal\n");
+}
+
+
+
diff --git a/addon/doxmlparser/src/paramhandler.h b/addon/doxmlparser/src/paramhandler.h
new file mode 100644
index 0000000..6725a5e
--- /dev/null
+++ b/addon/doxmlparser/src/paramhandler.h
@@ -0,0 +1,71 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#ifndef _PARAMHANDLER_H
+#define _PARAMHANDLER_H
+
+#include <qstring.h>
+#include <qlist.h>
+#include <qxml.h>
+#include <doxmlintf.h>
+
+#include "basehandler.h"
+#include "baseiterator.h"
+#include "linkedtexthandler.h"
+
+class ParamIterator : public BaseIterator<IParamIterator,IParam,IParam>
+{
+ public:
+ ParamIterator(const QList<IParam> &list) :
+ BaseIterator<IParamIterator,IParam,IParam>(list) {}
+};
+
+class ParamHandler : public IParam, public BaseHandler<ParamHandler>
+{
+ public:
+ virtual void startParam(const QXmlAttributes& attrib);
+ virtual void endParam();
+ virtual void startType(const QXmlAttributes& attrib);
+ virtual void endDeclName();
+ virtual void endDefName();
+ virtual void endAttrib();
+ virtual void endArray();
+ virtual void startDefVal(const QXmlAttributes& attrib);
+
+ ParamHandler(IBaseHandler *parent);
+ virtual ~ParamHandler();
+
+ // IParam
+ virtual ILinkedTextIterator *type() const
+ { return new LinkedTextIterator(m_type); }
+ virtual QString declarationName() const { return m_declName; }
+ virtual QString definitionName() const { return m_defName; }
+ virtual QString attrib() const { return m_attrib; }
+ virtual QString arraySpecifier() const { return m_array; }
+ virtual ILinkedTextIterator *defaultValue() const
+ { return new LinkedTextIterator(m_defVal); }
+
+ private:
+ IBaseHandler *m_parent;
+ QList<ILinkedText> m_type;
+ QString m_declName;
+ QString m_defName;
+ QString m_attrib;
+ QString m_array;
+ QList<ILinkedText> m_defVal;
+ LinkedTextHandler *m_linkedTextHandler;
+};
+
+#endif
diff --git a/addon/doxmlparser/src/sectionhandler.cpp b/addon/doxmlparser/src/sectionhandler.cpp
new file mode 100644
index 0000000..d1c7b1f
--- /dev/null
+++ b/addon/doxmlparser/src/sectionhandler.cpp
@@ -0,0 +1,61 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#include "mainhandler.h"
+#include "compoundhandler.h"
+#include "sectionhandler.h"
+
+SectionHandler::SectionHandler(IBaseHandler *parent) : m_parent(parent)
+{
+ m_members.setAutoDelete(TRUE);
+ addEndHandler("sectiondef",this,&SectionHandler::endSection);
+ addStartHandler("memberdef",this,&SectionHandler::startMember);
+}
+
+SectionHandler::~SectionHandler()
+{
+}
+
+void SectionHandler::startSection(const QXmlAttributes& attrib)
+{
+ m_parent->setDelegate(this);
+ m_kind = attrib.value("kind");
+ printf("section kind=`%s'\n",m_kind.data());
+}
+
+void SectionHandler::endSection()
+{
+ m_parent->setDelegate(0);
+}
+
+void SectionHandler::startMember(const QXmlAttributes& attrib)
+{
+ MemberHandler *memHandler = new MemberHandler(this);
+ memHandler->startMember(attrib);
+ m_members.append(memHandler);
+}
+
+void SectionHandler::initialize(MainHandler *m)
+{
+ QListIterator<IMember> mli(m_members);
+ MemberHandler *mh;
+ for (;(mh=(MemberHandler *)mli.current());++mli)
+ {
+ m->insertMemberById(mh->id(),mh);
+ m->insertMemberByName(mh->name(),mh);
+ }
+}
+
+
diff --git a/addon/doxmlparser/src/sectionhandler.h b/addon/doxmlparser/src/sectionhandler.h
new file mode 100644
index 0000000..234cce1
--- /dev/null
+++ b/addon/doxmlparser/src/sectionhandler.h
@@ -0,0 +1,62 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#ifndef _SECTIONHANDLER_H
+#define _SECTIONHANDLER_H
+
+#include <qstring.h>
+#include <qlist.h>
+#include <qxml.h>
+#include <doxmlintf.h>
+
+#include "basehandler.h"
+#include "memberhandler.h"
+
+class MainHandler;
+
+
+class SectionIterator :
+ public BaseIterator<ISectionIterator,ISection,ISection>
+{
+ public:
+ SectionIterator(const QList<ISection> &list) :
+ BaseIterator<ISectionIterator,ISection,ISection>(list) {}
+};
+
+
+class SectionHandler : public ISection, public BaseHandler<SectionHandler>
+{
+ public:
+ virtual void startMember(const QXmlAttributes& attrib);
+ virtual void startSection(const QXmlAttributes& attrib);
+ virtual void endSection();
+
+ SectionHandler(IBaseHandler *parent);
+ virtual ~SectionHandler();
+
+ // ISection
+ virtual QString kind() const { return m_kind; }
+ virtual IMemberIterator *members() const
+ { return new MemberIterator(m_members); }
+
+ void initialize(MainHandler *m);
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_kind;
+ QList<IMember> m_members;
+};
+
+#endif