diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2001-11-11 19:20:29 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2001-11-11 19:20:29 (GMT) |
commit | 621bb644049ff3957b4b69a02f3d42da89eefad0 (patch) | |
tree | 7d80c173dcecb625806ece76ccd2210dca925e13 /addon | |
parent | 7f95c8f5a256da0fafba27d5188d700e3c118dd1 (diff) | |
download | Doxygen-621bb644049ff3957b4b69a02f3d42da89eefad0.zip Doxygen-621bb644049ff3957b4b69a02f3d42da89eefad0.tar.gz Doxygen-621bb644049ff3957b4b69a02f3d42da89eefad0.tar.bz2 |
Release-1.2.11-20011111
Diffstat (limited to 'addon')
-rw-r--r-- | addon/xmlparse/compoundhandler.cpp | 12 | ||||
-rw-r--r-- | addon/xmlparse/compoundhandler.h | 3 | ||||
-rw-r--r-- | addon/xmlparse/dochandler.cpp | 287 | ||||
-rw-r--r-- | addon/xmlparse/dochandler.h | 171 |
4 files changed, 460 insertions, 13 deletions
diff --git a/addon/xmlparse/compoundhandler.cpp b/addon/xmlparse/compoundhandler.cpp index 9763e9d..0b22ef2 100644 --- a/addon/xmlparse/compoundhandler.cpp +++ b/addon/xmlparse/compoundhandler.cpp @@ -18,7 +18,7 @@ #include "dochandler.h" CompoundHandler::CompoundHandler(IBaseHandler *parent) - : m_parent(parent), m_brief(0), m_detailed(0) + : m_parent(parent), m_brief(0), m_detailed(0), m_programListing(0) { m_superClasses.setAutoDelete(TRUE); m_subClasses.setAutoDelete(TRUE); @@ -43,12 +43,15 @@ CompoundHandler::CompoundHandler(IBaseHandler *parent) 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) @@ -72,6 +75,13 @@ void CompoundHandler::startDetailedDesc(const QXmlAttributes& 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); diff --git a/addon/xmlparse/compoundhandler.h b/addon/xmlparse/compoundhandler.h index 420cac6..5191a2f 100644 --- a/addon/xmlparse/compoundhandler.h +++ b/addon/xmlparse/compoundhandler.h @@ -24,6 +24,7 @@ #include "doxmlintf.h" class DocHandler; +class ProgramListingHandler; class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> { @@ -37,6 +38,7 @@ class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> 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(); @@ -72,6 +74,7 @@ class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> IBaseHandler *m_parent; DocHandler *m_brief; DocHandler *m_detailed; + ProgramListingHandler *m_programListing; QString m_id; QString m_kind; QString m_name; diff --git a/addon/xmlparse/dochandler.cpp b/addon/xmlparse/dochandler.cpp index 53a300a..5dff81a 100644 --- a/addon/xmlparse/dochandler.cpp +++ b/addon/xmlparse/dochandler.cpp @@ -540,7 +540,7 @@ void RefHandler::endRef() { m_linkText = m_curString; m_parent->setDelegate(0); - printf("End ref\n"); + printf("End ref: text=`%s'\n",m_linkText.data()); } @@ -745,6 +745,83 @@ void VariableListHandler::startListItem(const QXmlAttributes& attrib) } //---------------------------------------------------------------------- +// AnchorHandler +//---------------------------------------------------------------------- + +AnchorHandler::AnchorHandler(IBaseHandler *parent) + : DocNode(Anchor), m_parent(parent) +{ + m_children.setAutoDelete(TRUE); + addEndHandler("anchor",this,&AnchorHandler::endAnchor); + addStartHandler("ref",this,&AnchorHandler::startRef); +} + +AnchorHandler::~AnchorHandler() +{ +} + +void AnchorHandler::startAnchor(const QXmlAttributes& attrib) +{ + m_id = attrib.value("id"); + m_curString=""; + m_parent->setDelegate(this); +} + +void AnchorHandler::endAnchor() +{ + addTextNode(); + printf("anchor id=`%s'\n",m_id.data()); + m_parent->setDelegate(0); +} + +void AnchorHandler::startRef(const QXmlAttributes& attrib) +{ + addTextNode(); + RefHandler *rh = new RefHandler(this); + m_children.append(rh); + rh->startRef(attrib); +} + +void AnchorHandler::addTextNode() +{ + if (!m_curString.isEmpty()) + { + m_children.append(new TextNode(m_curString,DocNode::Normal)); + printf("addTextNode() text=\"%s\"\n", + m_curString.data()); + m_curString=""; + } +} + +//---------------------------------------------------------------------- +// HighlightHandler +//---------------------------------------------------------------------- + +HighlightHandler::HighlightHandler(IBaseHandler *parent) + : DocNode(Highlight), 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 //---------------------------------------------------------------------- @@ -754,6 +831,9 @@ CodeLineHandler::CodeLineHandler(IBaseHandler *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); + addStartHandler("anchor",this,&CodeLineHandler::startAnchor); } CodeLineHandler::~CodeLineHandler() @@ -768,6 +848,7 @@ void CodeLineHandler::startCodeLine(const QXmlAttributes& /*attrib*/) void CodeLineHandler::endCodeLine() { + addTextNode(); printf("end codeline\n"); m_parent->setDelegate(0); } @@ -780,10 +861,46 @@ void CodeLineHandler::startLineNumber(const QXmlAttributes& /*attrib*/) void CodeLineHandler::endLineNumber() { + addTextNode(); printf("end linenumber\n"); 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::startAnchor(const QXmlAttributes& attrib) +{ + addTextNode(); + AnchorHandler *ah = new AnchorHandler(this); + m_children.append(ah); + ah->startAnchor(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,DocNode::Normal)); + printf("addTextNode() text=\"%s\"\n", + m_curString.data()); + m_curString=""; + } +} + //---------------------------------------------------------------------- // ProgramListingHandler //---------------------------------------------------------------------- @@ -841,6 +958,142 @@ void ProgramListingHandler::startCodeLine(const QXmlAttributes& attrib) } //---------------------------------------------------------------------- +// FormulaHandler +//---------------------------------------------------------------------- + +FormulaHandler::FormulaHandler(IBaseHandler *parent) + : DocNode(Formula), 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) + : DocNode(Image), 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) + : DocNode(DotFile), 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) + : DocNode(IndexEntry), 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; +} + + +//---------------------------------------------------------------------- // ParagraphHandler //---------------------------------------------------------------------- @@ -866,6 +1119,10 @@ ParagraphHandler::ParagraphHandler(IBaseHandler *parent) 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); } ParagraphHandler::~ParagraphHandler() @@ -974,6 +1231,34 @@ void ParagraphHandler::startProgramListing(const QXmlAttributes& attrib) m_children.append(pl); } +void ParagraphHandler::startFormula(const QXmlAttributes& attrib) +{ + FormulaHandler *fh = new FormulaHandler(this); + fh->startFormula(attrib); + m_children.append(fh); +} + +void ParagraphHandler::startImage(const QXmlAttributes& attrib) +{ + ImageHandler *ih = new ImageHandler(this); + ih->startImage(attrib); + m_children.append(ih); +} + +void ParagraphHandler::startDotFile(const QXmlAttributes& attrib) +{ + DotFileHandler *df = new DotFileHandler(this); + df->startDotFile(attrib); + m_children.append(df); +} + +void ParagraphHandler::startIndexEntry(const QXmlAttributes& attrib) +{ + IndexEntryHandler *df = new IndexEntryHandler(this); + df->startIndexEntry(attrib); + m_children.append(df); +} + void ParagraphHandler::addTextNode() { if (!m_curString.isEmpty()) diff --git a/addon/xmlparse/dochandler.h b/addon/xmlparse/dochandler.h index 688fcf7..a5b7b8c 100644 --- a/addon/xmlparse/dochandler.h +++ b/addon/xmlparse/dochandler.h @@ -64,7 +64,13 @@ class DocNode EMail, Link, ProgramListing, - CodeLine + CodeLine, + Highlight, + Anchor, + Formula, + Image, + DotFile, + IndexEntry }; DocNode(NodeKind k) : m_kind(k) {} virtual ~DocNode() {} @@ -343,9 +349,9 @@ class RefHandler : public DocNode, public BaseHandler<RefHandler> void endRef(); private: IBaseHandler *m_parent; - QCString m_refId; - QCString m_anchor; - QCString m_linkText; + QString m_refId; + QString m_anchor; + QString m_linkText; }; //----------------------------------------------------------------------------- @@ -451,6 +457,52 @@ class VariableListHandler : public DocNode, public BaseHandler<VariableListHandl //----------------------------------------------------------------------------- +/*! \brief Node representing a text anchor + * + */ +// children: ref +class AnchorHandler : public DocNode, public BaseHandler<AnchorHandler> +{ + public: + AnchorHandler(IBaseHandler *parent); + virtual ~AnchorHandler(); + void startAnchor(const QXmlAttributes& attrib); + void endAnchor(); + void startRef(const QXmlAttributes& attrib); + + private: + void addTextNode(); + IBaseHandler *m_parent; + QList<DocNode> m_children; + QString m_id; +}; + +//----------------------------------------------------------------------------- + +/*! \brief Node representing a highlighted text fragment. + * + */ +// children: - +class HighlightHandler : public DocNode, public BaseHandler<HighlightHandler> +{ + public: + HighlightHandler(IBaseHandler *parent); + virtual ~HighlightHandler(); + void startHighlight(const QXmlAttributes& attrib); + void endHighlight(); + + 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 DocNode, public BaseHandler<CodeLineHandler> { public: @@ -459,10 +511,16 @@ class CodeLineHandler : public DocNode, public BaseHandler<CodeLineHandler> virtual void endCodeLine(); virtual void startLineNumber(const QXmlAttributes&); virtual void endLineNumber(); + virtual void startHighlight(const QXmlAttributes&); + virtual void startAnchor(const QXmlAttributes&); + virtual void startRef(const QXmlAttributes&); CodeLineHandler(IBaseHandler *parent); virtual ~CodeLineHandler(); + private: + void addTextNode(); + IBaseHandler *m_parent; int m_lineNumber; QString m_anchor; @@ -475,6 +533,7 @@ class CodeLineHandler : public DocNode, public BaseHandler<CodeLineHandler> /*! \brief Node representing a program listing * */ +// children: codeline, linenumber class ProgramListingHandler : public DocNode, public BaseHandler<ProgramListingHandler> { public: @@ -486,25 +545,109 @@ class ProgramListingHandler : public DocNode, public BaseHandler<ProgramListingH ProgramListingHandler(IBaseHandler *parent); virtual ~ProgramListingHandler(); private: - IBaseHandler *m_parent; - QList<CodeLineHandler> m_children; + IBaseHandler *m_parent; + QList<CodeLineHandler> m_children; bool m_hasLineNumber; }; //----------------------------------------------------------------------------- +/*! \brief Node representing a formula. + * + */ +// children: - +class FormulaHandler : public DocNode, public BaseHandler<FormulaHandler> +{ + public: + FormulaHandler(IBaseHandler *parent); + virtual ~FormulaHandler(); + void startFormula(const QXmlAttributes& attrib); + void endFormula(); + + private: + IBaseHandler *m_parent; + QString m_id; + QString m_text; +}; + +//----------------------------------------------------------------------------- + +/*! \brief Node representing an image. + * + */ +// children: - +class ImageHandler : public DocNode, public BaseHandler<ImageHandler> +{ + public: + ImageHandler(IBaseHandler *parent); + virtual ~ImageHandler(); + void startImage(const QXmlAttributes& attrib); + void endImage(); + + private: + IBaseHandler *m_parent; + QString m_name; + QString m_caption; +}; + +//----------------------------------------------------------------------------- + +/*! \brief Node representing a dot file. + * + */ +// children: - +class DotFileHandler : public DocNode, public BaseHandler<DotFileHandler> +{ + public: + DotFileHandler(IBaseHandler *parent); + virtual ~DotFileHandler(); + void startDotFile(const QXmlAttributes& attrib); + void endDotFile(); + + private: + IBaseHandler *m_parent; + QString m_name; + QString m_caption; +}; + +//----------------------------------------------------------------------------- + +/*! \brief Node representing an entry in the index. + * + */ +// children: - +class IndexEntryHandler : public DocNode, 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(); + + private: + IBaseHandler *m_parent; + QString m_primary; + QString m_secondary; +}; + +//----------------------------------------------------------------------------- + /*! \brief Node representing a paragraph of text and commands. * */ // children: itemizedlist, orderedlist, parameterlist, simplesect, ref, // variablelist, hruler, linebreak, ulink, email, link -// TODO: -// programlisting, -// table, -// indexentry, formula, image, dotfile +// programlisting, formula, image, dotfile, indexentry +// // children handled by MarkupHandler: // bold, computeroutput, emphasis, center, // small, subscript, superscript. +// TODO: +// table class ParagraphHandler : public DocNode, public BaseHandler<ParagraphHandler> { public: @@ -522,6 +665,10 @@ class ParagraphHandler : public DocNode, public BaseHandler<ParagraphHandler> 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); ParagraphHandler(IBaseHandler *parent); virtual ~ParagraphHandler(); @@ -538,7 +685,8 @@ class ParagraphHandler : public DocNode, public BaseHandler<ParagraphHandler> /*! \brief Node representing a documentation block. * */ -// children: para, title, sect1, sect2, sect3 +// children: para +// TODO: title, sect1, sect2, sect3 class DocHandler : public BaseHandler<DocHandler> { public: @@ -548,6 +696,7 @@ class DocHandler : public BaseHandler<DocHandler> DocHandler(IBaseHandler *parent); virtual ~DocHandler(); + private: IBaseHandler *m_parent; QList<DocNode> m_children; |