diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2002-10-20 18:23:06 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2002-10-20 18:23:06 (GMT) |
commit | 7c34dd2b1594925d0a012e9ba290bf9c80574db5 (patch) | |
tree | 63a7ba72ad4f8318f818aebfef29beee5811c241 /addon/doxmlparser | |
parent | 2c6d31c8bf31028ba2f822c31f4812c2cecab306 (diff) | |
download | Doxygen-7c34dd2b1594925d0a012e9ba290bf9c80574db5.zip Doxygen-7c34dd2b1594925d0a012e9ba290bf9c80574db5.tar.gz Doxygen-7c34dd2b1594925d0a012e9ba290bf9c80574db5.tar.bz2 |
Release-1.2.18-20021020
Diffstat (limited to 'addon/doxmlparser')
-rw-r--r-- | addon/doxmlparser/include/doxmlintf.h | 46 | ||||
-rw-r--r-- | addon/doxmlparser/src/basehandler.h | 6 | ||||
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.cpp | 35 | ||||
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.h | 66 | ||||
-rw-r--r-- | addon/doxmlparser/src/dochandler.cpp | 205 | ||||
-rw-r--r-- | addon/doxmlparser/src/dochandler.h | 78 | ||||
-rw-r--r-- | addon/doxmlparser/src/doxmlintf.h | 46 | ||||
-rw-r--r-- | addon/doxmlparser/src/mainhandler.cpp | 6 | ||||
-rw-r--r-- | addon/doxmlparser/src/memberhandler.cpp | 22 | ||||
-rw-r--r-- | addon/doxmlparser/src/memberhandler.h | 12 | ||||
-rw-r--r-- | addon/doxmlparser/src/paramhandler.cpp | 33 | ||||
-rw-r--r-- | addon/doxmlparser/src/paramhandler.h | 21 | ||||
-rw-r--r-- | addon/doxmlparser/src/stringimpl.h | 2 | ||||
-rw-r--r-- | addon/doxmlparser/test/main.cpp | 28 |
14 files changed, 524 insertions, 82 deletions
diff --git a/addon/doxmlparser/include/doxmlintf.h b/addon/doxmlparser/include/doxmlintf.h index d0d3c2a..55eb946 100644 --- a/addon/doxmlparser/include/doxmlintf.h +++ b/addon/doxmlparser/include/doxmlintf.h @@ -131,8 +131,8 @@ class IDoc enum Kind { Invalid = 0, // 0 - Para = 1, // 1 -> IDocPara - Text = 2, // 2 -> IDocText + Para, // 1 -> IDocPara + Text, // 2 -> IDocText MarkupModifier, // 3 -> IDocMarkupModifier ItemizedList, // 4 -> IDocItemizedList OrderedList, // 5 -> IDocOrderedList @@ -160,7 +160,9 @@ class IDoc Row, // 27 -> IDocRow Entry, // 28 -> IDocEntry Section, // 29 -> IDocSection - Root, // 30 -> IDocRoot + Preformatted, // 30 -> IDocPreformatted + Symbol, // 31 -> IDocSymbol + Root // 32 -> IDocRoot }; virtual Kind kind() const = 0; }; @@ -177,10 +179,8 @@ class IDocMarkup : public IDoc Subscript = 0x08, Superscript = 0x10, SmallFont = 0x20, - Center = 0x40, - Preformatted = 0x80 + Center = 0x40 }; - }; class IDocPara : public IDoc @@ -393,6 +393,24 @@ class IDocSection : public IDoc virtual IDocIterator *title() const = 0; }; +class IDocPreformatted : public IDoc +{ + public: + virtual IDocIterator *contents() const = 0; +}; + +class IDocSymbol : public IDoc +{ + public: + enum Types + { Invalid = 0, + Umlaut, Acute, Grave, Circ, Tilde, Szlig, Cedil, Ring, Nbsp, Copy + }; + virtual Types type() const = 0; + virtual const IString * typeString() const = 0; + virtual char letter() const = 0; +}; + class IDocRoot : public IDoc { public: @@ -737,15 +755,15 @@ class IClass : public ICompound virtual IRelatedCompoundIterator *baseCompounds() const = 0; virtual IRelatedCompoundIterator *derivedCompounds() const = 0; virtual ICompoundIterator *nestedCompounds() const = 0; + virtual IParamIterator *templateParameters() const = 0; + virtual const IString *locationFile() const = 0; + virtual int locationLine() const = 0; + virtual int locationBodyStartLine() const = 0; + virtual int locationBodyEndLine() const = 0; // TODO: // class: - // ITemplateParamListIterator *templateParamLists() // listOfAllMembers() - // locationFile() - // locationLine() - // locationBodyStartLine() - // locationBodyEndLine() }; /*! \brief The interface to a struct in the object model. @@ -756,6 +774,10 @@ class IStruct : public ICompound virtual ICompoundIterator *nestedCompounds() const = 0; virtual IRelatedCompoundIterator *baseCompounds() const = 0; virtual IRelatedCompoundIterator *derivedCompounds() const = 0; + virtual const IString *locationFile() const = 0; + virtual int locationLine() const = 0; + virtual int locationBodyStartLine() const = 0; + virtual int locationBodyEndLine() const = 0; }; /*! \brief The interface to a union in the object model. @@ -822,6 +844,8 @@ class IGroup : public ICompound */ class IPage : public ICompound { + public: + virtual const IDocTitle *title() const = 0; }; /*! Root node of the object model. */ diff --git a/addon/doxmlparser/src/basehandler.h b/addon/doxmlparser/src/basehandler.h index 0fb59bd..6137259 100644 --- a/addon/doxmlparser/src/basehandler.h +++ b/addon/doxmlparser/src/basehandler.h @@ -75,11 +75,11 @@ template<class T> class ElementMapper Handler m_handler; }; + public: typedef StartElementHandler StartElementHandlerT; typedef EndElementHandler EndElementHandlerT; - - public: - ElementMapper() : m_startHandlers(67), m_endHandlers(67) + + ElementMapper() : m_startHandlers(67), m_endHandlers(67) { m_startHandlers.setAutoDelete(TRUE); m_endHandlers.setAutoDelete(TRUE); diff --git a/addon/doxmlparser/src/compoundhandler.cpp b/addon/doxmlparser/src/compoundhandler.cpp index 62275ce..623ac71 100644 --- a/addon/doxmlparser/src/compoundhandler.cpp +++ b/addon/doxmlparser/src/compoundhandler.cpp @@ -145,15 +145,15 @@ CompoundHandler::CompoundHandler(const QString &xmlDir) : m_brief(0), m_detailed(0), m_programListing(0), m_xmlDir(xmlDir), m_refCount(1), m_memberDict(257), m_memberNameDict(257), m_mainHandler(0), m_inheritanceGraph(0), m_collaborationGraph(0), - m_includeDependencyGraph(0), m_includedByDependencyGraph(0), - m_hasTemplateParams(FALSE) + m_includeDependencyGraph(0), m_includedByDependencyGraph(0), m_templateParamList(0), + m_titleHandler(0) { m_superClasses.setAutoDelete(TRUE); m_subClasses.setAutoDelete(TRUE); m_sections.setAutoDelete(TRUE); m_memberNameDict.setAutoDelete(TRUE); m_innerCompounds.setAutoDelete(TRUE); - m_templateParams.setAutoDelete(TRUE); + m_params.setAutoDelete(TRUE); addStartHandler("doxygen"); addEndHandler("doxygen"); @@ -201,16 +201,19 @@ CompoundHandler::CompoundHandler(const QString &xmlDir) addStartHandler("innergroup",this,&CompoundHandler::startInnerGroup); addEndHandler("innergroup"); - addStartHandler("templateparamlist"); + addStartHandler("templateparamlist",this,&CompoundHandler::startTemplateParamList); addEndHandler("templateparamlist"); addStartHandler("param",this,&CompoundHandler::startParam); addEndHandler("param"); + + addStartHandler("title",this,&CompoundHandler::startTitle); } CompoundHandler::~CompoundHandler() { debug(2,"CompoundHandler::~CompoundHandler()\n"); + delete m_titleHandler; delete m_brief; delete m_detailed; delete m_programListing; @@ -265,6 +268,8 @@ void CompoundHandler::startLocation(const QXmlAttributes& attrib) { m_defFile = attrib.value("file"); m_defLine = attrib.value("line").toInt(); + m_defBodyStart = attrib.value("bodystart").toInt(); + m_defBodyEnd = attrib.value("bodyend").toInt(); } void CompoundHandler::endCompoundName() @@ -295,10 +300,15 @@ void CompoundHandler::startInnerGroup(const QXmlAttributes& attrib) void CompoundHandler::startParam(const QXmlAttributes& attrib) { - m_hasTemplateParams = TRUE; ParamHandler *ph = new ParamHandler(this); ph->startParam(attrib); - m_templateParams.append(ph); + m_params.append(ph); +} + +void CompoundHandler::startTemplateParamList(const QXmlAttributes& attrib) +{ + m_templateParamList = new TemplateParamListHandler(this); + m_templateParamList->startParam(attrib); } void CompoundHandler::addSuperClass(const QXmlAttributes& attrib) @@ -349,6 +359,13 @@ void CompoundHandler::addSubClass(const QXmlAttributes& attrib) m_subClasses.append(sc); } +void CompoundHandler::startTitle(const QXmlAttributes& attrib) +{ + ASSERT(m_titleHandler==0); + m_titleHandler = new TitleHandler(this); + m_titleHandler->startTitle(attrib); +} + bool CompoundHandler::parseXML(const char *compId) { QFile xmlFile(m_xmlDir+"/"+compId+".xml"); @@ -506,6 +523,10 @@ IDocProgramListing *CompoundHandler::source() const IParamIterator *CompoundHandler::templateParameters() const { - return m_hasTemplateParams ? new ParamIterator(m_templateParams) : 0; + return m_templateParamList ? m_templateParamList->templateParams() : 0; } +const IDocTitle *CompoundHandler::title() const +{ + return m_titleHandler; +} diff --git a/addon/doxmlparser/src/compoundhandler.h b/addon/doxmlparser/src/compoundhandler.h index ae567b6..b099be4 100644 --- a/addon/doxmlparser/src/compoundhandler.h +++ b/addon/doxmlparser/src/compoundhandler.h @@ -32,7 +32,8 @@ class MemberHandler; class CompoundHandler; class SectionHandler; class ParamHandler; - +class TemplateParamListHandler; +class TitleHandler; class RelatedCompound : public IRelatedCompound { @@ -97,6 +98,8 @@ class CompoundHandler : public IClass, virtual void startInnerFile(const QXmlAttributes& attrib); virtual void startInnerGroup(const QXmlAttributes& attrib); virtual void startParam(const QXmlAttributes& attrib); + virtual void startTitle(const QXmlAttributes& attrib); + virtual void startTemplateParamList(const QXmlAttributes& attrib); virtual void addref() { m_refCount++; } CompoundHandler(const QString &dirName); @@ -126,39 +129,48 @@ class CompoundHandler : public IClass, IRelatedCompoundIterator *derivedCompounds() const; ICompoundIterator *nestedCompounds() const; ICompoundIterator *nestedGroup() const; + const IString *locationFile() const { return &m_defFile; } + int locationLine() const { return m_defLine; } + int locationBodyStartLine() const { return m_defBodyStart; } + int locationBodyEndLine() const { return m_defBodyEnd; } // IFile implementation IGraph *includeDependencyGraph() const; IGraph *includedByDependencyGraph() const; IDocProgramListing *source() const; + + // IPage implementation + const IDocTitle *title() const; private: - QList<RelatedCompound> m_superClasses; - QList<RelatedCompound> m_subClasses; - QList<SectionHandler> m_sections; - QList<ParamHandler> m_templateParams; - DocHandler *m_brief; - DocHandler *m_detailed; - ProgramListingHandler *m_programListing; - StringImpl m_id; - StringImpl m_kindString; - CompoundKind m_kind; - StringImpl m_name; - QString m_defFile; - int m_defLine; - QString m_xmlDir; - int m_refCount; - QDict<MemberHandler> m_memberDict; - QDict<QList<MemberHandler> > m_memberNameDict; - MainHandler *m_mainHandler; - GraphHandler *m_inheritanceGraph; - GraphHandler *m_collaborationGraph; - GraphHandler *m_includeDependencyGraph; - GraphHandler *m_includedByDependencyGraph; - QList<QString> m_innerCompounds; - ProgramListingHandler *m_source; - bool m_hasTemplateParams; - + QList<RelatedCompound> m_superClasses; + QList<RelatedCompound> m_subClasses; + QList<SectionHandler> m_sections; + QList<ParamHandler> m_params; + DocHandler* m_brief; + DocHandler* m_detailed; + ProgramListingHandler* m_programListing; + StringImpl m_id; + StringImpl m_kindString; + CompoundKind m_kind; + StringImpl m_name; + StringImpl m_defFile; + int m_defLine; + int m_defBodyStart; + int m_defBodyEnd; + QString m_xmlDir; + int m_refCount; + QDict<MemberHandler> m_memberDict; + QDict<QList<MemberHandler> > m_memberNameDict; + MainHandler* m_mainHandler; + GraphHandler* m_inheritanceGraph; + GraphHandler* m_collaborationGraph; + GraphHandler* m_includeDependencyGraph; + GraphHandler* m_includedByDependencyGraph; + QList<QString> m_innerCompounds; + ProgramListingHandler* m_source; + TemplateParamListHandler* m_templateParamList; + TitleHandler* m_titleHandler; }; void compoundhandler_init(); diff --git a/addon/doxmlparser/src/dochandler.cpp b/addon/doxmlparser/src/dochandler.cpp index 6a37f7a..b822a90 100644 --- a/addon/doxmlparser/src/dochandler.cpp +++ b/addon/doxmlparser/src/dochandler.cpp @@ -117,9 +117,6 @@ 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); } MarkupHandler::~MarkupHandler() @@ -234,20 +231,6 @@ 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; -} - //---------------------------------------------------------------------- // ListItemHandler //---------------------------------------------------------------------- @@ -1314,6 +1297,69 @@ IDocIterator *TableHandler::rows() const return new TableIterator(*this); } +//---------------------------------------------------------------------- +// PreformattedHandler +//---------------------------------------------------------------------- + +PreformattedHandler::PreformattedHandler(IBaseHandler *parent) + : m_parent(parent) +{ + m_children.setAutoDelete(TRUE); + addEndHandler("preformatted",this,&PreformattedHandler::endPreformatted); +} + +PreformattedHandler::~PreformattedHandler() +{ +} + +void PreformattedHandler::startPreformatted(const QXmlAttributes&) +{ + m_parent->setDelegate(this); +} + +void PreformattedHandler::endPreformatted() +{ + m_parent->setDelegate(0); +} + +IDocIterator *PreformattedHandler::contents() const +{ + return new PreformattedIterator(*this); +} + +//---------------------------------------------------------------------- +// SymbolHandler +//---------------------------------------------------------------------- + +SymbolHandler::SymbolHandler(IBaseHandler *parent,Types type) + : m_parent(parent), m_letter('\0'), m_type(type) +{ + addEndHandler("symbol"); + switch (type) + { + case IDocSymbol::Invalid: m_typeString="invalid"; break; + case IDocSymbol::Umlaut: m_typeString="umlaut"; break; + case IDocSymbol::Acute: m_typeString="acute"; break; + case IDocSymbol::Grave: m_typeString="grave"; break; + case IDocSymbol::Circ: m_typeString="circ"; break; + case IDocSymbol::Tilde: m_typeString="tilde"; break; + case IDocSymbol::Szlig: m_typeString="szlig"; break; + case IDocSymbol::Cedil: m_typeString="cedil"; break; + case IDocSymbol::Ring: m_typeString="ring"; break; + case IDocSymbol::Nbsp: m_typeString="nbsp"; break; + case IDocSymbol::Copy: m_typeString="copy"; break; + } +} + +SymbolHandler::~SymbolHandler() +{ +} + +void SymbolHandler::startSymbol(const QXmlAttributes& attrib) +{ + QString ls = attrib.value("char"); + if (!ls.isEmpty()) m_letter = ls.latin1()[0]; +} //---------------------------------------------------------------------- // ParagraphHandler @@ -1346,6 +1392,17 @@ 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("umlaut",this,&ParagraphHandler::startUmlaut); + addStartHandler("acute",this,&ParagraphHandler::startAcute); + addStartHandler("grave",this,&ParagraphHandler::startGrave); + addStartHandler("circ",this,&ParagraphHandler::startCirc); + addStartHandler("tilde",this,&ParagraphHandler::startTilde); + addStartHandler("szlig",this,&ParagraphHandler::startSzlig); + addStartHandler("cedil",this,&ParagraphHandler::startCedil); + addStartHandler("ring",this,&ParagraphHandler::startRing); + addStartHandler("nbsp",this,&ParagraphHandler::startNbsp); + addStartHandler("copy",this,&ParagraphHandler::startCopy); } ParagraphHandler::~ParagraphHandler() @@ -1502,6 +1559,94 @@ void ParagraphHandler::startTable(const QXmlAttributes& attrib) m_children.append(th); } +void ParagraphHandler::startPreformatted(const QXmlAttributes& attrib) +{ + addTextNode(); + PreformattedHandler *ph = new PreformattedHandler(this); + ph->startPreformatted(attrib); + m_children.append(ph); +} + +void ParagraphHandler::startUmlaut(const QXmlAttributes& attrib) +{ + addTextNode(); + SymbolHandler *sh = new SymbolHandler(this,IDocSymbol::Umlaut); + sh->startSymbol(attrib); + m_children.append(sh); +} + +void ParagraphHandler::startAcute(const QXmlAttributes& attrib) +{ + addTextNode(); + SymbolHandler *sh = new SymbolHandler(this,IDocSymbol::Acute); + sh->startSymbol(attrib); + m_children.append(sh); +} + +void ParagraphHandler::startGrave(const QXmlAttributes& attrib) +{ + addTextNode(); + SymbolHandler *sh = new SymbolHandler(this,IDocSymbol::Grave); + sh->startSymbol(attrib); + m_children.append(sh); +} + +void ParagraphHandler::startCirc(const QXmlAttributes& attrib) +{ + addTextNode(); + SymbolHandler *sh = new SymbolHandler(this,IDocSymbol::Circ); + sh->startSymbol(attrib); + m_children.append(sh); +} + +void ParagraphHandler::startTilde(const QXmlAttributes& attrib) +{ + addTextNode(); + SymbolHandler *sh = new SymbolHandler(this,IDocSymbol::Tilde); + sh->startSymbol(attrib); + m_children.append(sh); +} + +void ParagraphHandler::startSzlig(const QXmlAttributes& attrib) +{ + addTextNode(); + SymbolHandler *sh = new SymbolHandler(this,IDocSymbol::Szlig); + sh->startSymbol(attrib); + m_children.append(sh); +} + +void ParagraphHandler::startCedil(const QXmlAttributes& attrib) +{ + addTextNode(); + SymbolHandler *sh = new SymbolHandler(this,IDocSymbol::Cedil); + sh->startSymbol(attrib); + m_children.append(sh); +} + +void ParagraphHandler::startRing(const QXmlAttributes& attrib) +{ + addTextNode(); + SymbolHandler *sh = new SymbolHandler(this,IDocSymbol::Ring); + sh->startSymbol(attrib); + m_children.append(sh); +} + +void ParagraphHandler::startNbsp(const QXmlAttributes& attrib) +{ + addTextNode(); + SymbolHandler *sh = new SymbolHandler(this,IDocSymbol::Nbsp); + sh->startSymbol(attrib); + m_children.append(sh); +} + +void ParagraphHandler::startCopy(const QXmlAttributes& attrib) +{ + addTextNode(); + SymbolHandler *sh = new SymbolHandler(this,IDocSymbol::Copy); + sh->startSymbol(attrib); + m_children.append(sh); +} + void ParagraphHandler::addTextNode() { if (!m_curString.isEmpty()) @@ -1587,12 +1732,17 @@ DocHandler::DocHandler(IBaseHandler *parent) : m_parent(parent) addEndHandler("briefdescription",this,&DocHandler::endDoc); addEndHandler("detaileddescription",this,&DocHandler::endDoc); + addEndHandler("internal"); 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"); } DocHandler::~DocHandler() @@ -1639,6 +1789,27 @@ void DocHandler::startSect3(const QXmlAttributes& 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 7b24458..0e657f1 100644 --- a/addon/doxmlparser/src/dochandler.h +++ b/addon/doxmlparser/src/dochandler.h @@ -64,6 +64,8 @@ DEFINE_CLS_IMPL(DocTable); DEFINE_CLS_IMPL(DocRow); DEFINE_CLS_IMPL(DocEntry); DEFINE_CLS_IMPL(DocSection); +DEFINE_CLS_IMPL(DocPreformatted); +DEFINE_CLS_IMPL(DocSymbol); DEFINE_CLS_IMPL(DocRoot); //----------------------------------------------------------------------------- @@ -138,8 +140,6 @@ 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(); private: @@ -189,6 +189,17 @@ 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 startUmlaut(const QXmlAttributes& attrib); + virtual void startAcute(const QXmlAttributes& attrib); + virtual void startGrave(const QXmlAttributes& attrib); + virtual void startCirc(const QXmlAttributes& attrib); + virtual void startTilde(const QXmlAttributes& attrib); + virtual void startSzlig(const QXmlAttributes& attrib); + virtual void startCedil(const QXmlAttributes& attrib); + virtual void startRing(const QXmlAttributes& attrib); + virtual void startNbsp(const QXmlAttributes& attrib); + virtual void startCopy(const QXmlAttributes& attrib); ParagraphHandler(IBaseHandler *parent); virtual ~ParagraphHandler(); @@ -975,6 +986,64 @@ class TableIterator : public BaseIteratorVia<IDocIterator,IDoc,RowHandler,DocImp BaseIteratorVia<IDocIterator,IDoc,RowHandler,DocImpl>(handler.m_children) {} }; +//----------------------------------------------------------------------------- + +/*! \brief Node representing an preformatted section + */ +class PreformattedHandler : public DocPreformattedImpl, + public BaseHandler<PreformattedHandler> +{ + friend class PreformattedIterator; + public: + PreformattedHandler(IBaseHandler *parent); + virtual ~PreformattedHandler(); + void startPreformatted(const QXmlAttributes& attrib); + void endPreformatted(); + + // IDocPreformatted + 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> +{ + public: + PreformattedIterator(const PreformattedHandler &handler) : + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} +}; + +//----------------------------------------------------------------------------- + +/*! \brief Node representing an special symbol. + * + */ +// children: - +class SymbolHandler : public DocSymbolImpl, public BaseHandler<SymbolHandler> +{ + public: + SymbolHandler(IBaseHandler *parent,Types type); + virtual ~SymbolHandler(); + void startSymbol(const QXmlAttributes& attrib); + void endSymbol(); + + // IDocSymbol + virtual Kind kind() const { return DocImpl::Symbol; } + virtual Types type() const { return m_type; } + virtual const IString *typeString() const { return &m_typeString; } + virtual char letter() const { return m_letter; } + + private: + IBaseHandler *m_parent; + char m_letter; + Types m_type; + StringImpl m_typeString; +}; + //----------------------------------------------------------------------------- @@ -1033,6 +1102,9 @@ class DocHandler : public DocRootImpl, public BaseHandler<DocHandler> 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); @@ -1054,6 +1126,8 @@ class DocIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} }; +//----------------------------------------------------------------------------- + void dochandler_init(); void dochandler_exit(); diff --git a/addon/doxmlparser/src/doxmlintf.h b/addon/doxmlparser/src/doxmlintf.h index d0d3c2a..55eb946 100644 --- a/addon/doxmlparser/src/doxmlintf.h +++ b/addon/doxmlparser/src/doxmlintf.h @@ -131,8 +131,8 @@ class IDoc enum Kind { Invalid = 0, // 0 - Para = 1, // 1 -> IDocPara - Text = 2, // 2 -> IDocText + Para, // 1 -> IDocPara + Text, // 2 -> IDocText MarkupModifier, // 3 -> IDocMarkupModifier ItemizedList, // 4 -> IDocItemizedList OrderedList, // 5 -> IDocOrderedList @@ -160,7 +160,9 @@ class IDoc Row, // 27 -> IDocRow Entry, // 28 -> IDocEntry Section, // 29 -> IDocSection - Root, // 30 -> IDocRoot + Preformatted, // 30 -> IDocPreformatted + Symbol, // 31 -> IDocSymbol + Root // 32 -> IDocRoot }; virtual Kind kind() const = 0; }; @@ -177,10 +179,8 @@ class IDocMarkup : public IDoc Subscript = 0x08, Superscript = 0x10, SmallFont = 0x20, - Center = 0x40, - Preformatted = 0x80 + Center = 0x40 }; - }; class IDocPara : public IDoc @@ -393,6 +393,24 @@ class IDocSection : public IDoc virtual IDocIterator *title() const = 0; }; +class IDocPreformatted : public IDoc +{ + public: + virtual IDocIterator *contents() const = 0; +}; + +class IDocSymbol : public IDoc +{ + public: + enum Types + { Invalid = 0, + Umlaut, Acute, Grave, Circ, Tilde, Szlig, Cedil, Ring, Nbsp, Copy + }; + virtual Types type() const = 0; + virtual const IString * typeString() const = 0; + virtual char letter() const = 0; +}; + class IDocRoot : public IDoc { public: @@ -737,15 +755,15 @@ class IClass : public ICompound virtual IRelatedCompoundIterator *baseCompounds() const = 0; virtual IRelatedCompoundIterator *derivedCompounds() const = 0; virtual ICompoundIterator *nestedCompounds() const = 0; + virtual IParamIterator *templateParameters() const = 0; + virtual const IString *locationFile() const = 0; + virtual int locationLine() const = 0; + virtual int locationBodyStartLine() const = 0; + virtual int locationBodyEndLine() const = 0; // TODO: // class: - // ITemplateParamListIterator *templateParamLists() // listOfAllMembers() - // locationFile() - // locationLine() - // locationBodyStartLine() - // locationBodyEndLine() }; /*! \brief The interface to a struct in the object model. @@ -756,6 +774,10 @@ class IStruct : public ICompound virtual ICompoundIterator *nestedCompounds() const = 0; virtual IRelatedCompoundIterator *baseCompounds() const = 0; virtual IRelatedCompoundIterator *derivedCompounds() const = 0; + virtual const IString *locationFile() const = 0; + virtual int locationLine() const = 0; + virtual int locationBodyStartLine() const = 0; + virtual int locationBodyEndLine() const = 0; }; /*! \brief The interface to a union in the object model. @@ -822,6 +844,8 @@ class IGroup : public ICompound */ class IPage : public ICompound { + public: + virtual const IDocTitle *title() const = 0; }; /*! Root node of the object model. */ diff --git a/addon/doxmlparser/src/mainhandler.cpp b/addon/doxmlparser/src/mainhandler.cpp index 1a130e2..16d12b3 100644 --- a/addon/doxmlparser/src/mainhandler.cpp +++ b/addon/doxmlparser/src/mainhandler.cpp @@ -228,13 +228,16 @@ ICompound *MainHandler::compoundById(const char *id) const // unchanged. MainHandler *that = (MainHandler *)this; ch->initialize(that); + printf("loading compound %s in memory\n",id); that->m_compoundsLoaded.insert(id,ch); return ch->toICompound(); } void MainHandler::unloadCompound(CompoundHandler *ch) { - m_compoundsLoaded.remove(ch->id()->latin1()); + printf("unloading compound %s from memory\n",ch->id()->latin1()); + bool result = m_compoundsLoaded.remove(ch->id()->latin1()); + if (!result) printf("Failed to unload!\n"); } ICompound *MainHandler::compoundByName(const char *name) const @@ -276,6 +279,7 @@ IDoxygen *createObjectModel() void MainHandler::release() { + //printf("MainHandler::release()\n"); QDictIterator<CompoundHandler> chi(m_compoundsLoaded); CompoundHandler *ch; for (chi.toFirst();(ch=chi.current());++chi) diff --git a/addon/doxmlparser/src/memberhandler.cpp b/addon/doxmlparser/src/memberhandler.cpp index 018dfbd..74b1e32 100644 --- a/addon/doxmlparser/src/memberhandler.cpp +++ b/addon/doxmlparser/src/memberhandler.cpp @@ -82,7 +82,7 @@ IMember *MemberReference::member() const //------------------------------------------------------------------------------ -EnumValueHandler::EnumValueHandler(IBaseHandler *parent) : m_parent(parent) +EnumValueHandler::EnumValueHandler(IBaseHandler *parent) : m_parent(parent), m_brief(0), m_detailed(0) { addEndHandler("enumvalue",this,&EnumValueHandler::endEnumValue); @@ -90,6 +90,11 @@ EnumValueHandler::EnumValueHandler(IBaseHandler *parent) : m_parent(parent) addEndHandler("name",this,&EnumValueHandler::endName); addStartHandler("initializer",this,&EnumValueHandler::startInitializer); addEndHandler("initializer",this,&EnumValueHandler::endInitializer); + + addStartHandler("briefdescription",this,&EnumValueHandler::startBriefDesc); + + addStartHandler("detaileddescription",this,&EnumValueHandler::startDetailedDesc); + } void EnumValueHandler::startEnumValue(const QXmlAttributes& /*attrib*/) @@ -122,6 +127,21 @@ void EnumValueHandler::endInitializer() m_initializer = m_curString; } +void EnumValueHandler::startBriefDesc(const QXmlAttributes& attrib) +{ + DocHandler *docHandler = new DocHandler(this); + docHandler->startDoc(attrib); + m_brief = docHandler; +} + +void EnumValueHandler::startDetailedDesc(const QXmlAttributes& attrib) +{ + DocHandler *docHandler = new DocHandler(this); + docHandler->startDoc(attrib); + m_detailed = docHandler; +} + + //------------------------------------------------------------------------------ MemberHandler::MemberHandler(IBaseHandler *parent) diff --git a/addon/doxmlparser/src/memberhandler.h b/addon/doxmlparser/src/memberhandler.h index abbe27c..f76655c 100644 --- a/addon/doxmlparser/src/memberhandler.h +++ b/addon/doxmlparser/src/memberhandler.h @@ -30,6 +30,7 @@ class MainHandler; class CompoundHandler; class SectionHandler; +class ParamHandler; struct MemberReference : public IMemberReference { @@ -59,6 +60,8 @@ class EnumValueHandler : public IEnumValue, public BaseHandler<EnumValueHandler> virtual void endInitializer(); virtual void startEnumValue(const QXmlAttributes& attrib); virtual void endEnumValue(); + virtual void startBriefDesc(const QXmlAttributes& attrib); + virtual void startDetailedDesc(const QXmlAttributes& attrib); // IEnumValue virtual const IString *name() const { return &m_name; } @@ -67,13 +70,20 @@ class EnumValueHandler : public IEnumValue, public BaseHandler<EnumValueHandler> void setName(const QString &name) { m_name=name; } void setInitializer(const QString &init) { m_initializer=init; } - virtual ~EnumValueHandler() {} + virtual ~EnumValueHandler() { delete m_brief; delete m_detailed; } EnumValueHandler(IBaseHandler *parent); + virtual IDocRoot *briefDescription() const + { return m_brief; } + virtual IDocRoot *detailedDescription() const + { return m_detailed; } + private: StringImpl m_name; StringImpl m_initializer; IBaseHandler *m_parent; + DocHandler *m_brief; + DocHandler *m_detailed; }; class EnumValueIterator : public BaseIterator<IEnumValueIterator,IEnumValue,EnumValueHandler> diff --git a/addon/doxmlparser/src/paramhandler.cpp b/addon/doxmlparser/src/paramhandler.cpp index 8647546..ecfdda2 100644 --- a/addon/doxmlparser/src/paramhandler.cpp +++ b/addon/doxmlparser/src/paramhandler.cpp @@ -17,6 +17,39 @@ #include "memberhandler.h" #include "debug.h" +TemplateParamListHandler::TemplateParamListHandler(IBaseHandler *parent) : m_parent(parent) +{ + addStartHandler("param",this,&TemplateParamListHandler::startParam); + //addEndHandler("param",this,&TemplateParamListHandler::endParam); + + addEndHandler("templateparamlist",this,&TemplateParamListHandler::endTemplateParamList); + +} + +void TemplateParamListHandler::startParam(const QXmlAttributes& attrib) +{ + ParamHandler *ph = new ParamHandler(this); + ph->startParam(attrib); + m_templateParams.append(ph); +} + +void TemplateParamListHandler::endParam() +{ +} + +void TemplateParamListHandler::startTemplateParamList(const QXmlAttributes& /*attrib*/) +{ + m_parent->setDelegate(this); + debug(2,"templateparamlist\n"); +} + +void TemplateParamListHandler::endTemplateParamList() +{ + m_parent->setDelegate(0); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////// + ParamHandler::ParamHandler(IBaseHandler *parent) : m_parent(parent) { addEndHandler("param",this,&ParamHandler::endParam); diff --git a/addon/doxmlparser/src/paramhandler.h b/addon/doxmlparser/src/paramhandler.h index 0ab52d9..12cda44 100644 --- a/addon/doxmlparser/src/paramhandler.h +++ b/addon/doxmlparser/src/paramhandler.h @@ -26,6 +26,7 @@ #include "baseiterator.h" #include "linkedtexthandler.h" + class ParamHandler : public IParam, public BaseHandler<ParamHandler> { public: @@ -69,5 +70,25 @@ class ParamIterator : public BaseIterator<IParamIterator,IParam,ParamHandler> BaseIterator<IParamIterator,IParam,ParamHandler>(list) {} }; +class TemplateParamListHandler : public BaseHandler<TemplateParamListHandler> +{ + public: + + virtual void startParam(const QXmlAttributes& attrib); + virtual void endParam(); + + virtual void startTemplateParamList(const QXmlAttributes& attrib); + virtual void endTemplateParamList(); + + TemplateParamListHandler(IBaseHandler *parent); + virtual ~TemplateParamListHandler() {} + + ParamIterator* templateParams() { return new ParamIterator(m_templateParams); } + + protected: + IBaseHandler *m_parent; + QList<ParamHandler> m_templateParams; +}; + #endif diff --git a/addon/doxmlparser/src/stringimpl.h b/addon/doxmlparser/src/stringimpl.h index 017a0b6..ac4ee12 100644 --- a/addon/doxmlparser/src/stringimpl.h +++ b/addon/doxmlparser/src/stringimpl.h @@ -9,6 +9,8 @@ class StringImpl : public QString, public IString public: StringImpl() {} StringImpl(const QString &str) : QString(str) {} + StringImpl &operator=(const QString &str) + { QString::operator=(str); return *this; } virtual ~StringImpl() {} // IString diff --git a/addon/doxmlparser/test/main.cpp b/addon/doxmlparser/test/main.cpp index 47854b2..7ac7720 100644 --- a/addon/doxmlparser/test/main.cpp +++ b/addon/doxmlparser/test/main.cpp @@ -47,6 +47,7 @@ QString linkedTextToString(ILinkedTextIterator *ti) */ void DumpDoc(IDoc *doc,int level) { + if (doc==0) return; QString indent; indent.fill(' ',level); //printf(" doc node kind=`%d'\n",doc->kind()); @@ -374,6 +375,29 @@ void DumpDoc(IDoc *doc,int level) InPrint(("<section/>\n")); } break; + case IDoc::Preformatted: + { + InPrint(("<preformatted>\n")); + IDocPreformatted *pf = dynamic_cast<IDocPreformatted*>(doc); + ASSERT(pf!=0); + IDocIterator *di = pf->contents(); + IDoc *pdoc; + for (di->toFirst();(pdoc=di->current());di->toNext()) + { + DumpDoc(pdoc,level+1); + } + di->release(); + InPrint(("<preformatted/>\n")); + } + break; + case IDoc::Symbol: + { + IDocSymbol *sym = dynamic_cast<IDocSymbol*>(doc); + ASSERT(sym!=0); + InPrint(("<symbol type=%s letter=%c/>\n", + sym->typeString()->latin1(),sym->letter())); + } + break; case IDoc::Root: { InPrint(("<root>\n")); @@ -391,6 +415,7 @@ void DumpDoc(IDoc *doc,int level) break; default: + printf("Found unsupported node type %d!\n",doc->kind()); break; } } @@ -463,7 +488,7 @@ int main(int argc,char **argv) IDoxygen *dox = createObjectModel(); - dox->setDebugLevel(0); + dox->setDebugLevel(4); if (!dox->readXMLDir(argv[1])) { @@ -478,6 +503,7 @@ int main(int argc,char **argv) { printf("Compound name=%s id=%s kind=%s\n", comp->name()->latin1(),comp->id()->latin1(),comp->kindString()->latin1()); + ISectionIterator *sli = comp->sections(); ISection *sec; for (sli->toFirst();(sec=sli->current());sli->toNext()) |