diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2003-07-25 12:37:34 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2003-07-25 12:37:34 (GMT) |
commit | 16a0bd88cfa8d3134b9b8dcae52652801595338c (patch) | |
tree | 5648b4ab8fb4ca6051647d47c3e8cf8d621e8782 /addon/doxmlparser/src | |
parent | aee36e26c595fa69c0bdbba3c470ba8b7b153dac (diff) | |
download | Doxygen-16a0bd88cfa8d3134b9b8dcae52652801595338c.zip Doxygen-16a0bd88cfa8d3134b9b8dcae52652801595338c.tar.gz Doxygen-16a0bd88cfa8d3134b9b8dcae52652801595338c.tar.bz2 |
Release-1.3.3
Diffstat (limited to 'addon/doxmlparser/src')
-rw-r--r-- | addon/doxmlparser/src/dochandler.cpp | 167 | ||||
-rw-r--r-- | addon/doxmlparser/src/dochandler.h | 92 | ||||
-rw-r--r-- | addon/doxmlparser/src/doxmlintf.h | 16 | ||||
-rw-r--r-- | addon/doxmlparser/src/graphhandler.cpp | 4 | ||||
-rw-r--r-- | addon/doxmlparser/src/mainhandler.cpp | 4 | ||||
-rw-r--r-- | addon/doxmlparser/src/memberhandler.cpp | 8 |
6 files changed, 193 insertions, 98 deletions
diff --git a/addon/doxmlparser/src/dochandler.cpp b/addon/doxmlparser/src/dochandler.cpp index a44f7e1..7a2113a 100644 --- a/addon/doxmlparser/src/dochandler.cpp +++ b/addon/doxmlparser/src/dochandler.cpp @@ -2006,20 +2006,25 @@ IDocIterator *ParagraphHandler::contents() const //---------------------------------------------------------------------- DocSectionHandler::DocSectionHandler(IBaseHandler *parent,int level) - : m_parent(parent), m_level(level) + : m_parent(parent), m_internal(0), m_level(level), m_title(0) { - m_children.setAutoDelete(TRUE); - m_markupHandler = new MarkupHandler(m_children,m_curString); - setFallBackHandler(m_markupHandler); - addStartHandler("ref",this,&DocSectionHandler::startRef); QString sectionKey; + m_paragraphs.setAutoDelete(TRUE); + m_subsections.setAutoDelete(TRUE); + addStartHandler("title",this,&DocSectionHandler::startTitle); + addStartHandler("para",this,&DocSectionHandler::startParagraph); + if (level<6) + { + sectionKey.sprintf("sect%d",level+1); + addStartHandler(sectionKey,this,&DocSectionHandler::startSubSection); + } + addStartHandler("internal",this,&DocSectionHandler::startInternal); sectionKey.sprintf("sect%d",level); addEndHandler(sectionKey,this,&DocSectionHandler::endDocSection); } DocSectionHandler::~DocSectionHandler() { - delete m_markupHandler; } void DocSectionHandler::startDocSection(const QXmlAttributes& attrib) @@ -2027,44 +2032,112 @@ void DocSectionHandler::startDocSection(const QXmlAttributes& attrib) m_parent->setDelegate(this); debug(2,"Start docsection\n"); m_id = attrib.value("id"); - m_curString=""; } void DocSectionHandler::endDocSection() { - addTextNode(); m_parent->setDelegate(0); debug(2,"End docsection\n"); } -void DocSectionHandler::addTextNode() +void DocSectionHandler::startSubSection(const QXmlAttributes& attrib) { - if (!m_curString.isEmpty()) - { - 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=""; - } + DocSectionHandler *secHandler = new DocSectionHandler(this,m_level+1); + secHandler->startDocSection(attrib); + m_subsections.append(secHandler); } -void DocSectionHandler::startRef(const QXmlAttributes& attrib) +void DocSectionHandler::startParagraph(const QXmlAttributes& attrib) +{ + ParagraphHandler *parHandler = new ParagraphHandler(this); + parHandler->startParagraph(attrib); + m_paragraphs.append(parHandler); +} + +void DocSectionHandler::startInternal(const QXmlAttributes& attrib) +{ + m_internal = new DocInternalHandler(this,m_level); + m_internal->startInternal(attrib); +} + +void DocSectionHandler::startTitle(const QXmlAttributes& attrib) +{ + m_title = new TitleHandler(this); + m_title->startTitle(attrib); +} + +IDocIterator *DocSectionHandler::paragraphs() const +{ + return new DocSectionParaIterator(*this); +} + +IDocIterator *DocSectionHandler::subSections() const +{ + return new DocSectionSubIterator(*this); +} + +IDocInternal *DocSectionHandler::internal() const +{ + return m_internal; +} + +//---------------------------------------------------------------------- +// DocInternal +//---------------------------------------------------------------------- + +DocInternalHandler::DocInternalHandler(IBaseHandler *parent,int level) + : m_parent(parent), m_level(level) +{ + m_paragraphs.setAutoDelete(TRUE); + m_subsections.setAutoDelete(TRUE); + addStartHandler("para",this,&DocInternalHandler::startParagraph); + QString sectionKey; + sectionKey.sprintf("sect%d",level+1); + addStartHandler(sectionKey,this,&DocInternalHandler::startSubSection); + addEndHandler("internal",this,&DocInternalHandler::endInternal); +} + +DocInternalHandler::~DocInternalHandler() { - RefHandler *ref = new RefHandler(this); - ref->startRef(attrib); - m_children.append(ref); } -IDocIterator *DocSectionHandler::title() const +void DocInternalHandler::startInternal(const QXmlAttributes&) { - return new DocSectionIterator(*this); + m_parent->setDelegate(this); + debug(2,"Start internal\n"); +} + +void DocInternalHandler::endInternal() +{ + m_parent->setDelegate(0); + debug(2,"End internal\n"); +} + +void DocInternalHandler::startSubSection(const QXmlAttributes& attrib) +{ + DocSectionHandler *secHandler = new DocSectionHandler(this,m_level+1); + secHandler->startDocSection(attrib); + m_subsections.append(secHandler); } +void DocInternalHandler::startParagraph(const QXmlAttributes& attrib) +{ + ParagraphHandler *parHandler = new ParagraphHandler(this); + parHandler->startParagraph(attrib); + m_paragraphs.append(parHandler); +} + +IDocIterator *DocInternalHandler::paragraphs() const +{ + return new DocInternalParaIterator(*this); +} + +IDocIterator *DocInternalHandler::subSections() const +{ + return new DocInternalSubIterator(*this); +} + + //---------------------------------------------------------------------- // DocHandler //---------------------------------------------------------------------- @@ -2079,11 +2152,6 @@ DocHandler::DocHandler(IBaseHandler *parent) : m_parent(parent) addStartHandler("para",this,&DocHandler::startParagraph); addStartHandler("sect1",this,&DocHandler::startSect1); - addStartHandler("sect2",this,&DocHandler::startSect2); - addStartHandler("sect3",this,&DocHandler::startSect3); - addStartHandler("sect4",this,&DocHandler::startSect4); - addStartHandler("sect5",this,&DocHandler::startSect5); - addStartHandler("sect6",this,&DocHandler::startSect6); addStartHandler("title",this,&DocHandler::startTitle); addStartHandler("internal"); } @@ -2118,41 +2186,6 @@ void DocHandler::startSect1(const QXmlAttributes& attrib) m_children.append(secHandler); } -void DocHandler::startSect2(const QXmlAttributes& attrib) -{ - DocSectionHandler *secHandler = new DocSectionHandler(this,2); - secHandler->startDocSection(attrib); - m_children.append(secHandler); -} - -void DocHandler::startSect3(const QXmlAttributes& attrib) -{ - DocSectionHandler *secHandler = new DocSectionHandler(this,3); - secHandler->startDocSection(attrib); - m_children.append(secHandler); -} - -void DocHandler::startSect4(const QXmlAttributes& attrib) -{ - DocSectionHandler *secHandler = new DocSectionHandler(this,4); - secHandler->startDocSection(attrib); - m_children.append(secHandler); -} - -void DocHandler::startSect5(const QXmlAttributes& attrib) -{ - DocSectionHandler *secHandler = new DocSectionHandler(this,5); - secHandler->startDocSection(attrib); - m_children.append(secHandler); -} - -void DocHandler::startSect6(const QXmlAttributes& attrib) -{ - DocSectionHandler *secHandler = new DocSectionHandler(this,6); - secHandler->startDocSection(attrib); - m_children.append(secHandler); -} - void DocHandler::startTitle(const QXmlAttributes& attrib) { TitleHandler *titleHandler = new TitleHandler(this); diff --git a/addon/doxmlparser/src/dochandler.h b/addon/doxmlparser/src/dochandler.h index 349e955..e508bd6 100644 --- a/addon/doxmlparser/src/dochandler.h +++ b/addon/doxmlparser/src/dochandler.h @@ -26,6 +26,7 @@ #include "baseiterator.h" class ParagraphHandler; +class DocInternalHandler; class LinkedTextImpl; class LinkedTextHandler; @@ -72,6 +73,7 @@ DEFINE_CLS_IMPL(DocTocList); DEFINE_CLS_IMPL(DocTocItem); DEFINE_CLS_IMPL(DocAnchor); DEFINE_CLS_IMPL(DocSymbol); +DEFINE_CLS_IMPL(DocInternal); DEFINE_CLS_IMPL(DocRoot); //----------------------------------------------------------------------------- @@ -1186,44 +1188,97 @@ class SymbolHandler : public DocSymbolImpl, public BaseHandler<SymbolHandler> /*! \brief Node representing a section. * */ -// children: text, ref -// children handled by MarkupHandler: -// bold, computeroutput, emphasis, center, -// small, subscript, superscript. +// children: title, para, sect(n+1) class DocSectionHandler : public DocSectionImpl, public BaseHandler<DocSectionHandler> { - friend class DocSectionIterator; + friend class DocSectionParaIterator; + friend class DocSectionSubIterator; public: DocSectionHandler(IBaseHandler *parent,int level); virtual ~DocSectionHandler(); virtual void startDocSection(const QXmlAttributes& attrib); virtual void endDocSection(); - virtual void startRef(const QXmlAttributes& attrib); - void addTextNode(); + virtual void startTitle(const QXmlAttributes& attrib); + virtual void startSubSection(const QXmlAttributes& attrib); + virtual void startParagraph(const QXmlAttributes& attrib); + virtual void startInternal(const QXmlAttributes& attrib); // IDocSection virtual Kind kind() const { return DocImpl::Section; } virtual const IString *id() const { return &m_id; } virtual int level() const { return m_level; } - virtual IDocIterator *title() const; + virtual IDocTitle *title() const { return m_title; } + virtual IDocIterator *paragraphs() const; + virtual IDocIterator *subSections() const; + virtual IDocInternal *internal() const; private: - IBaseHandler *m_parent; - QList<DocImpl> m_children; - MarkupHandler *m_markupHandler; - StringImpl m_id; - int m_level; + IBaseHandler *m_parent; + QList<DocImpl> m_paragraphs; + QList<DocImpl> m_subsections; + DocInternalHandler *m_internal; + StringImpl m_id; + int m_level; + TitleHandler *m_title; }; -class DocSectionIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> +class DocSectionParaIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> { public: - DocSectionIterator(const DocSectionHandler &handler) : - BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} + DocSectionParaIterator(const DocSectionHandler &handler) : + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_paragraphs) {} +}; + +class DocSectionSubIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> +{ + public: + DocSectionSubIterator(const DocSectionHandler &handler) : + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_subsections) {} }; //----------------------------------------------------------------------------- +class DocInternalHandler : public DocInternalImpl, public BaseHandler<DocInternalHandler> +{ + public: + friend class DocInternalParaIterator; + friend class DocInternalSubIterator; + DocInternalHandler(IBaseHandler *parent,int level); + virtual ~DocInternalHandler(); + virtual void startInternal(const QXmlAttributes& attrib); + virtual void endInternal(); + virtual void startSubSection(const QXmlAttributes& attrib); + virtual void startParagraph(const QXmlAttributes& attrib); + + // IDocInternal + virtual Kind kind() const { return DocImpl::Internal; } + virtual IDocIterator *paragraphs() const; + virtual IDocIterator *subSections() const; + + private: + IBaseHandler *m_parent; + QList<DocImpl> m_paragraphs; + QList<DocImpl> m_subsections; + int m_level; +}; + +class DocInternalParaIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> +{ + public: + DocInternalParaIterator(const DocInternalHandler &handler) : + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_paragraphs) {} +}; + +class DocInternalSubIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> +{ + public: + DocInternalSubIterator(const DocInternalHandler &handler) : + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_subsections) {} +}; + + +//----------------------------------------------------------------------------- + /*! \brief Node representing a documentation block. * */ @@ -1236,11 +1291,6 @@ class DocHandler : public DocRootImpl, public BaseHandler<DocHandler> virtual void endDoc(); virtual void startParagraph(const QXmlAttributes& attrib); virtual void startSect1(const QXmlAttributes& attrib); - virtual void startSect2(const QXmlAttributes& attrib); - virtual void startSect3(const QXmlAttributes& attrib); - virtual void startSect4(const QXmlAttributes& attrib); - virtual void startSect5(const QXmlAttributes& attrib); - virtual void startSect6(const QXmlAttributes& attrib); virtual void startTitle(const QXmlAttributes& attrib); DocHandler(IBaseHandler *parent); diff --git a/addon/doxmlparser/src/doxmlintf.h b/addon/doxmlparser/src/doxmlintf.h index 3f7762c..51a6191 100644 --- a/addon/doxmlparser/src/doxmlintf.h +++ b/addon/doxmlparser/src/doxmlintf.h @@ -32,6 +32,7 @@ class IDocIterator; class ICompound; class ISection; class INode; +class IDocInternal; /*! \brief Read only interface to a string. */ @@ -165,7 +166,8 @@ class IDoc TocItem, // 33 -> IDocTocItem Anchor, // 34 -> IDocAnchor Symbol, // 35 -> IDocSymbol - Root // 36 -> IDocRoot + Internal, // 36 -> IDocInternal + Root // 37 -> IDocRoot }; virtual Kind kind() const = 0; }; @@ -397,7 +399,17 @@ class IDocSection : public IDoc public: virtual const IString * id() const = 0; virtual int level() const = 0; - virtual IDocIterator *title() const = 0; + virtual IDocTitle *title() const = 0; + virtual IDocIterator *paragraphs() const = 0; + virtual IDocIterator *subSections() const = 0; + virtual IDocInternal *internal() const = 0; +}; + +class IDocInternal : public IDoc +{ + public: + virtual IDocIterator *paragraphs() const = 0; + virtual IDocIterator *subSections() const = 0; }; class IDocTocList : public IDoc diff --git a/addon/doxmlparser/src/graphhandler.cpp b/addon/doxmlparser/src/graphhandler.cpp index a11273d..7816970 100644 --- a/addon/doxmlparser/src/graphhandler.cpp +++ b/addon/doxmlparser/src/graphhandler.cpp @@ -110,7 +110,7 @@ void NodeHandler::endNode() void NodeHandler::startLink(const QXmlAttributes &attrib) { - m_link = attrib.value("id"); + m_link = attrib.value("refid"); } void NodeHandler::endLink() @@ -156,7 +156,7 @@ ChildNodeHandler::~ChildNodeHandler() void ChildNodeHandler::startChildNode(const QXmlAttributes &attrib) { debug(2,"startChildNode\n"); - m_id = attrib.value("id"); + m_id = attrib.value("refid"); m_relationString = attrib.value("relation"); m_relation = s_edgeRelationMapper->stringToNodeRelation(m_relationString); m_parent->setDelegate(this); diff --git a/addon/doxmlparser/src/mainhandler.cpp b/addon/doxmlparser/src/mainhandler.cpp index d6fcb2b..09d12c7 100644 --- a/addon/doxmlparser/src/mainhandler.cpp +++ b/addon/doxmlparser/src/mainhandler.cpp @@ -94,8 +94,8 @@ MainHandler::MainHandler() : m_compoundDict(2999), m_compoundNameDict(2999), { m_compounds.setAutoDelete(TRUE); m_memberNameDict.setAutoDelete(TRUE); - addStartHandler("doxygen"); - addEndHandler("doxygen"); + addStartHandler("doxygenindex"); + addEndHandler("doxygenindex"); addStartHandler("compound",this,&MainHandler::startCompound); addEndHandler("compound"); addStartHandler("member",this,&MainHandler::startMember); diff --git a/addon/doxmlparser/src/memberhandler.cpp b/addon/doxmlparser/src/memberhandler.cpp index 062ea4a..a46df85 100644 --- a/addon/doxmlparser/src/memberhandler.cpp +++ b/addon/doxmlparser/src/memberhandler.cpp @@ -285,7 +285,7 @@ void MemberHandler::startLocation(const QXmlAttributes& attrib) void MemberHandler::startReferences(const QXmlAttributes& attrib) { MemberReference *mr = new MemberReference; - mr->m_memId = attrib.value("id"); + mr->m_memId = attrib.value("refid"); m_references.append(mr); m_curString=""; } @@ -298,7 +298,7 @@ void MemberHandler::endReferences() void MemberHandler::startReferencedBy(const QXmlAttributes& attrib) { MemberReference *mr = new MemberReference; - mr->m_memId = attrib.value("id"); + mr->m_memId = attrib.value("refid"); m_referencedBy.append(mr); m_curString=""; } @@ -311,7 +311,7 @@ void MemberHandler::endReferencedBy() void MemberHandler::startReimplements(const QXmlAttributes& attrib) { m_reimplements = new MemberReference; - m_reimplements->m_memId = attrib.value("id"); + m_reimplements->m_memId = attrib.value("refid"); m_curString=""; } @@ -323,7 +323,7 @@ void MemberHandler::endReimplements() void MemberHandler::startReimplementedBy(const QXmlAttributes& attrib) { MemberReference *mr = new MemberReference; - mr->m_memId = attrib.value("id"); + mr->m_memId = attrib.value("refid"); m_reimplementedBy.append(mr); m_curString=""; } |