summaryrefslogtreecommitdiffstats
path: root/addon
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2001-08-26 14:15:46 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2001-08-26 14:15:46 (GMT)
commit1fb3a77524a31472d1ecb9bafb3491ddbbd096e3 (patch)
tree9acee8d8d8b91289eb8173fd93a8f16891fc2a92 /addon
parent8f7c9d9ba3b6c4e87c87deb6775d4bf642939e77 (diff)
downloadDoxygen-1fb3a77524a31472d1ecb9bafb3491ddbbd096e3.zip
Doxygen-1fb3a77524a31472d1ecb9bafb3491ddbbd096e3.tar.gz
Doxygen-1fb3a77524a31472d1ecb9bafb3491ddbbd096e3.tar.bz2
Release-1.2.10
Diffstat (limited to 'addon')
-rw-r--r--addon/xmlparse/basehandler.h2
-rw-r--r--addon/xmlparse/dochandler.cpp98
-rw-r--r--addon/xmlparse/dochandler.h24
-rw-r--r--addon/xmlparse/main.cpp8
4 files changed, 123 insertions, 9 deletions
diff --git a/addon/xmlparse/basehandler.h b/addon/xmlparse/basehandler.h
index 6129aa4..3c64d42 100644
--- a/addon/xmlparse/basehandler.h
+++ b/addon/xmlparse/basehandler.h
@@ -146,7 +146,7 @@ template<class T> class BaseHandler : public IBaseHandler,
(*handler)(attrib);
//printf("found start tag %s\n",name.data());
}
- else if (m_fallBackHandler &&
+ else if (!m_fallBackHandler ||
!m_fallBackHandler->handleStartElement(name,attrib)
)
{
diff --git a/addon/xmlparse/dochandler.cpp b/addon/xmlparse/dochandler.cpp
index 7a72763..29e8799 100644
--- a/addon/xmlparse/dochandler.cpp
+++ b/addon/xmlparse/dochandler.cpp
@@ -14,7 +14,46 @@
*/
#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
//----------------------------------------------------------------------
@@ -334,6 +373,56 @@ void ParameterListHandler::startParameterDescription(const QXmlAttributes& attri
}
//----------------------------------------------------------------------
+// SimpleSectHandler
+//----------------------------------------------------------------------
+
+SimpleSectHandler::SimpleSectHandler(IBaseHandler *parent)
+ : DocNode(Para), m_parent(parent), m_paragraph(0)
+{
+ addStartHandler("title",this,&SimpleSectHandler::startTitle);
+ addEndHandler("title",this,&SimpleSectHandler::endTitle);
+ addStartHandler("para",this,&SimpleSectHandler::startParagraph);
+}
+
+SimpleSectHandler::~SimpleSectHandler()
+{
+}
+
+void SimpleSectHandler::startSimpleSect(const QXmlAttributes& attrib)
+{
+ m_type = g_typeMapper.stringToType(attrib.value("kind"));
+ addEndHandler("simplesect",this,&SimpleSectHandler::endSimpleSect);
+ 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*/)
+{
+ m_curString="";
+}
+
+void SimpleSectHandler::endTitle()
+{
+ printf("simpleSect title=\"%s\"\n",m_curString.data());
+ m_title = m_curString;
+ m_curString="";
+}
+
+
+void SimpleSectHandler::startParagraph(const QXmlAttributes& attrib)
+{
+ ASSERT(m_paragraph==0);
+ m_paragraph = new ParagraphHandler(this);
+ m_paragraph->startParagraph(attrib);
+}
+
+//----------------------------------------------------------------------
// ParagraphHandler
//----------------------------------------------------------------------
@@ -350,6 +439,7 @@ ParagraphHandler::ParagraphHandler(IBaseHandler *parent)
addStartHandler("itemizedlist",this,&ParagraphHandler::startItemizedList);
addStartHandler("orderedlist",this,&ParagraphHandler::startOrderedList);
addStartHandler("parameterlist",this,&ParagraphHandler::startParameterList);
+ addStartHandler("simplesect",this,&ParagraphHandler::startSimpleSect);
}
ParagraphHandler::~ParagraphHandler()
@@ -394,6 +484,14 @@ void ParagraphHandler::startParameterList(const QXmlAttributes& 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::addTextNode()
{
if (!m_curString.isEmpty())
diff --git a/addon/xmlparse/dochandler.h b/addon/xmlparse/dochandler.h
index c7c8095..4dc50c5 100644
--- a/addon/xmlparse/dochandler.h
+++ b/addon/xmlparse/dochandler.h
@@ -52,7 +52,8 @@ class DocNode
OrderedList,
ListItem,
ParameterList,
- Parameter
+ Parameter,
+ SimpleSect
};
DocNode(NodeKind k) : m_kind(k) {}
virtual ~DocNode() {}
@@ -225,11 +226,13 @@ class ParameterListHandler : public DocNode,
/* \brief Node representing a simple section with an unnumbered header.
*
*/
+// children: title, para
class SimpleSectHandler : public DocNode,
public BaseHandler<SimpleSectHandler>
{
public:
- enum Types { See, Return, Author, Version,
+ enum Types { Invalid = 0,
+ See, Return, Author, Version,
Since, Date, Bug, Note,
Warning, Par, Deprecated, Pre,
Post, Invar, Remark, Attention,
@@ -240,11 +243,15 @@ class SimpleSectHandler : public DocNode,
virtual ~SimpleSectHandler();
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;
- ParameterHandler *m_curParam;
+ ParagraphHandler *m_paragraph;
Types m_type;
+ // TODO: a title can also contain links (for todo sections for instance!)
QString m_title;
};
@@ -253,6 +260,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 handled by MarkupHandler:
+// bold, computeroutput, emphasis, center,
+// small, subscript, superscript.
class ParagraphHandler : public DocNode, public BaseHandler<ParagraphHandler>
{
public:
@@ -261,6 +275,7 @@ class ParagraphHandler : public DocNode, public BaseHandler<ParagraphHandler>
virtual void startItemizedList(const QXmlAttributes& attrib);
virtual void startOrderedList(const QXmlAttributes& attrib);
virtual void startParameterList(const QXmlAttributes& attrib);
+ virtual void startSimpleSect(const QXmlAttributes& attrib);
ParagraphHandler(IBaseHandler *parent);
virtual ~ParagraphHandler();
@@ -277,6 +292,7 @@ class ParagraphHandler : public DocNode, public BaseHandler<ParagraphHandler>
/*! \brief Node representing a documentation block.
*
*/
+// children: para, title, sect1, sect2, sect3
class DocHandler : public BaseHandler<DocHandler>
{
public:
@@ -288,7 +304,7 @@ class DocHandler : public BaseHandler<DocHandler>
virtual ~DocHandler();
private:
IBaseHandler *m_parent;
- QList<ParagraphHandler> m_children;
+ QList<DocNode> m_children;
};
#endif
diff --git a/addon/xmlparse/main.cpp b/addon/xmlparse/main.cpp
index 3575c16..44c5e36 100644
--- a/addon/xmlparse/main.cpp
+++ b/addon/xmlparse/main.cpp
@@ -63,10 +63,6 @@ int main(int argc,char **argv)
}
QFile xmlFile(argv[1]);
- if (!xmlFile.open( IO_ReadOnly ))
- {
- qFatal("Could not read %s",argv[1] );
- }
#ifdef USE_SAX
MainHandler handler;
@@ -79,6 +75,10 @@ int main(int argc,char **argv)
#endif
#ifdef USE_DOM
+ if (!xmlFile.open( IO_ReadOnly ))
+ {
+ qFatal("Could not read %s",argv[1] );
+ }
QDomDocument doc;
doc.setContent( &xmlFile );