summaryrefslogtreecommitdiffstats
path: root/addon
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2001-09-23 17:28:38 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2001-09-23 17:28:38 (GMT)
commit86502f97ecaea3254217d723b5f10b6405495184 (patch)
tree66859557d84fe96d692e8d6ee0a72d639a25b283 /addon
parent4ce0e4344711a79781e2f6d64f2553ab4b45c4a5 (diff)
downloadDoxygen-86502f97ecaea3254217d723b5f10b6405495184.zip
Doxygen-86502f97ecaea3254217d723b5f10b6405495184.tar.gz
Doxygen-86502f97ecaea3254217d723b5f10b6405495184.tar.bz2
Release-1.2.10-20010923
Diffstat (limited to 'addon')
-rw-r--r--addon/doxywizard/README5
-rw-r--r--addon/xmlparse/Doxyfile2
-rw-r--r--addon/xmlparse/basehandler.h12
-rw-r--r--addon/xmlparse/compoundhandler.h16
-rw-r--r--addon/xmlparse/dochandler.cpp289
-rw-r--r--addon/xmlparse/dochandler.h151
-rw-r--r--addon/xmlparse/doxmlintf.h63
-rw-r--r--addon/xmlparse/main.cpp108
-rw-r--r--addon/xmlparse/mainhandler.cpp43
-rw-r--r--addon/xmlparse/mainhandler.h17
-rw-r--r--addon/xmlparse/memberhandler.h15
-rw-r--r--addon/xmlparse/paramhandler.h12
-rw-r--r--addon/xmlparse/sectionhandler.h10
13 files changed, 635 insertions, 108 deletions
diff --git a/addon/doxywizard/README b/addon/doxywizard/README
index e265c2e..883b93a 100644
--- a/addon/doxywizard/README
+++ b/addon/doxywizard/README
@@ -1,2 +1,7 @@
Doxywizard is a graphical front-end to read/edit/write doxygen configuration
files. It requires Qt version 2.1.0 or higher.
+
+As a special exception, Dimitri van Heesch gives permission to link this
+program with Qt non-commercial edition, and distribute the resulting
+executable, without including the source code for the Qt non-commercial
+edition in the source distribution.
diff --git a/addon/xmlparse/Doxyfile b/addon/xmlparse/Doxyfile
index 7899f6b..c711577 100644
--- a/addon/xmlparse/Doxyfile
+++ b/addon/xmlparse/Doxyfile
@@ -71,7 +71,7 @@ IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
-GENERATE_HTML = YES
+GENERATE_HTML = NO
HTML_OUTPUT =
HTML_HEADER =
HTML_FOOTER =
diff --git a/addon/xmlparse/basehandler.h b/addon/xmlparse/basehandler.h
index 3c64d42..33b8831 100644
--- a/addon/xmlparse/basehandler.h
+++ b/addon/xmlparse/basehandler.h
@@ -190,6 +190,17 @@ template<class T> class BaseHandler : public IBaseHandler,
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;
+ }
virtual bool characters ( const QString & ch )
{
@@ -198,6 +209,7 @@ template<class T> class BaseHandler : public IBaseHandler,
return m_delegateHandler->characters(ch);
}
+ //printf("Found characters \"%s\"\n",ch.data());
m_curString+=ch;
return TRUE;
}
diff --git a/addon/xmlparse/compoundhandler.h b/addon/xmlparse/compoundhandler.h
index 29556a0..7d7c9b9 100644
--- a/addon/xmlparse/compoundhandler.h
+++ b/addon/xmlparse/compoundhandler.h
@@ -21,10 +21,11 @@
#include "basehandler.h"
#include "sectionhandler.h"
+#include "doxmlintf.h"
class DocHandler;
-class CompoundHandler : public BaseHandler<CompoundHandler>
+class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler>
{
public:
virtual void startSection(const QXmlAttributes& attrib);
@@ -38,6 +39,13 @@ class CompoundHandler : public BaseHandler<CompoundHandler>
CompoundHandler(IBaseHandler *parent);
virtual ~CompoundHandler();
+
+ // ICompound
+ QString name() const { return m_name; }
+ QString id() const { return m_id; }
+ QString kind() const { return m_kind; }
+ QListIterator<ISection> getSectionIterator() const { return m_sections; }
+
private:
struct SuperClass
{
@@ -57,9 +65,9 @@ class CompoundHandler : public BaseHandler<CompoundHandler>
QString m_protection;
QString m_virtualness;
};
- QList<SuperClass> m_superClasses;
- QList<SubClass> m_subClasses;
- QList<SectionHandler> m_sections;
+ QList<SuperClass> m_superClasses;
+ QList<SubClass> m_subClasses;
+ QList<ISection> m_sections;
IBaseHandler *m_parent;
DocHandler *m_brief;
DocHandler *m_detailed;
diff --git a/addon/xmlparse/dochandler.cpp b/addon/xmlparse/dochandler.cpp
index 29e8799..8506d25 100644
--- a/addon/xmlparse/dochandler.cpp
+++ b/addon/xmlparse/dochandler.cpp
@@ -373,14 +373,147 @@ void ParameterListHandler::startParameterDescription(const QXmlAttributes& attri
}
//----------------------------------------------------------------------
+// LineBreakHandler
+//----------------------------------------------------------------------
+
+LineBreakHandler::LineBreakHandler(IBaseHandler *parent)
+ : DocNode(LineBreak), m_parent(parent)
+{
+}
+
+LineBreakHandler::~LineBreakHandler()
+{
+}
+
+void LineBreakHandler::startLineBreak(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ addEndHandler("linebreak",this,&LineBreakHandler::endLineBreak);
+ printf("Start linebreak\n");
+}
+
+void LineBreakHandler::endLineBreak()
+{
+ m_parent->setDelegate(0);
+ printf("End linebreak\n");
+}
+
+//----------------------------------------------------------------------
+// HRulerHandler
+//----------------------------------------------------------------------
+
+HRulerHandler::HRulerHandler(IBaseHandler *parent)
+ : DocNode(HRuler), m_parent(parent)
+{
+}
+
+HRulerHandler::~HRulerHandler()
+{
+}
+
+void HRulerHandler::startHRuler(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ addEndHandler("hruler",this,&HRulerHandler::endHRuler);
+ printf("Start hruler\n");
+}
+
+void HRulerHandler::endHRuler()
+{
+ m_parent->setDelegate(0);
+ printf("End hruler\n");
+}
+
+//----------------------------------------------------------------------
+// RefHandler
+//----------------------------------------------------------------------
+
+RefHandler::RefHandler(IBaseHandler *parent)
+ : DocNode(Ref), m_parent(parent)
+{
+}
+
+RefHandler::~RefHandler()
+{
+}
+
+void RefHandler::startRef(const QXmlAttributes& attrib)
+{
+ m_parent->setDelegate(this);
+ addEndHandler("ref",this,&RefHandler::endRef);
+ 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\n");
+}
+
+
+//----------------------------------------------------------------------
+// TitleHandler
+//----------------------------------------------------------------------
+
+TitleHandler::TitleHandler(IBaseHandler *parent)
+ : DocNode(Title), m_parent(parent)
+{
+ m_children.setAutoDelete(TRUE);
+ m_markupHandler = new MarkupHandler(m_children,m_curString);
+ setFallBackHandler(m_markupHandler);
+ addStartHandler("ref",this,&TitleHandler::startRef);
+}
+
+TitleHandler::~TitleHandler()
+{
+ delete m_markupHandler;
+}
+
+void TitleHandler::startTitle(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ addEndHandler("title",this,&TitleHandler::endTitle);
+ 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);
+}
+
+//----------------------------------------------------------------------
// SimpleSectHandler
//----------------------------------------------------------------------
SimpleSectHandler::SimpleSectHandler(IBaseHandler *parent)
- : DocNode(Para), m_parent(parent), m_paragraph(0)
+ : DocNode(Para), m_parent(parent), m_paragraph(0), m_title(0)
{
addStartHandler("title",this,&SimpleSectHandler::startTitle);
- addEndHandler("title",this,&SimpleSectHandler::endTitle);
addStartHandler("para",this,&SimpleSectHandler::startParagraph);
}
@@ -402,24 +535,124 @@ void SimpleSectHandler::endSimpleSect()
m_parent->setDelegate(0);
}
-void SimpleSectHandler::startTitle(const QXmlAttributes& /*attrib*/)
+void SimpleSectHandler::startTitle(const QXmlAttributes& attrib)
{
- m_curString="";
+ 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)
+ : DocNode(VariableListEntry), m_parent(parent), m_description(0)
+{
+ addStartHandler("term",this,&VariableListEntryHandler::startTerm);
+ addEndHandler("term",this,&VariableListEntryHandler::endTerm);
+ addStartHandler("para",this,&VariableListEntryHandler::startParagraph);
+}
+
+VariableListEntryHandler::~VariableListEntryHandler()
+{
+ delete m_description;
+}
+
+void VariableListEntryHandler::startVarListEntry(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("start varlistentry\n");
+ addEndHandler("varlistentry",this,&VariableListEntryHandler::endVarListEntry);
}
-void SimpleSectHandler::endTitle()
+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");
+ addEndHandler("listitem",this,&VariableListEntryHandler::endListItem);
+}
+
+void VariableListEntryHandler::endListItem()
+{
+ m_parent->setDelegate(0);
+ printf("end listitem\n");
+}
+
+void VariableListEntryHandler::startTerm(const QXmlAttributes& /*attrib*/)
{
- printf("simpleSect title=\"%s\"\n",m_curString.data());
- m_title = m_curString;
m_curString="";
}
+void VariableListEntryHandler::endTerm()
+{
+ m_term = m_curString;
+ printf("term=%s\n",m_term.data());
+}
-void SimpleSectHandler::startParagraph(const QXmlAttributes& attrib)
+void VariableListEntryHandler::startParagraph(const QXmlAttributes& attrib)
{
- ASSERT(m_paragraph==0);
- m_paragraph = new ParagraphHandler(this);
- m_paragraph->startParagraph(attrib);
+ ASSERT(m_description==0);
+ m_description = new ParagraphHandler(this);
+ m_description->startParagraph(attrib);
+}
+
+
+
+//----------------------------------------------------------------------
+// VariableListHandler
+//----------------------------------------------------------------------
+
+VariableListHandler::VariableListHandler(IBaseHandler *parent)
+ : DocNode(VariableList), m_parent(parent)
+{
+ m_entries.setAutoDelete(TRUE);
+ addStartHandler("varlistentry",this,&VariableListHandler::startVarListEntry);
+ addStartHandler("listitem",this,&VariableListHandler::startListItem);
+}
+
+VariableListHandler::~VariableListHandler()
+{
+}
+
+void VariableListHandler::startVariableList(const QXmlAttributes& /*attrib*/)
+{
+ m_parent->setDelegate(this);
+ printf("start variablelist\n");
+ addEndHandler("variablelist",this,&VariableListHandler::endVariableList);
+}
+
+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);
}
//----------------------------------------------------------------------
@@ -440,6 +673,10 @@ ParagraphHandler::ParagraphHandler(IBaseHandler *parent)
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);
}
ParagraphHandler::~ParagraphHandler()
@@ -492,12 +729,40 @@ void ParagraphHandler::startSimpleSect(const QXmlAttributes& attrib)
m_children.append(sectHandler);
}
+void ParagraphHandler::startRef(const QXmlAttributes& attrib)
+{
+ RefHandler *ref = new RefHandler(this);
+ ref->startRef(attrib);
+ m_children.append(ref);
+}
+
+void ParagraphHandler::startVariableList(const QXmlAttributes& attrib)
+{
+ VariableListHandler *vl = new VariableListHandler(this);
+ vl->startVariableList(attrib);
+ m_children.append(vl);
+}
+
+void ParagraphHandler::startHRuler(const QXmlAttributes& attrib)
+{
+ HRulerHandler *hr = new HRulerHandler(this);
+ hr->startHRuler(attrib);
+ m_children.append(hr);
+}
+
+void ParagraphHandler::startLineBreak(const QXmlAttributes& attrib)
+{
+ LineBreakHandler *lb = new LineBreakHandler(this);
+ lb->startLineBreak(attrib);
+ m_children.append(lb);
+}
+
void ParagraphHandler::addTextNode()
{
if (!m_curString.isEmpty())
{
m_children.append(new TextNode(m_curString,m_markupHandler->markup()));
- printf("addTextNode() text=%s markup=%x\n",
+ printf("addTextNode() text=\"%s\" markup=%x\n",
m_curString.data(),m_markupHandler->markup());
m_curString="";
}
diff --git a/addon/xmlparse/dochandler.h b/addon/xmlparse/dochandler.h
index 4dc50c5..c805371 100644
--- a/addon/xmlparse/dochandler.h
+++ b/addon/xmlparse/dochandler.h
@@ -53,7 +53,13 @@ class DocNode
ListItem,
ParameterList,
Parameter,
- SimpleSect
+ SimpleSect,
+ Title,
+ Ref,
+ VariableList,
+ VariableListEntry,
+ HRuler,
+ LineBreak
};
DocNode(NodeKind k) : m_kind(k) {}
virtual ~DocNode() {}
@@ -223,6 +229,85 @@ class ParameterListHandler : public DocNode,
//-----------------------------------------------------------------------------
+/* \brief Node representing a horizontal ruler
+ *
+ */
+class LineBreakHandler : public DocNode, public BaseHandler<LineBreakHandler>
+{
+ public:
+ LineBreakHandler(IBaseHandler *parent);
+ virtual ~LineBreakHandler();
+
+ void startLineBreak(const QXmlAttributes& attrib);
+ void endLineBreak();
+
+ private:
+ IBaseHandler *m_parent;
+};
+
+//-----------------------------------------------------------------------------
+
+/* \brief Node representing a horizontal ruler
+ *
+ */
+class HRulerHandler : public DocNode, public BaseHandler<HRulerHandler>
+{
+ public:
+ HRulerHandler(IBaseHandler *parent);
+ virtual ~HRulerHandler();
+
+ void startHRuler(const QXmlAttributes& attrib);
+ void endHRuler();
+
+ private:
+ IBaseHandler *m_parent;
+};
+
+//-----------------------------------------------------------------------------
+
+/* \brief Node representing a reference to another item
+ *
+ */
+class RefHandler : public DocNode, public BaseHandler<RefHandler>
+{
+ public:
+ RefHandler(IBaseHandler *parent);
+ virtual ~RefHandler();
+ void startRef(const QXmlAttributes& attrib);
+ void endRef();
+ private:
+ IBaseHandler *m_parent;
+ QCString m_refId;
+ QCString m_anchor;
+ QCString 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 DocNode, public BaseHandler<TitleHandler>
+{
+ public:
+ TitleHandler(IBaseHandler *parent);
+ virtual ~TitleHandler();
+ virtual void startTitle(const QXmlAttributes& attrib);
+ virtual void endTitle();
+ virtual void startRef(const QXmlAttributes& attrib);
+ void addTextNode();
+ private:
+ IBaseHandler *m_parent;
+ QList<DocNode> m_children;
+ MarkupHandler *m_markupHandler;
+};
+
+//-----------------------------------------------------------------------------
+
/* \brief Node representing a simple section with an unnumbered header.
*
*/
@@ -244,15 +329,58 @@ class SimpleSectHandler : public DocNode,
virtual void startSimpleSect(const QXmlAttributes& attrib);
virtual void endSimpleSect();
virtual void startTitle(const QXmlAttributes& attrib);
- virtual void endTitle();
virtual void startParagraph(const QXmlAttributes& attrib);
private:
IBaseHandler *m_parent;
ParagraphHandler *m_paragraph;
Types m_type;
- // TODO: a title can also contain links (for todo sections for instance!)
- QString m_title;
+ TitleHandler *m_title;
+};
+
+//-----------------------------------------------------------------------------
+
+class VariableListEntryHandler : public DocNode, 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();
+
+ private:
+ IBaseHandler *m_parent;
+ QString m_term;
+ ParagraphHandler *m_description;
+};
+
+//-----------------------------------------------------------------------------
+
+/*! \brief Node representing a list of named items.
+ *
+ */
+// children: varlistentry, listitem
+class VariableListHandler : public DocNode, 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();
+
+ private:
+ IBaseHandler *m_parent;
+ QList<VariableListEntryHandler> m_entries;
+ VariableListEntryHandler *m_curEntry;
};
//-----------------------------------------------------------------------------
@@ -260,10 +388,13 @@ class SimpleSectHandler : public DocNode,
/*! \brief Node representing a paragraph of text and commands.
*
*/
-// children: itemizedlist, orderedlist, parameterlist, simplesect,
-// programlisting, hruler, variablelist,
-// linebreak, nonbreakablespace, ref, ulink, email,
-// table, link, indexentry, formula, image, dotfile, ref
+// children: itemizedlist, orderedlist, parameterlist, simplesect, ref,
+// variablelist, hruler, linebreak,
+// TODO:
+// ulink, email, link
+// table,
+// programlisting,
+// indexentry, formula, image, dotfile
// children handled by MarkupHandler:
// bold, computeroutput, emphasis, center,
// small, subscript, superscript.
@@ -276,6 +407,10 @@ class ParagraphHandler : public DocNode, public BaseHandler<ParagraphHandler>
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);
ParagraphHandler(IBaseHandler *parent);
virtual ~ParagraphHandler();
diff --git a/addon/xmlparse/doxmlintf.h b/addon/xmlparse/doxmlintf.h
new file mode 100644
index 0000000..50acb79
--- /dev/null
+++ b/addon/xmlparse/doxmlintf.h
@@ -0,0 +1,63 @@
+#ifndef _DOXMLINTF_H
+#define _DOXMLINTF_H
+
+#include <qlist.h>
+#include <qstring.h>
+
+class IParam
+{
+ public:
+ virtual QString type() const = 0;
+ virtual QString declarationName() const = 0;
+ virtual QString definitionName() const = 0;
+ virtual QString attrib() const = 0;
+ virtual QString arraySpecifier() const = 0;
+ virtual QString defaultValue() const = 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 QString type() const = 0;
+ virtual QString name() const = 0;
+ virtual QListIterator<IParam> getParamIterator() const = 0;
+};
+
+class ISection
+{
+ public:
+ virtual QString kind() const = 0;
+ virtual QListIterator<IMember> getMemberIterator() const = 0;
+};
+
+class ICompound
+{
+ public:
+ virtual QString name() const = 0;
+ virtual QString id() const = 0;
+ virtual QString kind() const = 0;
+ virtual QListIterator<ISection> getSectionIterator() const = 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 QListIterator<ICompound> getCompoundIterator() const = 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/xmlparse/main.cpp b/addon/xmlparse/main.cpp
index 44c5e36..081b0d7 100644
--- a/addon/xmlparse/main.cpp
+++ b/addon/xmlparse/main.cpp
@@ -13,95 +13,53 @@
*
*/
-#include "mainhandler.h"
-
-#include <qstring.h>
-#include <qxml.h>
-#include <qfile.h>
-#include <qdict.h>
-#include <qlist.h>
-
-//#define USE_DOM
-#define USE_SAX
-
-#ifdef USE_DOM
-#include <qdom.h>
-#endif
-
-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;
-};
+#include <stdio.h>
+#include "doxmlintf.h"
int main(int argc,char **argv)
{
- if (argc==1)
+ if (argc!=2)
{
printf("Usage: %s file.xml\n",argv[0]);
exit(1);
}
- QFile xmlFile(argv[1]);
-
-#ifdef USE_SAX
- MainHandler handler;
- ErrorHandler errorHandler;
- QXmlInputSource source( xmlFile );
- QXmlSimpleReader reader;
- reader.setContentHandler( &handler );
- reader.setErrorHandler( &errorHandler );
- reader.parse( source );
-#endif
-
-#ifdef USE_DOM
- if (!xmlFile.open( IO_ReadOnly ))
- {
- qFatal("Could not read %s",argv[1] );
- }
- QDomDocument doc;
- doc.setContent( &xmlFile );
-
- QDomElement de = doc.documentElement();
-
- printf("docElem=%s\n",de.tagName().data());
+ IDoxygen *dox = createObjectModelFromXML(argv[1]);
- QDomNode n = de.firstChild();
- while( !n.isNull() )
{
- QDomElement e = n.toElement(); // try to convert the node to an element.
- if( !e.isNull() )
- { // the node was really an element.
- printf("direct child %s id=%s kind=%s\n",
- e.tagName().data(),
- e.attribute("id").data(),
- e.attribute("kind").data()
- );
+ QListIterator<ICompound> cli(dox->getCompoundIterator());
+ ICompound *comp;
+ printf("--- compound list ---------\n");
+ for (cli.toFirst();(comp=cli.current());++cli)
+ {
+ printf("Compound name=%s id=%s kind=%s\n",
+ comp->name().data(),comp->id().data(),comp->kind().data());
+ QListIterator<ISection> sli(comp->getSectionIterator());
+ ISection *sec;
+ for (sli.toFirst();(sec=sli.current());++sli)
+ {
+ printf(" Section kind=%s\n",sec->kind().data());
+ QListIterator<IMember> mli(sec->getMemberIterator());
+ IMember *mem;
+ for (mli.toFirst();(mem=mli.current());++mli)
+ {
+ printf(" Member type=%s name=%s\n",mem->type().data(),mem->name().data());
+ QListIterator<IParam> pli(mem->getParamIterator());
+ IParam *par;
+ for (pli.toFirst();(par=pli.current());++pli)
+ {
+ printf(" Param type=%s name=%s defvalue=%s\n",
+ par->type().data(),par->definitionName().data(),par->defaultValue().data());
+ }
+ }
+ }
}
- n = n.nextSibling();
+ printf("---------------------------\n");
+
}
-#endif
+ delete dox;
return 0;
}
diff --git a/addon/xmlparse/mainhandler.cpp b/addon/xmlparse/mainhandler.cpp
index 8a5d449..21185e6 100644
--- a/addon/xmlparse/mainhandler.cpp
+++ b/addon/xmlparse/mainhandler.cpp
@@ -13,6 +13,7 @@
*
*/
+#include <qxml.h>
#include "mainhandler.h"
void MainHandler::startCompound(const QXmlAttributes& attrib)
@@ -20,9 +21,10 @@ void MainHandler::startCompound(const QXmlAttributes& attrib)
CompoundHandler *compHandler = new CompoundHandler(this);
compHandler->startCompound(attrib);
m_compounds.append(compHandler);
+ m_compoundDict.insert(compHandler->id(),compHandler);
}
-MainHandler::MainHandler()
+MainHandler::MainHandler() : m_compoundDict(10007)
{
m_compounds.setAutoDelete(TRUE);
addStartHandler("doxygen");
@@ -33,6 +35,45 @@ MainHandler::MainHandler()
MainHandler::~MainHandler()
{
+ printf("MainHandler::~MainHandler()\n");
}
+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 );
+ return handler;
+}
+
diff --git a/addon/xmlparse/mainhandler.h b/addon/xmlparse/mainhandler.h
index 75a3b98..0d69f25 100644
--- a/addon/xmlparse/mainhandler.h
+++ b/addon/xmlparse/mainhandler.h
@@ -19,15 +19,28 @@
#include <qlist.h>
#include "basehandler.h"
#include "compoundhandler.h"
+#include "doxmlintf.h"
-class MainHandler : public BaseHandler<MainHandler>
+class MainHandler : public IDoxygen, public BaseHandler<MainHandler>
{
public:
virtual void startCompound(const QXmlAttributes& attrib);
MainHandler();
virtual ~MainHandler();
+
+ // IDoxygen
+ QListIterator<ICompound> getCompoundIterator() const
+ {
+ return m_compounds;
+ }
+ ICompound *getCompoundById(const QString &id) const
+ {
+ return m_compoundDict[id];
+ }
+
private:
- QList<CompoundHandler> m_compounds;
+ QList<ICompound> m_compounds;
+ QDict<ICompound> m_compoundDict;
};
#endif
diff --git a/addon/xmlparse/memberhandler.h b/addon/xmlparse/memberhandler.h
index e18e59c..7a5ea06 100644
--- a/addon/xmlparse/memberhandler.h
+++ b/addon/xmlparse/memberhandler.h
@@ -22,10 +22,11 @@
#include "basehandler.h"
#include "paramhandler.h"
+#include "doxmlintf.h"
class DocHandler;
-class MemberHandler : public BaseHandler<MemberHandler>
+class MemberHandler : public IMember, public BaseHandler<MemberHandler>
{
public:
virtual void startMember(const QXmlAttributes& attrib);
@@ -38,6 +39,16 @@ class MemberHandler : public BaseHandler<MemberHandler>
MemberHandler(IBaseHandler *parent);
virtual ~MemberHandler();
+
+ // IMember
+ 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 type() const { return m_type; }
+ virtual QString name() const { return m_name; }
+ virtual QListIterator<IParam> getParamIterator() const { return m_params; }
+
private:
IBaseHandler *m_parent;
QString m_kind;
@@ -48,7 +59,7 @@ class MemberHandler : public BaseHandler<MemberHandler>
QString m_name;
DocHandler *m_brief;
DocHandler *m_detailed;
- QList<ParamHandler> m_params;
+ QList<IParam> m_params;
};
#endif
diff --git a/addon/xmlparse/paramhandler.h b/addon/xmlparse/paramhandler.h
index f93f83f..38e5e03 100644
--- a/addon/xmlparse/paramhandler.h
+++ b/addon/xmlparse/paramhandler.h
@@ -21,8 +21,9 @@
#include <qxml.h>
#include "basehandler.h"
+#include "doxmlintf.h"
-class ParamHandler : public BaseHandler<ParamHandler>
+class ParamHandler : public IParam, public BaseHandler<ParamHandler>
{
public:
virtual void startParam(const QXmlAttributes& attrib);
@@ -36,6 +37,15 @@ class ParamHandler : public BaseHandler<ParamHandler>
ParamHandler(IBaseHandler *parent);
virtual ~ParamHandler();
+
+ // IParam
+ virtual QString type() const { return 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 QString defaultValue() const { return m_defVal; }
+
private:
IBaseHandler *m_parent;
QString m_type;
diff --git a/addon/xmlparse/sectionhandler.h b/addon/xmlparse/sectionhandler.h
index 5a4ab2a..1231214 100644
--- a/addon/xmlparse/sectionhandler.h
+++ b/addon/xmlparse/sectionhandler.h
@@ -22,8 +22,9 @@
#include "basehandler.h"
#include "memberhandler.h"
+#include "doxmlintf.h"
-class SectionHandler : public BaseHandler<SectionHandler>
+class SectionHandler : public ISection, public BaseHandler<SectionHandler>
{
public:
virtual void startMember(const QXmlAttributes& attrib);
@@ -32,10 +33,15 @@ class SectionHandler : public BaseHandler<SectionHandler>
SectionHandler(IBaseHandler *parent);
virtual ~SectionHandler();
+
+ // ISection
+ virtual QString kind() const { return m_kind; }
+ virtual QListIterator<IMember> getMemberIterator() const { return m_members; }
+
private:
IBaseHandler *m_parent;
QString m_kind;
- QList<MemberHandler> m_members;
+ QList<IMember> m_members;
};
#endif