diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2002-11-06 21:06:38 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2002-11-06 21:06:38 (GMT) |
commit | c400bd439b3df09704e33df382ed7b08f80dd8ed (patch) | |
tree | d2b3049367f2df643a3f305ecfcd739b426c3edc /addon/doxmlparser | |
parent | c6d6555a949e86be5c859311eb4db5dcc092c258 (diff) | |
download | Doxygen-c400bd439b3df09704e33df382ed7b08f80dd8ed.zip Doxygen-c400bd439b3df09704e33df382ed7b08f80dd8ed.tar.gz Doxygen-c400bd439b3df09704e33df382ed7b08f80dd8ed.tar.bz2 |
Release-1.2.18-20021106
Diffstat (limited to 'addon/doxmlparser')
-rw-r--r-- | addon/doxmlparser/include/doxmlintf.h | 56 | ||||
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.cpp | 2 | ||||
-rw-r--r-- | addon/doxmlparser/src/dochandler.cpp | 369 | ||||
-rw-r--r-- | addon/doxmlparser/src/dochandler.h | 163 | ||||
-rw-r--r-- | addon/doxmlparser/src/doxmlintf.h | 56 | ||||
-rw-r--r-- | addon/doxmlparser/src/mainhandler.cpp | 2 | ||||
-rw-r--r-- | addon/doxmlparser/src/mainhandler.h | 6 | ||||
-rw-r--r-- | addon/doxmlparser/src/memberhandler.cpp | 58 | ||||
-rw-r--r-- | addon/doxmlparser/src/memberhandler.h | 43 | ||||
-rw-r--r-- | addon/doxmlparser/src/paramhandler.cpp | 10 | ||||
-rw-r--r-- | addon/doxmlparser/src/paramhandler.h | 10 | ||||
-rw-r--r-- | addon/doxmlparser/src/sectionhandler.cpp | 5 | ||||
-rw-r--r-- | addon/doxmlparser/src/sectionhandler.h | 4 | ||||
-rw-r--r-- | addon/doxmlparser/test/main.cpp | 74 |
14 files changed, 714 insertions, 144 deletions
diff --git a/addon/doxmlparser/include/doxmlintf.h b/addon/doxmlparser/include/doxmlintf.h index 7ab2c79..6432ee3 100644 --- a/addon/doxmlparser/include/doxmlintf.h +++ b/addon/doxmlparser/include/doxmlintf.h @@ -159,10 +159,13 @@ class IDoc Row, // 27 -> IDocRow Entry, // 28 -> IDocEntry Section, // 29 -> IDocSection - Preformatted, // 30 -> IDocPreformatted - Verbatim, // 31 -> IDocVerbatim - Symbol, // 32 -> IDocSymbol - Root // 33 -> IDocRoot + Verbatim, // 30 -> IDocVerbatim + Copy, // 31 -> IDocCopy + TocList, // 32 -> IDocTocList + TocItem, // 33 -> IDocTocItem + Anchor, // 34 -> IDocAnchor + Symbol, // 35 -> IDocSymbol + Root // 36 -> IDocRoot }; virtual Kind kind() const = 0; }; @@ -172,14 +175,16 @@ class IDocMarkup : public IDoc public: enum Markup { - Normal = 0x00, - Bold = 0x01, - Emphasis = 0x02, - ComputerOutput = 0x04, - Subscript = 0x08, - Superscript = 0x10, - SmallFont = 0x20, - Center = 0x40 + Normal = 0x000, + Bold = 0x001, + Emphasis = 0x002, + ComputerOutput = 0x004, + Subscript = 0x008, + Superscript = 0x010, + SmallFont = 0x020, + Center = 0x040, + Preformatted = 0x080, + Heading = 0x100 }; }; @@ -194,6 +199,7 @@ class IDocText : public IDocMarkup public: virtual const IString * text() const = 0; virtual int markup() const = 0; + virtual int headingLevel() const = 0; }; class IDocMarkupModifier : public IDoc @@ -201,6 +207,7 @@ class IDocMarkupModifier : public IDoc public: virtual bool enabled() const = 0; virtual int markup() const = 0; + virtual int headingLevel() const = 0; }; class IDocItemizedList : public IDoc @@ -278,7 +285,7 @@ class IDocVariableList : public IDoc class IDocVariableListEntry : public IDoc { public: - virtual const IString * term() const = 0; + virtual ILinkedTextIterator * term() const = 0; virtual IDocPara *description() const = 0; }; @@ -393,7 +400,20 @@ class IDocSection : public IDoc virtual IDocIterator *title() const = 0; }; -class IDocPreformatted : public IDoc +class IDocTocList : public IDoc +{ + public: + virtual IDocIterator *elements() const = 0; +}; + +class IDocTocItem : public IDoc +{ + public: + virtual const IString *id() const = 0; + virtual const IString *title() const = 0; +}; + +class IDocCopy : public IDoc { public: virtual IDocIterator *contents() const = 0; @@ -402,7 +422,15 @@ class IDocPreformatted : public IDoc class IDocVerbatim : public IDoc { public: + enum Types { Invalid = 0, HtmlOnly, LatexOnly, Verbatim }; virtual const IString *text() const = 0; + virtual Types type() const = 0; +}; + +class IDocAnchor : public IDoc +{ + public: + virtual const IString *id() const = 0; }; class IDocSymbol : public IDoc diff --git a/addon/doxmlparser/src/compoundhandler.cpp b/addon/doxmlparser/src/compoundhandler.cpp index df69d2a..4c64a54 100644 --- a/addon/doxmlparser/src/compoundhandler.cpp +++ b/addon/doxmlparser/src/compoundhandler.cpp @@ -19,7 +19,9 @@ #include "debug.h" #include "graphhandler.h" #include "sectionhandler.h" +#include "paramhandler.h" #include "loamhandler.h" +#include "memberhandler.h" //---------------------------------------------------------------------------- diff --git a/addon/doxmlparser/src/dochandler.cpp b/addon/doxmlparser/src/dochandler.cpp index e771761..6bd2476 100644 --- a/addon/doxmlparser/src/dochandler.cpp +++ b/addon/doxmlparser/src/dochandler.cpp @@ -13,9 +13,12 @@ * */ +#include <qmap.h> + #include "dochandler.h" #include "debug.h" -#include <qmap.h> +#include "linkedtexthandler.h" + //---------------------------------------------------------------------- @@ -95,7 +98,8 @@ void dochandler_exit() //---------------------------------------------------------------------- MarkupHandler::MarkupHandler(QList<DocImpl> &children,QString &curString) - : m_children(children), m_curString(curString), m_curMarkup(IDocMarkup::Normal) + : m_children(children), m_curString(curString), + m_curMarkup(IDocMarkup::Normal), m_headingLevel(0) { addStartHandler("bold",this,&MarkupHandler::startBold); addEndHandler("bold",this,&MarkupHandler::endBold); @@ -117,6 +121,27 @@ MarkupHandler::MarkupHandler(QList<DocImpl> &children,QString &curString) addStartHandler("superscript",this,&MarkupHandler::startSuperscript); addEndHandler("superscript",this,&MarkupHandler::endSuperscript); + + addStartHandler("preformatted",this,&MarkupHandler::startPreformatted); + addEndHandler("preformatted",this,&MarkupHandler::endPreformatted); + + addStartHandler("heading1",this,&MarkupHandler::startHeading1); + addEndHandler("heading1",this,&MarkupHandler::endHeading1); + + addStartHandler("heading2",this,&MarkupHandler::startHeading2); + addEndHandler("heading2",this,&MarkupHandler::endHeading2); + + addStartHandler("heading3",this,&MarkupHandler::startHeading3); + addEndHandler("heading3",this,&MarkupHandler::endHeading3); + + addStartHandler("heading4",this,&MarkupHandler::startHeading4); + addEndHandler("heading4",this,&MarkupHandler::endHeading4); + + addStartHandler("heading5",this,&MarkupHandler::startHeading5); + addEndHandler("heading5",this,&MarkupHandler::endHeading5); + + addStartHandler("heading6",this,&MarkupHandler::startHeading6); + addEndHandler("heading6",this,&MarkupHandler::endHeading6); } MarkupHandler::~MarkupHandler() @@ -127,7 +152,7 @@ void MarkupHandler::addTextNode() { if (!m_curString.isEmpty()) { - m_children.append(new TextNode(m_curString,m_curMarkup)); + m_children.append(new TextNode(m_curString,m_curMarkup,m_headingLevel)); debug(2,"addTextNode() text=%s markup=%x\n",m_curString.data(),m_curMarkup); m_curString=""; } @@ -231,6 +256,117 @@ void MarkupHandler::endSuperscript() m_curMarkup &= ~IDocMarkup::Superscript; } +void MarkupHandler::startPreformatted(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Preformatted,TRUE)); + m_curMarkup |= IDocMarkup::Preformatted; +} + +void MarkupHandler::endPreformatted() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Preformatted,FALSE)); + m_curMarkup &= ~IDocMarkup::Preformatted; +} + +void MarkupHandler::startHeading1(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Heading,TRUE,1)); + m_curMarkup |= IDocMarkup::Heading; + m_headingLevel=1; +} + +void MarkupHandler::endHeading1() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Heading,FALSE,1)); + m_curMarkup &= ~IDocMarkup::Heading; + m_headingLevel=0; +} + +void MarkupHandler::startHeading2(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Heading,TRUE,2)); + m_curMarkup |= IDocMarkup::Heading; + m_headingLevel=2; +} + +void MarkupHandler::endHeading2() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Heading,FALSE,2)); + m_curMarkup &= ~IDocMarkup::Heading; + m_headingLevel=0; +} + +void MarkupHandler::startHeading3(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Heading,TRUE,3)); + m_curMarkup |= IDocMarkup::Heading; + m_headingLevel=3; +} + +void MarkupHandler::endHeading3() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Heading,FALSE,3)); + m_curMarkup &= ~IDocMarkup::Heading; + m_headingLevel=0; +} + +void MarkupHandler::startHeading4(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Heading,TRUE,4)); + m_curMarkup |= IDocMarkup::Heading; + m_headingLevel=4; +} + +void MarkupHandler::endHeading4() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Heading,FALSE,4)); + m_curMarkup &= ~IDocMarkup::Heading; + m_headingLevel=0; +} + +void MarkupHandler::startHeading5(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Heading,TRUE,5)); + m_curMarkup |= IDocMarkup::Heading; + m_headingLevel=5; +} + +void MarkupHandler::endHeading5() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Heading,FALSE,5)); + m_curMarkup &= ~IDocMarkup::Heading; + m_headingLevel=0; +} + +void MarkupHandler::startHeading6(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Heading,TRUE,6)); + m_curMarkup |= IDocMarkup::Heading; + m_headingLevel=6; +} + +void MarkupHandler::endHeading6() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Heading,FALSE,6)); + m_curMarkup &= ~IDocMarkup::Heading; + m_headingLevel=0; +} + + //---------------------------------------------------------------------- // ListItemHandler //---------------------------------------------------------------------- @@ -348,6 +484,69 @@ IDocIterator *ItemizedListHandler::elements() const } //---------------------------------------------------------------------- +// TocListHandler +//---------------------------------------------------------------------- + +TocListHandler::TocListHandler(IBaseHandler *parent) : m_parent(parent) +{ + m_children.setAutoDelete(TRUE); + addEndHandler("toclist",this,&TocListHandler::endTocList); + addStartHandler("tocitem",this,&TocListHandler::startTocItem); +} + +TocListHandler::~TocListHandler() +{ +} + +void TocListHandler::startTocList(const QXmlAttributes& /*attrib*/) +{ + m_parent->setDelegate(this); +} + +void TocListHandler::endTocList() +{ + m_parent->setDelegate(0); +} + +void TocListHandler::startTocItem(const QXmlAttributes& attrib) +{ + TocItemHandler *tiHandler = new TocItemHandler(this); + tiHandler->startTocItem(attrib); + m_children.append(tiHandler); +} + +IDocIterator *TocListHandler::elements() const +{ + return new TocListIterator(*this); +} + +//---------------------------------------------------------------------- +// TocItemHandler +//---------------------------------------------------------------------- + +TocItemHandler::TocItemHandler(IBaseHandler *parent) : m_parent(parent) +{ + addEndHandler("tocitem",this,&TocItemHandler::endTocItem); +} + +TocItemHandler::~TocItemHandler() +{ +} + +void TocItemHandler::startTocItem(const QXmlAttributes& attrib) +{ + m_parent->setDelegate(this); + m_id = attrib.value("id"); + m_curString=""; +} + +void TocItemHandler::endTocItem() +{ + m_title = m_curString; + m_parent->setDelegate(0); +} + +//---------------------------------------------------------------------- // ParameterHandler //---------------------------------------------------------------------- @@ -663,9 +862,15 @@ void TitleHandler::addTextNode() { if (!m_curString.isEmpty()) { - m_children.append(new TextNode(m_curString,m_markupHandler->markup())); - debug(2,"addTextNode() text=\"%s\" markup=%x\n", - m_curString.data(),m_markupHandler->markup()); + m_children.append( + new TextNode( + m_curString, + m_markupHandler->markup(), + m_markupHandler->headingLevel() + ) + ); + debug(2,"addTextNode() text=\"%s\" markup=%x headingLevel=%d\n", + m_curString.data(),m_markupHandler->markup(),m_markupHandler->headingLevel()); m_curString=""; } } @@ -731,7 +936,7 @@ void SimpleSectHandler::startParagraph(const QXmlAttributes& attrib) //---------------------------------------------------------------------- VariableListEntryHandler::VariableListEntryHandler(IBaseHandler *parent) - : m_parent(parent), m_description(0) + : m_parent(parent), m_description(0), m_linkedTextHandler(0) { addStartHandler("term",this,&VariableListEntryHandler::startTerm); addEndHandler("term",this,&VariableListEntryHandler::endTerm); @@ -772,12 +977,13 @@ void VariableListEntryHandler::endListItem() void VariableListEntryHandler::startTerm(const QXmlAttributes& /*attrib*/) { m_curString=""; + m_linkedTextHandler = new LinkedTextHandler(this,m_term); + m_linkedTextHandler->start("term"); } void VariableListEntryHandler::endTerm() { - m_term = m_curString; - debug(2,"term=%s\n",m_term.data()); + delete m_linkedTextHandler; } void VariableListEntryHandler::startParagraph(const QXmlAttributes& attrib) @@ -787,6 +993,10 @@ void VariableListEntryHandler::startParagraph(const QXmlAttributes& attrib) m_description->startParagraph(attrib); } +ILinkedTextIterator *VariableListEntryHandler::term() const +{ + return new LinkedTextIterator(m_term); +} //---------------------------------------------------------------------- @@ -881,7 +1091,7 @@ void HighlightHandler::addTextNode() { if (!m_curString.isEmpty()) { - m_children.append(new TextNode(m_curString,IDocMarkup::Normal)); + m_children.append(new TextNode(m_curString,IDocMarkup::Normal,0)); debug(2,"addTextNode() text=\"%s\"\n", m_curString.data()); m_curString=""; @@ -958,7 +1168,7 @@ void CodeLineHandler::addTextNode() { if (!m_curString.isEmpty()) { - m_children.append(new TextNode(m_curString,IDocMarkup::Normal)); + m_children.append(new TextNode(m_curString,IDocMarkup::Normal,0)); debug(2,"addTextNode() text=\"%s\"\n", m_curString.data()); m_curString=""; @@ -1063,6 +1273,32 @@ void FormulaHandler::endFormula() } //---------------------------------------------------------------------- +// AnchorHandler +//---------------------------------------------------------------------- + +AnchorHandler::AnchorHandler(IBaseHandler *parent) + : m_parent(parent) +{ + addEndHandler("anchor",this,&AnchorHandler::endAnchor); +} + +AnchorHandler::~AnchorHandler() +{ +} + +void AnchorHandler::startAnchor(const QXmlAttributes& attrib) +{ + m_id = attrib.value("id"); + m_parent->setDelegate(this); +} + +void AnchorHandler::endAnchor() +{ + debug(2,"anchor id=`%s'\n",m_id.data()); + m_parent->setDelegate(0); +} + +//---------------------------------------------------------------------- // ImageHandler //---------------------------------------------------------------------- @@ -1298,33 +1534,45 @@ IDocIterator *TableHandler::rows() const } //---------------------------------------------------------------------- -// PreformattedHandler +// CopyHandler //---------------------------------------------------------------------- -PreformattedHandler::PreformattedHandler(IBaseHandler *parent) - : m_parent(parent) +CopyHandler::CopyHandler(IBaseHandler *parent) + : m_parent(parent) { m_children.setAutoDelete(TRUE); - addEndHandler("preformatted",this,&PreformattedHandler::endPreformatted); + + addEndHandler("copydoc",this,&CopyHandler::endCopy); + + addStartHandler("para",this,&CopyHandler::startParagraph); } -PreformattedHandler::~PreformattedHandler() +CopyHandler::~CopyHandler() { } -void PreformattedHandler::startPreformatted(const QXmlAttributes&) +void CopyHandler::startCopy(const QXmlAttributes& /*attrib*/) { m_parent->setDelegate(this); + debug(2,"start copy handler\n"); } -void PreformattedHandler::endPreformatted() +void CopyHandler::endCopy() { + debug(2,"end copy handler\n"); m_parent->setDelegate(0); } -IDocIterator *PreformattedHandler::contents() const +void CopyHandler::startParagraph(const QXmlAttributes& attrib) { - return new PreformattedIterator(*this); + ParagraphHandler *parHandler = new ParagraphHandler(this); + parHandler->startParagraph(attrib); + m_children.append(parHandler); +} + +IDocIterator *CopyHandler::contents() const +{ + return new CopyIterator(*this); } //---------------------------------------------------------------------- @@ -1332,17 +1580,20 @@ IDocIterator *PreformattedHandler::contents() const //---------------------------------------------------------------------- VerbatimHandler::VerbatimHandler(IBaseHandler *parent) - : m_parent(parent) + : m_parent(parent), m_type(IDocVerbatim::Invalid) { addEndHandler("verbatim",this,&VerbatimHandler::endVerbatim); + addEndHandler("latexonly",this,&VerbatimHandler::endVerbatim); + addEndHandler("htmlonly",this,&VerbatimHandler::endVerbatim); } VerbatimHandler::~VerbatimHandler() { } -void VerbatimHandler::startVerbatim(const QXmlAttributes&) +void VerbatimHandler::startVerbatim(const QXmlAttributes&,Types type) { + m_type = type; m_parent->setDelegate(this); m_curString=""; } @@ -1353,6 +1604,7 @@ void VerbatimHandler::endVerbatim() m_parent->setDelegate(0); } + //---------------------------------------------------------------------- // SymbolHandler //---------------------------------------------------------------------- @@ -1418,8 +1670,9 @@ ParagraphHandler::ParagraphHandler(IBaseHandler *parent) addStartHandler("dotfile",this,&ParagraphHandler::startDotFile); addStartHandler("indexentry",this,&ParagraphHandler::startIndexEntry); addStartHandler("table",this,&ParagraphHandler::startTable); - addStartHandler("preformatted",this,&ParagraphHandler::startPreformatted); addStartHandler("verbatim",this,&ParagraphHandler::startVerbatim); + addStartHandler("latexonly",this,&ParagraphHandler::startHtmlOnly); + addStartHandler("htmlonly",this,&ParagraphHandler::startLatexOnly); addStartHandler("umlaut",this,&ParagraphHandler::startUmlaut); addStartHandler("acute",this,&ParagraphHandler::startAcute); addStartHandler("grave",this,&ParagraphHandler::startGrave); @@ -1430,6 +1683,9 @@ ParagraphHandler::ParagraphHandler(IBaseHandler *parent) addStartHandler("ring",this,&ParagraphHandler::startRing); addStartHandler("nbsp",this,&ParagraphHandler::startNbsp); addStartHandler("copy",this,&ParagraphHandler::startCopy); + addStartHandler("anchor",this,&ParagraphHandler::startAnchor); + addStartHandler("copydoc",this,&ParagraphHandler::startCopyDoc); + addStartHandler("toclist",this,&ParagraphHandler::startTocList); } ParagraphHandler::~ParagraphHandler() @@ -1586,19 +1842,27 @@ void ParagraphHandler::startTable(const QXmlAttributes& attrib) m_children.append(th); } -void ParagraphHandler::startPreformatted(const QXmlAttributes& attrib) +void ParagraphHandler::startVerbatim(const QXmlAttributes& attrib) { addTextNode(); - PreformattedHandler *ph = new PreformattedHandler(this); - ph->startPreformatted(attrib); - m_children.append(ph); + VerbatimHandler *vh = new VerbatimHandler(this); + vh->startVerbatim(attrib,IDocVerbatim::Verbatim); + m_children.append(vh); } -void ParagraphHandler::startVerbatim(const QXmlAttributes& attrib) +void ParagraphHandler::startHtmlOnly(const QXmlAttributes& attrib) +{ + addTextNode(); + VerbatimHandler *vh = new VerbatimHandler(this); + vh->startVerbatim(attrib,IDocVerbatim::HtmlOnly); + m_children.append(vh); +} + +void ParagraphHandler::startLatexOnly(const QXmlAttributes& attrib) { addTextNode(); VerbatimHandler *vh = new VerbatimHandler(this); - vh->startVerbatim(attrib); + vh->startVerbatim(attrib,IDocVerbatim::LatexOnly); m_children.append(vh); } @@ -1682,13 +1946,43 @@ void ParagraphHandler::startCopy(const QXmlAttributes& attrib) m_children.append(sh); } +void ParagraphHandler::startAnchor(const QXmlAttributes& attrib) +{ + addTextNode(); + AnchorHandler *ah = new AnchorHandler(this); + ah->startAnchor(attrib); + m_children.append(ah); +} + +void ParagraphHandler::startCopyDoc(const QXmlAttributes& attrib) +{ + addTextNode(); + CopyHandler *ch = new CopyHandler(this); + ch->startCopy(attrib); + m_children.append(ch); +} + +void ParagraphHandler::startTocList(const QXmlAttributes& attrib) +{ + addTextNode(); + TocListHandler *th = new TocListHandler(this); + th->startTocList(attrib); + m_children.append(th); +} + void ParagraphHandler::addTextNode() { if (!m_curString.isEmpty()) { - m_children.append(new TextNode(m_curString,m_markupHandler->markup())); - debug(2,"addTextNode() text=\"%s\" markup=%x\n", - m_curString.data(),m_markupHandler->markup()); + m_children.append( + new TextNode( + m_curString, + m_markupHandler->markup(), + m_markupHandler->headingLevel() + ) + ); + debug(2,"addTextNode() text=\"%s\" markup=%x headingLevel=%d\n", + m_curString.data(),m_markupHandler->markup(),m_markupHandler->headingLevel()); m_curString=""; } } @@ -1738,9 +2032,14 @@ void DocSectionHandler::addTextNode() { if (!m_curString.isEmpty()) { - m_children.append(new TextNode(m_curString,m_markupHandler->markup())); - debug(2,"addTextNode() text=\"%s\" markup=%x\n", - m_curString.data(),m_markupHandler->markup()); + m_children.append( + new TextNode(m_curString, + m_markupHandler->markup(), + m_markupHandler->headingLevel() + ) + ); + debug(2,"addTextNode() text=\"%s\" markup=%x headingLevel=%d\n", + m_curString.data(),m_markupHandler->markup(),m_markupHandler->headingLevel()); m_curString=""; } } diff --git a/addon/doxmlparser/src/dochandler.h b/addon/doxmlparser/src/dochandler.h index 37c7df4..7a0bda4 100644 --- a/addon/doxmlparser/src/dochandler.h +++ b/addon/doxmlparser/src/dochandler.h @@ -26,6 +26,8 @@ #include "baseiterator.h" class ParagraphHandler; +class LinkedTextImpl; +class LinkedTextHandler; //----------------------------------------------------------------------------- @@ -64,8 +66,11 @@ DEFINE_CLS_IMPL(DocTable); DEFINE_CLS_IMPL(DocRow); DEFINE_CLS_IMPL(DocEntry); DEFINE_CLS_IMPL(DocSection); -DEFINE_CLS_IMPL(DocPreformatted); DEFINE_CLS_IMPL(DocVerbatim); +DEFINE_CLS_IMPL(DocCopy); +DEFINE_CLS_IMPL(DocTocList); +DEFINE_CLS_IMPL(DocTocItem); +DEFINE_CLS_IMPL(DocAnchor); DEFINE_CLS_IMPL(DocSymbol); DEFINE_CLS_IMPL(DocRoot); @@ -78,18 +83,20 @@ DEFINE_CLS_IMPL(DocRoot); class TextNode : public DocTextImpl { public: - TextNode(const QString &t,int markup) - : m_text(t), m_markup(markup) {} + TextNode(const QString &t,int markup,int level) + : m_text(t), m_markup(markup), m_headingLevel(level) {} virtual ~TextNode() {} // IDocText virtual Kind kind() const { return DocImpl::Text; } virtual const IString *text() const { return &m_text; } virtual int markup() const { return m_markup; } + virtual int headingLevel() const { return m_headingLevel; } private: StringImpl m_text; int m_markup; + int m_headingLevel; }; //----------------------------------------------------------------------------- @@ -100,18 +107,20 @@ class TextNode : public DocTextImpl class MarkupModifierNode : public DocMarkupModifierImpl { public: - MarkupModifierNode(int markup,bool enabled) - : m_markup(markup), m_enabled(enabled) {} + MarkupModifierNode(int markup,bool enabled,int level=0) + : m_markup(markup), m_enabled(enabled), m_headingLevel(level) {} virtual ~MarkupModifierNode() {} // IDocMarkupModifier virtual Kind kind() const { return DocImpl::MarkupModifier; } virtual bool enabled() const { return m_enabled; } virtual int markup() const { return m_markup; } + virtual int headingLevel() const { return m_headingLevel; } private: int m_markup; bool m_enabled; + int m_headingLevel; }; @@ -126,6 +135,7 @@ class MarkupHandler : public BaseFallBackHandler<MarkupHandler> MarkupHandler(QList<DocImpl> &children,QString &curString); virtual ~MarkupHandler(); int markup() const { return m_curMarkup; } + int headingLevel() const { return m_headingLevel; } virtual void startBold(const QXmlAttributes &attrib); virtual void endBold(); @@ -141,6 +151,20 @@ class MarkupHandler : public BaseFallBackHandler<MarkupHandler> virtual void endSubscript(); virtual void startSuperscript(const QXmlAttributes &attrib); virtual void endSuperscript(); + virtual void startPreformatted(const QXmlAttributes &attrib); + virtual void endPreformatted(); + virtual void startHeading1(const QXmlAttributes &attrib); + virtual void endHeading1(); + virtual void startHeading2(const QXmlAttributes &attrib); + virtual void endHeading2(); + virtual void startHeading3(const QXmlAttributes &attrib); + virtual void endHeading3(); + virtual void startHeading4(const QXmlAttributes &attrib); + virtual void endHeading4(); + virtual void startHeading5(const QXmlAttributes &attrib); + virtual void endHeading5(); + virtual void startHeading6(const QXmlAttributes &attrib); + virtual void endHeading6(); private: @@ -149,6 +173,7 @@ class MarkupHandler : public BaseFallBackHandler<MarkupHandler> QList<DocImpl> &m_children; QString &m_curString; int m_curMarkup; + int m_headingLevel; }; //----------------------------------------------------------------------------- @@ -190,8 +215,9 @@ class ParagraphHandler : public DocParaImpl, virtual void startDotFile(const QXmlAttributes& attrib); virtual void startIndexEntry(const QXmlAttributes& attrib); virtual void startTable(const QXmlAttributes& attrib); - virtual void startPreformatted(const QXmlAttributes& attrib); virtual void startVerbatim(const QXmlAttributes& attrib); + virtual void startHtmlOnly(const QXmlAttributes& attrib); + virtual void startLatexOnly(const QXmlAttributes& attrib); virtual void startUmlaut(const QXmlAttributes& attrib); virtual void startAcute(const QXmlAttributes& attrib); virtual void startGrave(const QXmlAttributes& attrib); @@ -202,6 +228,9 @@ class ParagraphHandler : public DocParaImpl, virtual void startRing(const QXmlAttributes& attrib); virtual void startNbsp(const QXmlAttributes& attrib); virtual void startCopy(const QXmlAttributes& attrib); + virtual void startAnchor(const QXmlAttributes& attrib); + virtual void startCopyDoc(const QXmlAttributes& attrib); + virtual void startTocList(const QXmlAttributes& attrib); ParagraphHandler(IBaseHandler *parent); virtual ~ParagraphHandler(); @@ -287,6 +316,61 @@ class OrderedListIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,Doc BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} }; +//----------------------------------------------------------------------------- + +/*! \brief Node representing table of contents list. + * + */ +class TocListHandler : public DocTocListImpl, public BaseHandler<TocListHandler> +{ + friend class TocListIterator; + public: + TocListHandler(IBaseHandler *parent); + virtual ~TocListHandler(); + virtual void startTocList(const QXmlAttributes& attrib); + virtual void endTocList(); + virtual void startTocItem(const QXmlAttributes& attrib); + + // IDocTocList + virtual Kind kind() const { return DocImpl::TocList; } + virtual IDocIterator *elements() const; + + private: + IBaseHandler *m_parent; + QList<DocImpl> m_children; +}; + +class TocListIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> +{ + public: + TocListIterator(const TocListHandler &handler) : + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} +}; + +//----------------------------------------------------------------------------- + +/*! \brief Node representing a table of contents item. + * + */ +class TocItemHandler : public DocTocItemImpl, public BaseHandler<TocItemHandler> +{ + friend class TocItemIterator; + public: + TocItemHandler(IBaseHandler *parent); + virtual ~TocItemHandler(); + virtual void startTocItem(const QXmlAttributes& attrib); + virtual void endTocItem(); + + // IDocItem + virtual Kind kind() const { return DocImpl::TocItem; } + virtual const IString *id() const { return &m_id; } + virtual const IString *title() const { return &m_title; } + + private: + IBaseHandler *m_parent; + StringImpl m_id; + StringImpl m_title; +}; //----------------------------------------------------------------------------- @@ -619,13 +703,14 @@ class VariableListEntryHandler : public DocVariableListEntryImpl, // IDocVariableListEntry virtual Kind kind() const { return DocImpl::VariableListEntry; } - virtual const IString *term() const { return &m_term; } + virtual ILinkedTextIterator *term() const; virtual IDocPara *description() const { return m_description; } private: - IBaseHandler *m_parent; - StringImpl m_term; - ParagraphHandler *m_description; + IBaseHandler* m_parent; + QList<LinkedTextImpl> m_term; + ParagraphHandler* m_description; + LinkedTextHandler* m_linkedTextHandler; }; //----------------------------------------------------------------------------- @@ -832,6 +917,29 @@ class ImageHandler : public DocImageImpl, public BaseHandler<ImageHandler> StringImpl m_caption; }; + +//----------------------------------------------------------------------------- +/*! \brief Node representing an anchor. + * + */ +// children: - +class AnchorHandler : public DocAnchorImpl, public BaseHandler<AnchorHandler> +{ + public: + AnchorHandler(IBaseHandler *parent); + virtual ~AnchorHandler(); + void startAnchor(const QXmlAttributes& attrib); + void endAnchor(); + + // IDocAnchor + virtual Kind kind() const { return DocImpl::Anchor; } + virtual const IString *id() const { return &m_id; } + + private: + IBaseHandler *m_parent; + StringImpl m_id; +}; + //----------------------------------------------------------------------------- /*! \brief Node representing a dot file. @@ -990,32 +1098,32 @@ class TableIterator : public BaseIteratorVia<IDocIterator,IDoc,RowHandler,DocImp //----------------------------------------------------------------------------- -/*! \brief Node representing an preformatted section +/*! \brief Node representing a copied piece of documentation. + * */ -class PreformattedHandler : public DocPreformattedImpl, - public BaseHandler<PreformattedHandler> +class CopyHandler : public DocCopyImpl, public BaseHandler<CopyHandler> { - friend class PreformattedIterator; + friend class CopyIterator; public: - PreformattedHandler(IBaseHandler *parent); - virtual ~PreformattedHandler(); - void startPreformatted(const QXmlAttributes& attrib); - void endPreformatted(); + CopyHandler(IBaseHandler *parent); + virtual ~CopyHandler(); + virtual void startCopy(const QXmlAttributes& attrib); + virtual void endCopy(); + virtual void startParagraph(const QXmlAttributes& attrib); - // IDocPreformatted + // IDocCopy + virtual Kind kind() const { return DocImpl::Copy; } virtual IDocIterator *contents() const; - virtual Kind kind() const { return DocImpl::Preformatted; } private: IBaseHandler *m_parent; QList<DocImpl> m_children; }; -class PreformattedIterator : - public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> +class CopyIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> { public: - PreformattedIterator(const PreformattedHandler &handler) : + CopyIterator(const CopyHandler &handler) : BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} }; @@ -1026,20 +1134,21 @@ class PreformattedIterator : class VerbatimHandler : public DocVerbatimImpl, public BaseHandler<VerbatimHandler> { - friend class VerbatimIterator; public: VerbatimHandler(IBaseHandler *parent); virtual ~VerbatimHandler(); - void startVerbatim(const QXmlAttributes& attrib); + void startVerbatim(const QXmlAttributes& attrib,Types type); void endVerbatim(); // IDocVerbatim virtual Kind kind() const { return DocImpl::Verbatim; } virtual const IString *text() const { return &m_text; } + virtual Types type() const { return m_type; } private: - IBaseHandler *m_parent; - StringImpl m_text; + IBaseHandler *m_parent; + StringImpl m_text; + Types m_type; }; diff --git a/addon/doxmlparser/src/doxmlintf.h b/addon/doxmlparser/src/doxmlintf.h index 7ab2c79..6432ee3 100644 --- a/addon/doxmlparser/src/doxmlintf.h +++ b/addon/doxmlparser/src/doxmlintf.h @@ -159,10 +159,13 @@ class IDoc Row, // 27 -> IDocRow Entry, // 28 -> IDocEntry Section, // 29 -> IDocSection - Preformatted, // 30 -> IDocPreformatted - Verbatim, // 31 -> IDocVerbatim - Symbol, // 32 -> IDocSymbol - Root // 33 -> IDocRoot + Verbatim, // 30 -> IDocVerbatim + Copy, // 31 -> IDocCopy + TocList, // 32 -> IDocTocList + TocItem, // 33 -> IDocTocItem + Anchor, // 34 -> IDocAnchor + Symbol, // 35 -> IDocSymbol + Root // 36 -> IDocRoot }; virtual Kind kind() const = 0; }; @@ -172,14 +175,16 @@ class IDocMarkup : public IDoc public: enum Markup { - Normal = 0x00, - Bold = 0x01, - Emphasis = 0x02, - ComputerOutput = 0x04, - Subscript = 0x08, - Superscript = 0x10, - SmallFont = 0x20, - Center = 0x40 + Normal = 0x000, + Bold = 0x001, + Emphasis = 0x002, + ComputerOutput = 0x004, + Subscript = 0x008, + Superscript = 0x010, + SmallFont = 0x020, + Center = 0x040, + Preformatted = 0x080, + Heading = 0x100 }; }; @@ -194,6 +199,7 @@ class IDocText : public IDocMarkup public: virtual const IString * text() const = 0; virtual int markup() const = 0; + virtual int headingLevel() const = 0; }; class IDocMarkupModifier : public IDoc @@ -201,6 +207,7 @@ class IDocMarkupModifier : public IDoc public: virtual bool enabled() const = 0; virtual int markup() const = 0; + virtual int headingLevel() const = 0; }; class IDocItemizedList : public IDoc @@ -278,7 +285,7 @@ class IDocVariableList : public IDoc class IDocVariableListEntry : public IDoc { public: - virtual const IString * term() const = 0; + virtual ILinkedTextIterator * term() const = 0; virtual IDocPara *description() const = 0; }; @@ -393,7 +400,20 @@ class IDocSection : public IDoc virtual IDocIterator *title() const = 0; }; -class IDocPreformatted : public IDoc +class IDocTocList : public IDoc +{ + public: + virtual IDocIterator *elements() const = 0; +}; + +class IDocTocItem : public IDoc +{ + public: + virtual const IString *id() const = 0; + virtual const IString *title() const = 0; +}; + +class IDocCopy : public IDoc { public: virtual IDocIterator *contents() const = 0; @@ -402,7 +422,15 @@ class IDocPreformatted : public IDoc class IDocVerbatim : public IDoc { public: + enum Types { Invalid = 0, HtmlOnly, LatexOnly, Verbatim }; virtual const IString *text() const = 0; + virtual Types type() const = 0; +}; + +class IDocAnchor : public IDoc +{ + public: + virtual const IString *id() const = 0; }; class IDocSymbol : public IDoc diff --git a/addon/doxmlparser/src/mainhandler.cpp b/addon/doxmlparser/src/mainhandler.cpp index 16d12b3..9de1e47 100644 --- a/addon/doxmlparser/src/mainhandler.cpp +++ b/addon/doxmlparser/src/mainhandler.cpp @@ -18,6 +18,8 @@ #include "compoundhandler.h" #include "sectionhandler.h" #include "graphhandler.h" +#include "dochandler.h" +#include "memberhandler.h" #include "debug.h" diff --git a/addon/doxmlparser/src/mainhandler.h b/addon/doxmlparser/src/mainhandler.h index 8385b57..4a10b4d 100644 --- a/addon/doxmlparser/src/mainhandler.h +++ b/addon/doxmlparser/src/mainhandler.h @@ -17,11 +17,11 @@ #define _MAINHANDLER_H #include <qlist.h> -#include "basehandler.h" -#include "compoundhandler.h" + #include <doxmlintf.h> -#include "memberhandler.h" +#include "basehandler.h" +class CompoundHandler; struct CompoundEntry; struct IndexEntry diff --git a/addon/doxmlparser/src/memberhandler.cpp b/addon/doxmlparser/src/memberhandler.cpp index ad35a91..d19fb82 100644 --- a/addon/doxmlparser/src/memberhandler.cpp +++ b/addon/doxmlparser/src/memberhandler.cpp @@ -18,6 +18,8 @@ #include "dochandler.h" #include "mainhandler.h" #include "linkedtexthandler.h" +#include "paramhandler.h" +#include "compoundhandler.h" #include "debug.h" //------------------------------------------------------------------------------ @@ -451,4 +453,60 @@ IMemberIterator *MemberHandler::enumValues() const return new MemberIterator(m_enumValues); } +ILinkedTextIterator *MemberHandler::type() const +{ + return new LinkedTextIterator(m_type); +} + +const IString *MemberHandler::typeString() const +{ + MemberHandler *that = (MemberHandler *)this; + that->m_typeString = LinkedTextHandler::toString(m_type); + return &m_typeString; +} + +IParamIterator *MemberHandler::parameters() const +{ + return new ParamIterator(m_params); +} + +IParamIterator *MemberHandler::templateParameters() const +{ + return m_hasTemplateParamList ? new ParamIterator(m_templateParams) : 0; +} + +IMemberReferenceIterator *MemberHandler::references() const +{ + return new MemberReferenceIterator(m_references); +} + +IMemberReferenceIterator *MemberHandler::referencedBy() const +{ + return new MemberReferenceIterator(m_referencedBy); +} + +ILinkedTextIterator *MemberHandler::initializer() const +{ + return new LinkedTextIterator(m_initializer); +} + +ILinkedTextIterator *MemberHandler::exceptions() const +{ + return new LinkedTextIterator(m_exception); +} + +IMemberReferenceIterator *MemberHandler::reimplementedBy() const +{ + return new MemberReferenceIterator(m_reimplementedBy); +} + +IDocRoot *MemberHandler::briefDescription() const +{ + return m_brief; +} + +IDocRoot *MemberHandler::detailedDescription() const +{ + return m_detailed; +} diff --git a/addon/doxmlparser/src/memberhandler.h b/addon/doxmlparser/src/memberhandler.h index 6280013..5fc43a4 100644 --- a/addon/doxmlparser/src/memberhandler.h +++ b/addon/doxmlparser/src/memberhandler.h @@ -23,14 +23,15 @@ #include "basehandler.h" #include "baseiterator.h" -#include "paramhandler.h" -#include "linkedtexthandler.h" -#include "dochandler.h" +#include "stringimpl.h" class MainHandler; class CompoundHandler; class SectionHandler; class ParamHandler; +class LinkedTextImpl; +class LinkedTextHandler; +class DocHandler; struct MemberReference : public IMemberReference { @@ -159,25 +160,14 @@ class MemberHandler : public IDefine, { return m_isConst; } virtual bool isVolatile() const { return m_isVolatile; } - virtual ILinkedTextIterator *type() const - { return new LinkedTextIterator(m_type); } - virtual const IString *typeString() const - { MemberHandler *that = (MemberHandler *)this; - that->m_typeString = LinkedTextHandler::toString(m_type); - return &m_typeString; - } - virtual IParamIterator *parameters() const - { return new ParamIterator(m_params); } - virtual IParamIterator *templateParameters() const - { return m_hasTemplateParamList ? new ParamIterator(m_templateParams) : 0; } - 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 ILinkedTextIterator *type() const; + virtual const IString *typeString() const; + virtual IParamIterator *parameters() const; + virtual IParamIterator *templateParameters() const; + virtual IMemberReferenceIterator *references() const; + virtual IMemberReferenceIterator *referencedBy() const; + virtual ILinkedTextIterator *initializer() const; + virtual ILinkedTextIterator *exceptions() const; virtual int bodyStart() const { return m_bodyStart; } virtual int bodyEnd() const @@ -188,12 +178,9 @@ class MemberHandler : public IDefine, { return m_defLine; } virtual IMemberReference *reimplements() const { return m_reimplements; } - virtual IMemberReferenceIterator *reimplementedBy() const - { return new MemberReferenceIterator(m_reimplementedBy); } - virtual IDocRoot *briefDescription() const - { return m_brief; } - virtual IDocRoot *detailedDescription() const - { return m_detailed; } + virtual IMemberReferenceIterator *reimplementedBy() const; + virtual IDocRoot *briefDescription() const; + virtual IDocRoot *detailedDescription() const; // IEnum virtual IMemberIterator *enumValues() const; diff --git a/addon/doxmlparser/src/paramhandler.cpp b/addon/doxmlparser/src/paramhandler.cpp index 0278e86..7fa2be4 100644 --- a/addon/doxmlparser/src/paramhandler.cpp +++ b/addon/doxmlparser/src/paramhandler.cpp @@ -15,6 +15,7 @@ #include "paramhandler.h" #include "memberhandler.h" +#include "linkedtexthandler.h" #include "debug.h" TemplateParamListHandler::TemplateParamListHandler(IBaseHandler *parent) : m_parent(parent) @@ -127,5 +128,14 @@ void ParamHandler::startDefVal(const QXmlAttributes& /*attrib*/) debug(2,"member defVal\n"); } +ILinkedTextIterator *ParamHandler::type() const +{ + return new LinkedTextIterator(m_type); +} + +ILinkedTextIterator *ParamHandler::defaultValue() const +{ + return new LinkedTextIterator(m_defVal); +} diff --git a/addon/doxmlparser/src/paramhandler.h b/addon/doxmlparser/src/paramhandler.h index 12cda44..074e2ac 100644 --- a/addon/doxmlparser/src/paramhandler.h +++ b/addon/doxmlparser/src/paramhandler.h @@ -24,7 +24,9 @@ #include "stringimpl.h" #include "basehandler.h" #include "baseiterator.h" -#include "linkedtexthandler.h" + +class LinkedTextImpl; +class LinkedTextHandler; class ParamHandler : public IParam, public BaseHandler<ParamHandler> @@ -43,14 +45,12 @@ class ParamHandler : public IParam, public BaseHandler<ParamHandler> virtual ~ParamHandler(); // IParam - virtual ILinkedTextIterator *type() const - { return new LinkedTextIterator(m_type); } + virtual ILinkedTextIterator *type() const; virtual const IString * declarationName() const { return &m_declName; } virtual const IString * definitionName() const { return &m_defName; } virtual const IString * attrib() const { return &m_attrib; } virtual const IString * arraySpecifier() const { return &m_array; } - virtual ILinkedTextIterator *defaultValue() const - { return new LinkedTextIterator(m_defVal); } + virtual ILinkedTextIterator *defaultValue() const; private: IBaseHandler *m_parent; diff --git a/addon/doxmlparser/src/sectionhandler.cpp b/addon/doxmlparser/src/sectionhandler.cpp index a1d9c44..dee05f0 100644 --- a/addon/doxmlparser/src/sectionhandler.cpp +++ b/addon/doxmlparser/src/sectionhandler.cpp @@ -16,6 +16,7 @@ #include "mainhandler.h" #include "compoundhandler.h" #include "sectionhandler.h" +#include "memberhandler.h" #include "debug.h" class SectionTypeMap @@ -126,4 +127,8 @@ void SectionHandler::initialize(CompoundHandler *ch) } } +IMemberIterator *SectionHandler::members() const +{ + return new MemberIterator(m_members); +} diff --git a/addon/doxmlparser/src/sectionhandler.h b/addon/doxmlparser/src/sectionhandler.h index 9ecc85e..36705ea 100644 --- a/addon/doxmlparser/src/sectionhandler.h +++ b/addon/doxmlparser/src/sectionhandler.h @@ -22,7 +22,6 @@ #include <doxmlintf.h> #include "basehandler.h" -#include "memberhandler.h" class MainHandler; @@ -50,8 +49,7 @@ class SectionHandler : public ISection, public BaseHandler<SectionHandler> { return &m_kindString; } virtual SectionKind kind() const { return m_kind; } - virtual IMemberIterator *members() const - { return new MemberIterator(m_members); } + virtual IMemberIterator *members() const; virtual bool isStatic() const { return m_kind==PubStatFuncs || m_kind==PubStatAttribs || diff --git a/addon/doxmlparser/test/main.cpp b/addon/doxmlparser/test/main.cpp index 067dfc9..3addfa9 100644 --- a/addon/doxmlparser/test/main.cpp +++ b/addon/doxmlparser/test/main.cpp @@ -73,14 +73,16 @@ void DumpDoc(IDoc *doc,int level) { IDocText *txt = dynamic_cast<IDocText*>(doc); ASSERT(txt!=0); - InPrint(("<text value=`%s' markup=%d/>\n",txt->text()->latin1(),txt->markup())); + InPrint(("<text value=`%s' markup=%d headingLevel=%d/>\n", + txt->text()->latin1(),txt->markup(),txt->headingLevel())); } break; case IDoc::MarkupModifier: { IDocMarkupModifier *md = dynamic_cast<IDocMarkupModifier*>(doc); ASSERT(md!=0); - InPrint(("<markup modifier enabled=%d markup=%d/>\n",md->enabled(),md->markup())); + InPrint(("<markup modifier enabled=%d markup=%d headingLevel=%d/>\n", + md->enabled(),md->markup(),md->headingLevel())); } break; case IDoc::ItemizedList: @@ -203,7 +205,10 @@ void DumpDoc(IDoc *doc,int level) { IDocVariableListEntry *vle = dynamic_cast<IDocVariableListEntry*>(doc); ASSERT(vle!=0); - InPrint(("<variablelistentry term=%s>\n",vle->term()->latin1())); + ILinkedTextIterator *lti = vle->term(); + QString term = linkedTextToString(lti); + lti->release(); + InPrint(("<variablelistentry term=%s>\n",term.latin1())); DumpDoc(vle->description(),level+1); InPrint(("<variablelistentry/>\n")); } @@ -255,7 +260,7 @@ void DumpDoc(IDoc *doc,int level) DumpDoc(cl,level+1); } cli->release(); - InPrint(("<programlisting/>\n")); + InPrint(("</programlisting>\n")); } break; case IDoc::CodeLine: @@ -270,7 +275,7 @@ void DumpDoc(IDoc *doc,int level) DumpDoc(ce,level+1); } cei->release(); - InPrint(("<codeline/>\n")); + InPrint(("</codeline>\n")); } break; case IDoc::Highlight: @@ -373,31 +378,70 @@ void DumpDoc(IDoc *doc,int level) { DumpDoc(pdoc,level+1); } - InPrint(("<section/>\n")); + InPrint(("</section>\n")); + } + break; + case IDoc::Copy: + { + IDocCopy *cpy = dynamic_cast<IDocCopy*>(doc); + ASSERT(cpy!=0); + InPrint(("<copydoc>\n")); + IDocIterator *di = cpy->contents(); + IDoc *pdoc; + for (di->toFirst();(pdoc=di->current());di->toNext()) + { + DumpDoc(pdoc,level+1); + } + di->release(); + InPrint(("<copydoc/>\n")); } break; - case IDoc::Preformatted: + case IDoc::TocItem: { - InPrint(("<preformatted>\n")); - IDocPreformatted *pf = dynamic_cast<IDocPreformatted*>(doc); - ASSERT(pf!=0); - IDocIterator *di = pf->contents(); + IDocTocItem *ti = dynamic_cast<IDocTocItem*>(doc); + ASSERT(ti!=0); + InPrint(("<tocitem id=\"%s\" title=\"%s\"/>\n", + ti->id()->latin1(),ti->title()->latin1())); + } + break; + case IDoc::TocList: + { + IDocTocList *tl = dynamic_cast<IDocTocList*>(doc); + ASSERT(tl!=0); + InPrint(("<toclist>\n")); + IDocIterator *di = tl->elements(); IDoc *pdoc; for (di->toFirst();(pdoc=di->current());di->toNext()) { DumpDoc(pdoc,level+1); } di->release(); - InPrint(("<preformatted/>\n")); + InPrint(("<toclist/>\n")); } break; case IDoc::Verbatim: { - InPrint(("<verbatim>\n")); IDocVerbatim *vt = dynamic_cast<IDocVerbatim*>(doc); ASSERT(vt!=0); + const char *s=0; + switch (vt->type()) + { + case IDocVerbatim::Verbatim: s="verbatim"; break; + case IDocVerbatim::HtmlOnly: s="htmlonly"; break; + case IDocVerbatim::LatexOnly: s="latexonly"; break; + default: + printf("Invalid verbatim type!\n"); + } + InPrint(("<verbatim %s>\n",s)); InPrint(("%s",vt->text()->latin1())); - InPrint(("<verbatim/>\n")); + InPrint(("</verbatim>\n")); + } + break; + case IDoc::Anchor: + { + IDocAnchor *anc = dynamic_cast<IDocAnchor*>(doc); + ASSERT(anc!=0); + InPrint(("<anchor id='%s'/>\n",anc->id()->latin1())); } break; case IDoc::Symbol: @@ -420,7 +464,7 @@ void DumpDoc(IDoc *doc,int level) DumpDoc(pdoc,level+1); } di->release(); - InPrint(("<root/>\n")); + InPrint(("</root>\n")); } break; |