diff options
Diffstat (limited to 'addon/doxmlparser/src')
-rw-r--r-- | addon/doxmlparser/src/basehandler.h | 12 | ||||
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.cpp | 49 | ||||
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.h | 46 | ||||
-rw-r--r-- | addon/doxmlparser/src/dochandler.cpp | 112 | ||||
-rw-r--r-- | addon/doxmlparser/src/dochandler.h | 89 | ||||
-rw-r--r-- | addon/doxmlparser/src/doxmlintf.h | 145 | ||||
-rw-r--r-- | addon/doxmlparser/src/doxmlparser.pro.in | 4 | ||||
-rw-r--r-- | addon/doxmlparser/src/graphhandler.cpp | 86 | ||||
-rw-r--r-- | addon/doxmlparser/src/graphhandler.h | 110 | ||||
-rw-r--r-- | addon/doxmlparser/src/mainhandler.cpp | 1 |
10 files changed, 562 insertions, 92 deletions
diff --git a/addon/doxmlparser/src/basehandler.h b/addon/doxmlparser/src/basehandler.h index 89f9504..c86316b 100644 --- a/addon/doxmlparser/src/basehandler.h +++ b/addon/doxmlparser/src/basehandler.h @@ -22,6 +22,8 @@ #include "debug.h" +//----------------------------------------------------------------------------- + class IBaseHandler { public: @@ -30,6 +32,8 @@ class IBaseHandler virtual ~IBaseHandler() {} }; +//----------------------------------------------------------------------------- + class IFallBackHandler { public: @@ -39,6 +43,8 @@ class IFallBackHandler virtual ~IFallBackHandler() {} }; +//----------------------------------------------------------------------------- + template<class T> class ElementMapper { class StartElementHandler @@ -108,11 +114,15 @@ template<class T> class ElementMapper QDict<EndElementHandlerT> m_endHandlers; }; +//----------------------------------------------------------------------------- + struct LocatorContainer { static QXmlLocator *s_theLocator; }; +//----------------------------------------------------------------------------- + template<class T> class BaseHandler : public QXmlDefaultHandler, public ElementMapper<T>, public LocatorContainer, @@ -269,6 +279,8 @@ template<class T> class BaseHandler : public QXmlDefaultHandler, IFallBackHandler *m_fallBackHandler; }; +//----------------------------------------------------------------------------- + template<class T> class BaseFallBackHandler : public ElementMapper<T>, public IFallBackHandler { diff --git a/addon/doxmlparser/src/compoundhandler.cpp b/addon/doxmlparser/src/compoundhandler.cpp index 18a8c0c..caca36b 100644 --- a/addon/doxmlparser/src/compoundhandler.cpp +++ b/addon/doxmlparser/src/compoundhandler.cpp @@ -17,6 +17,8 @@ #include "compoundhandler.h" #include "dochandler.h" #include "debug.h" +#include "graphhandler.h" +#include "sectionhandler.h" class CompoundErrorHandler : public QXmlErrorHandler { @@ -129,6 +131,10 @@ CompoundHandler::CompoundHandler(const QString &xmlDir) addStartHandler("programlisting",this,&CompoundHandler::startProgramListing); + addStartHandler("inheritancegraph",this,&CompoundHandler::startInheritanceGraph); + + addStartHandler("collaborationgraph",this,&CompoundHandler::startCollaborationGraph); + } CompoundHandler::~CompoundHandler() @@ -194,7 +200,7 @@ void CompoundHandler::endCompoundName() void CompoundHandler::addSuperClass(const QXmlAttributes& attrib) { - SuperClass *sc=new SuperClass( + RelatedClass *sc=new RelatedClass( attrib.value("refid"), attrib.value("prot"), attrib.value("virt") @@ -208,7 +214,7 @@ void CompoundHandler::addSuperClass(const QXmlAttributes& attrib) void CompoundHandler::addSubClass(const QXmlAttributes& attrib) { - SubClass *sc = new SubClass( + RelatedClass *sc = new RelatedClass( attrib.value("refid"), attrib.value("prot"), attrib.value("virt") @@ -266,3 +272,42 @@ void CompoundHandler::release() } } +ISectionIterator *CompoundHandler::sections() const +{ + return new SectionIterator(m_sections); +} + +IMemberIterator *CompoundHandler::memberByName(const QString &name) const +{ + QList<MemberHandler> *ml = m_memberNameDict[name]; + if (ml==0) return 0; + return new MemberIterator(*ml); +} + +void CompoundHandler::startInheritanceGraph(const QXmlAttributes &attrib) +{ + m_inheritanceGraph = new GraphHandler(this,"inheritancegraph"); + m_inheritanceGraph->startGraph(attrib); +} + +void CompoundHandler::startCollaborationGraph(const QXmlAttributes &attrib) +{ + m_collaborationGraph = new GraphHandler(this,"collaborationgraph"); + m_collaborationGraph->startGraph(attrib); +} + +IDocRoot *CompoundHandler::briefDescription() const +{ + return m_brief; +} + +IDocRoot *CompoundHandler::detailedDescription() const +{ + return m_detailed; +} + +IMember *CompoundHandler::memberById(const QString &id) const +{ + return m_memberDict[id]; +} + diff --git a/addon/doxmlparser/src/compoundhandler.h b/addon/doxmlparser/src/compoundhandler.h index 762641f..1639487 100644 --- a/addon/doxmlparser/src/compoundhandler.h +++ b/addon/doxmlparser/src/compoundhandler.h @@ -22,11 +22,12 @@ #include "basehandler.h" #include "baseiterator.h" -#include "sectionhandler.h" class MainHandler; class DocHandler; class ProgramListingHandler; +class GraphHandler; +class MemberHandler; class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> { @@ -41,6 +42,8 @@ class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> virtual void startDetailedDesc(const QXmlAttributes& attrib); virtual void startLocation(const QXmlAttributes& attrib); virtual void startProgramListing(const QXmlAttributes& attrib); + virtual void startInheritanceGraph(const QXmlAttributes& attrib); + virtual void startCollaborationGraph(const QXmlAttributes& attrib); virtual void addref() { m_refCount++; } CompoundHandler(const QString &dirName); @@ -54,43 +57,25 @@ class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> QString id() const { return m_id; } CompoundKind kind() const { return m_kind; } QString kindString() const { return m_kindString; } - ISectionIterator *sections() const - { return new SectionIterator(m_sections); } - virtual IDocRoot *briefDescription() const - { return m_brief; } - virtual IDocRoot *detailedDescription() const - { return m_detailed; } - virtual IMember *memberById(const QString &id) const - { return m_memberDict[id]; } - virtual IMemberIterator *memberByName(const QString &name) const - { - QList<MemberHandler> *ml = m_memberNameDict[name]; - if (ml==0) return 0; - return new MemberIterator(*ml); - } - virtual void release(); + ISectionIterator *sections() const; + IDocRoot *briefDescription() const; + IDocRoot *detailedDescription() const; + IMember *memberById(const QString &id) const; + IMemberIterator *memberByName(const QString &name) const; + void release(); private: - struct SuperClass + struct RelatedClass { - SuperClass(const QString &id,const QString &prot,const QString &virt) : + RelatedClass(const QString &id,const QString &prot,const QString &virt) : m_id(id),m_protection(prot),m_virtualness(virt) {} QString m_id; QString m_protection; QString m_virtualness; }; - struct SubClass - { - SubClass(const QString &id,const QString &prot,const QString &virt) : - m_id(id),m_protection(prot),m_virtualness(virt) {} - - QString m_id; - QString m_protection; - QString m_virtualness; - }; - QList<SuperClass> m_superClasses; - QList<SubClass> m_subClasses; + QList<RelatedClass> m_superClasses; + QList<RelatedClass> m_subClasses; QList<ISection> m_sections; DocHandler *m_brief; DocHandler *m_detailed; @@ -106,6 +91,9 @@ class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> QDict<MemberHandler> m_memberDict; QDict<QList<MemberHandler> > m_memberNameDict; MainHandler *m_mainHandler; + GraphHandler *m_inheritanceGraph; + GraphHandler *m_collaborationGraph; + }; void compoundhandler_init(); diff --git a/addon/doxmlparser/src/dochandler.cpp b/addon/doxmlparser/src/dochandler.cpp index 12a3a24..8f1249f 100644 --- a/addon/doxmlparser/src/dochandler.cpp +++ b/addon/doxmlparser/src/dochandler.cpp @@ -17,51 +17,77 @@ #include "debug.h" #include <qmap.h> +//---------------------------------------------------------------------- + class TypeNameMapper { public: TypeNameMapper() { - m_typeNameMap.insert("see", SimpleSectHandler::See); - m_typeNameMap.insert("return", SimpleSectHandler::Return); - m_typeNameMap.insert("author", SimpleSectHandler::Author); - m_typeNameMap.insert("version", SimpleSectHandler::Version); - m_typeNameMap.insert("since", SimpleSectHandler::Since); - m_typeNameMap.insert("date", SimpleSectHandler::Date); - m_typeNameMap.insert("bug", SimpleSectHandler::Bug); - m_typeNameMap.insert("note", SimpleSectHandler::Note); - m_typeNameMap.insert("warning", SimpleSectHandler::Warning); - m_typeNameMap.insert("par", SimpleSectHandler::Par); - m_typeNameMap.insert("deprecated",SimpleSectHandler::Deprecated); - m_typeNameMap.insert("pre", SimpleSectHandler::Pre); - m_typeNameMap.insert("post", SimpleSectHandler::Post); - m_typeNameMap.insert("invariant", SimpleSectHandler::Invar); - m_typeNameMap.insert("remark", SimpleSectHandler::Remark); - m_typeNameMap.insert("attention", SimpleSectHandler::Attention); - m_typeNameMap.insert("todo", SimpleSectHandler::Todo); - m_typeNameMap.insert("test", SimpleSectHandler::Test); - m_typeNameMap.insert("rcs", SimpleSectHandler::RCS); - m_typeNameMap.insert("enumvalues",SimpleSectHandler::EnumValues); - m_typeNameMap.insert("examples", SimpleSectHandler::Examples); + m_map.insert("see", SimpleSectHandler::See); + m_map.insert("return", SimpleSectHandler::Return); + m_map.insert("author", SimpleSectHandler::Author); + m_map.insert("version", SimpleSectHandler::Version); + m_map.insert("since", SimpleSectHandler::Since); + m_map.insert("date", SimpleSectHandler::Date); + m_map.insert("bug", SimpleSectHandler::Bug); + m_map.insert("note", SimpleSectHandler::Note); + m_map.insert("warning", SimpleSectHandler::Warning); + m_map.insert("par", SimpleSectHandler::Par); + m_map.insert("deprecated",SimpleSectHandler::Deprecated); + m_map.insert("pre", SimpleSectHandler::Pre); + m_map.insert("post", SimpleSectHandler::Post); + m_map.insert("invariant", SimpleSectHandler::Invar); + m_map.insert("remark", SimpleSectHandler::Remark); + m_map.insert("attention", SimpleSectHandler::Attention); + m_map.insert("todo", SimpleSectHandler::Todo); + m_map.insert("test", SimpleSectHandler::Test); + m_map.insert("rcs", SimpleSectHandler::RCS); + m_map.insert("enumvalues",SimpleSectHandler::EnumValues); + m_map.insert("examples", SimpleSectHandler::Examples); } SimpleSectHandler::Types stringToType(const QString &typeStr) { - return m_typeNameMap[typeStr]; + return m_map[typeStr]; } private: - QMap<QString,SimpleSectHandler::Types> m_typeNameMap; + QMap<QString,SimpleSectHandler::Types> m_map; +}; + +class HighlightMapper +{ + public: + HighlightMapper() + { + m_map.insert("comment", HighlightHandler::Comment); + m_map.insert("keyword", HighlightHandler::Keyword); + m_map.insert("keywordtype", HighlightHandler::KeywordType); + m_map.insert("keywordflow", HighlightHandler::KeywordFlow); + m_map.insert("charliteral", HighlightHandler::CharLiteral); + m_map.insert("stringliteral", HighlightHandler::StringLiteral); + m_map.insert("preprocessor", HighlightHandler::Preprocessor); + } + HighlightHandler::HighlightKind stringToKind(const QString &kindStr) + { + return m_map[kindStr]; + } + private: + QMap<QString,HighlightHandler::HighlightKind> m_map; }; static TypeNameMapper *s_typeMapper; +static HighlightMapper *s_highlightMapper; void dochandler_init() { s_typeMapper = new TypeNameMapper; + s_highlightMapper = new HighlightMapper; } void dochandler_exit() { delete s_typeMapper; + delete s_highlightMapper; } //---------------------------------------------------------------------- @@ -820,6 +846,7 @@ HighlightHandler::HighlightHandler(IBaseHandler *parent) m_children.setAutoDelete(TRUE); addEndHandler("highlight",this,&HighlightHandler::endHighlight); addStartHandler("ref",this,&HighlightHandler::startRef); + m_hl = Invalid; } HighlightHandler::~HighlightHandler() @@ -828,7 +855,8 @@ HighlightHandler::~HighlightHandler() void HighlightHandler::startHighlight(const QXmlAttributes& attrib) { - m_class = attrib.value("class"); + m_hlString = attrib.value("class"); + m_hl = s_highlightMapper->stringToKind(m_hlString); m_curString=""; m_parent->setDelegate(this); } @@ -836,7 +864,7 @@ void HighlightHandler::startHighlight(const QXmlAttributes& attrib) void HighlightHandler::endHighlight() { addTextNode(); - debug(2,"highlight class=`%s'\n",m_class.data()); + debug(2,"highlight class=`%s'\n",m_hlString.data()); m_parent->setDelegate(0); } @@ -859,6 +887,11 @@ void HighlightHandler::addTextNode() } } +IDocIterator *HighlightHandler::codeElements() const +{ + return new HighlightIterator(*this); +} + //---------------------------------------------------------------------- // CodeLineHandler //---------------------------------------------------------------------- @@ -931,6 +964,12 @@ void CodeLineHandler::addTextNode() } } +IDocIterator *CodeLineHandler::codeElements() const +{ + return new CodeLineIterator(*this); +} + + //---------------------------------------------------------------------- // ProgramListingHandler //---------------------------------------------------------------------- @@ -987,6 +1026,13 @@ void ProgramListingHandler::startCodeLine(const QXmlAttributes& attrib) m_hasLineNumber=FALSE; } +IDocIterator *ProgramListingHandler::codeLines() const +{ + return new ProgramListingIterator(*this); +} + + + //---------------------------------------------------------------------- // FormulaHandler //---------------------------------------------------------------------- @@ -1155,6 +1201,11 @@ void EntryHandler::startParagraph(const QXmlAttributes& attrib) m_children.append(ph); } +IDocIterator *EntryHandler::contents() const +{ + return new EntryIterator(*this); +} + //---------------------------------------------------------------------- // RowHandler //---------------------------------------------------------------------- @@ -1188,6 +1239,11 @@ void RowHandler::startEntry(const QXmlAttributes& attrib) m_children.append(eh); } +IDocIterator *RowHandler::entries() const +{ + return new RowIterator(*this); +} + //---------------------------------------------------------------------- // TableHandler //---------------------------------------------------------------------- @@ -1235,6 +1291,12 @@ void TableHandler::endCaption() m_caption = m_curString; } +IDocIterator *TableHandler::rows() const +{ + return new TableIterator(*this); +} + + //---------------------------------------------------------------------- // ParagraphHandler //---------------------------------------------------------------------- diff --git a/addon/doxmlparser/src/dochandler.h b/addon/doxmlparser/src/dochandler.h index 0161576..c3b8242 100644 --- a/addon/doxmlparser/src/dochandler.h +++ b/addon/doxmlparser/src/dochandler.h @@ -162,6 +162,13 @@ class ParagraphHandler : public IDocPara, MarkupHandler *m_markupHandler; }; +class ParagraphIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +{ + public: + ParagraphIterator(const ParagraphHandler &handler) : + BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} +}; + //----------------------------------------------------------------------------- /*! \brief Node representing a list item. @@ -358,6 +365,8 @@ class LinkHandler : public IDocLink, public BaseHandler<LinkHandler> // IDocLink virtual Kind kind() const { return Link; } + virtual QString refId() const { return m_ref; } + virtual QString text() const { return m_text; } private: IBaseHandler *m_parent; @@ -382,6 +391,7 @@ class EMailHandler : public IDocEMail, public BaseHandler<EMailHandler> // IDocEMail virtual Kind kind() const { return EMail; } + virtual QString address() const { return m_address; } private: IBaseHandler *m_parent; @@ -405,6 +415,8 @@ class ULinkHandler : public IDocULink, public BaseHandler<ULinkHandler> // IDocULink virtual Kind kind() const { return ULink; } + virtual QString url() const { return m_url; } + virtual QString text() const { return m_text; } private: IBaseHandler *m_parent; @@ -601,9 +613,10 @@ class VariableListIterator : public BaseIterator<IDocIterator,IDoc,VariableListE /*! \brief Node representing a highlighted text fragment. * */ -// TODO: children: ref +// children: ref class HighlightHandler : public IDocHighlight, public BaseHandler<HighlightHandler> { + friend class HighlightIterator; public: HighlightHandler(IBaseHandler *parent); virtual ~HighlightHandler(); @@ -613,13 +626,23 @@ class HighlightHandler : public IDocHighlight, public BaseHandler<HighlightHandl // IDocHighlight virtual Kind kind() const { return Highlight; } + virtual HighlightKind highlightKind() const { return m_hl; } + virtual IDocIterator *codeElements() const; private: void addTextNode(); IBaseHandler *m_parent; - QString m_class; - QList<IDoc> m_children; + HighlightKind m_hl; + QString m_hlString; + QList<IDoc> m_children; +}; + +class HighlightIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +{ + public: + HighlightIterator(const HighlightHandler &handler) : + BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} }; //----------------------------------------------------------------------------- @@ -630,6 +653,7 @@ class HighlightHandler : public IDocHighlight, public BaseHandler<HighlightHandl // children: linenumber, highlight, anchor, ref class CodeLineHandler : public IDocCodeLine, public BaseHandler<CodeLineHandler> { + friend class CodeLineIterator; public: virtual void startCodeLine(const QXmlAttributes&); @@ -644,6 +668,9 @@ class CodeLineHandler : public IDocCodeLine, public BaseHandler<CodeLineHandler> // IDocCodeLine virtual Kind kind() const { return CodeLine; } + virtual int lineNumber() const { return m_lineNumber; } + virtual QString refId() const { return m_refId; } + virtual IDocIterator *codeElements() const; private: void addTextNode(); @@ -654,6 +681,13 @@ class CodeLineHandler : public IDocCodeLine, public BaseHandler<CodeLineHandler> QList<IDoc> m_children; }; +class CodeLineIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +{ + public: + CodeLineIterator(const CodeLineHandler &handler) : + BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} +}; + //----------------------------------------------------------------------------- /*! \brief Node representing a program listing @@ -662,6 +696,7 @@ class CodeLineHandler : public IDocCodeLine, public BaseHandler<CodeLineHandler> // children: codeline, linenumber class ProgramListingHandler : public IDocProgramListing, public BaseHandler<ProgramListingHandler> { + friend class ProgramListingIterator; public: virtual void startProgramListing(const QXmlAttributes& attrib); virtual void endProgramListing(); @@ -673,6 +708,7 @@ class ProgramListingHandler : public IDocProgramListing, public BaseHandler<Prog // IDocProgramListing virtual Kind kind() const { return ProgramListing; } + virtual IDocIterator *codeLines() const; private: IBaseHandler *m_parent; @@ -682,6 +718,15 @@ class ProgramListingHandler : public IDocProgramListing, public BaseHandler<Prog //----------------------------------------------------------------------------- +class ProgramListingIterator : public BaseIterator<IDocIterator,IDoc,CodeLineHandler> +{ + public: + ProgramListingIterator(const ProgramListingHandler &handler) : + BaseIterator<IDocIterator,IDoc,CodeLineHandler>(handler.m_children) {} +}; + +//----------------------------------------------------------------------------- + /*! \brief Node representing a formula. * */ @@ -696,6 +741,8 @@ class FormulaHandler : public IDocFormula, public BaseHandler<FormulaHandler> // IDocFormula virtual Kind kind() const { return Formula; } + virtual QString id() const { return m_id; } + virtual QString text() const { return m_text; } private: IBaseHandler *m_parent; @@ -719,6 +766,8 @@ class ImageHandler : public IDocImage, public BaseHandler<ImageHandler> // IDocImage virtual Kind kind() const { return Image; } + virtual QString name() const { return m_name; } + virtual QString caption() const { return m_caption; } private: IBaseHandler *m_parent; @@ -742,6 +791,8 @@ class DotFileHandler : public IDocDotFile, public BaseHandler<DotFileHandler> // IDocDotFile virtual Kind kind() const { return DotFile; } + virtual QString name() const { return m_name; } + virtual QString caption() const { return m_caption; } private: IBaseHandler *m_parent; @@ -769,6 +820,8 @@ class IndexEntryHandler : public IDocIndexEntry, public BaseHandler<IndexEntryHa // IDocIndexEntry virtual Kind kind() const { return IndexEntry; } + virtual QString primary() const { return m_primary; } + virtual QString secondary() const { return m_secondary; } private: IBaseHandler *m_parent; @@ -784,6 +837,7 @@ class IndexEntryHandler : public IDocIndexEntry, public BaseHandler<IndexEntryHa // children: para class EntryHandler : public IDocEntry, public BaseHandler<EntryHandler> { + friend class EntryIterator; public: EntryHandler(IBaseHandler *parent); virtual ~EntryHandler(); @@ -793,12 +847,20 @@ class EntryHandler : public IDocEntry, public BaseHandler<EntryHandler> // IDocEntry virtual Kind kind() const { return Entry; } + virtual IDocIterator *contents() const; private: IBaseHandler *m_parent; QList<IDoc> m_children; }; +class EntryIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +{ + public: + EntryIterator(const EntryHandler &handler) : + BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} +}; + //----------------------------------------------------------------------------- /*! \brief Node representing an entry in the table row. @@ -807,6 +869,7 @@ class EntryHandler : public IDocEntry, public BaseHandler<EntryHandler> // children: entry class RowHandler : public IDocRow, public BaseHandler<RowHandler> { + friend class RowIterator; public: RowHandler(IBaseHandler *parent); virtual ~RowHandler(); @@ -816,12 +879,20 @@ class RowHandler : public IDocRow, public BaseHandler<RowHandler> // IDocRow virtual Kind kind() const { return Row; } + virtual IDocIterator *entries() const; private: IBaseHandler *m_parent; QList<EntryHandler> m_children; }; +class RowIterator : public BaseIterator<IDocIterator,IDoc,EntryHandler> +{ + public: + RowIterator(const RowHandler &handler) : + BaseIterator<IDocIterator,IDoc,EntryHandler>(handler.m_children) {} +}; + //----------------------------------------------------------------------------- /*! \brief Node representing an entry in the table. @@ -830,6 +901,7 @@ class RowHandler : public IDocRow, public BaseHandler<RowHandler> // children: row, caption class TableHandler : public IDocTable, public BaseHandler<TableHandler> { + friend class TableIterator; public: TableHandler(IBaseHandler *parent); virtual ~TableHandler(); @@ -841,6 +913,9 @@ class TableHandler : public IDocTable, public BaseHandler<TableHandler> // IDocTable virtual Kind kind() const { return Table; } + virtual IDocIterator *rows() const; + virtual int numColumns() const { return m_numColumns; } + virtual QString caption() const { return m_caption; } private: IBaseHandler *m_parent; @@ -849,13 +924,11 @@ class TableHandler : public IDocTable, public BaseHandler<TableHandler> QString m_caption; }; -//----------------------------------------------------------------------------- - -class ParagraphIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +class TableIterator : public BaseIterator<IDocIterator,IDoc,RowHandler> { public: - ParagraphIterator(const ParagraphHandler &handler) : - BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} + TableIterator(const TableHandler &handler) : + BaseIterator<IDocIterator,IDoc,RowHandler>(handler.m_children) {} }; diff --git a/addon/doxmlparser/src/doxmlintf.h b/addon/doxmlparser/src/doxmlintf.h index 067e5fd..89e567d 100644 --- a/addon/doxmlparser/src/doxmlintf.h +++ b/addon/doxmlparser/src/doxmlintf.h @@ -110,8 +110,8 @@ class IDoc enum Kind { Invalid = 0, // 0 - Para, // 1 -> IDocPara - Text, // 2 -> IDocText + Para = 1, // 1 -> IDocPara + Text = 2, // 2 -> IDocText MarkupModifier, // 3 -> IDocMarkupModifier ItemizedList, // 4 -> IDocItemizedList OrderedList, // 5 -> IDocOrderedList @@ -271,35 +271,35 @@ class IDocLineBreak : public IDoc class IDocULink : public IDoc { public: - virtual QString url() = 0; - virtual QString text() = 0; + virtual QString url() const = 0; + virtual QString text() const = 0; }; class IDocEMail : public IDoc { public: - virtual QString address() = 0; + virtual QString address() const = 0; }; class IDocLink : public IDoc { public: - virtual QString refId() = 0; - virtual QString text() = 0; + virtual QString refId() const = 0; + virtual QString text() const = 0; }; class IDocProgramListing : public IDoc { public: - virtual IDocIterator *codeLines() = 0; + virtual IDocIterator *codeLines() const = 0; }; class IDocCodeLine : public IDoc { public: - virtual int lineNumber() = 0; - virtual QString refId() = 0; - virtual IDocIterator *codeElements() = 0; + virtual int lineNumber() const = 0; + virtual QString refId() const = 0; + virtual IDocIterator *codeElements() const = 0; }; class IDocHighlight : public IDoc @@ -311,56 +311,56 @@ class IDocHighlight : public IDoc KeywordType, KeywordFlow, CharLiteral, StringLiteral, Preprocessor }; - virtual HighlightKind highlightKind() = 0; - virtual IDocIterator *codeElements() = 0; + virtual HighlightKind highlightKind() const = 0; + virtual IDocIterator *codeElements() const = 0; }; class IDocFormula : public IDoc { public: - virtual QString id() = 0; - virtual QString text() = 0; + virtual QString id() const = 0; + virtual QString text() const = 0; }; class IDocImage : public IDoc { public: - virtual QString name() = 0; - virtual QString caption() = 0; + virtual QString name() const = 0; + virtual QString caption() const = 0; }; class IDocDotFile : public IDoc { public: - virtual QString name() = 0; - virtual QString caption() = 0; + virtual QString name() const = 0; + virtual QString caption() const = 0; }; class IDocIndexEntry : public IDoc { public: - virtual QString primary() = 0; - virtual QString secondary() = 0; + virtual QString primary() const = 0; + virtual QString secondary() const = 0; }; class IDocTable : public IDoc { public: - virtual IDocIterator *rows() = 0; - virtual int numColumns() = 0; - virtual QString caption() = 0; + virtual IDocIterator *rows() const = 0; + virtual int numColumns() const = 0; + virtual QString caption() const = 0; }; class IDocRow : public IDoc { public: - virtual IDocIterator *entries() = 0; + virtual IDocIterator *entries() const = 0; }; class IDocEntry : public IDoc { public: - virtual IDocIterator *contents() = 0; + virtual IDocIterator *contents() const = 0; }; class IDocSection : public IDoc @@ -388,6 +388,72 @@ class IDocIterator virtual void release() = 0; }; +class IEdgeLabel +{ + public: + virtual QString label() = 0; +}; + +class IEdgeLabelIterator +{ + public: + virtual IEdgeLabel *toFirst() = 0; + virtual IEdgeLabel *toLast() = 0; + virtual IEdgeLabel *toNext() = 0; + virtual IEdgeLabel *toPrev() = 0; + virtual IEdgeLabel *current() const = 0; + virtual void release() = 0; +}; + +class IChildNode +{ + public: + enum NodeRelation { PublicInheritance, ProtectedInheritance, + PrivateInheritance, Usage, TemplateInstace + }; + virtual QString id() const = 0; + virtual NodeRelation relation() const = 0; + virtual IEdgeLabelIterator *edgeLabels() const = 0; +}; + +class IChildNodeIterator +{ + public: + virtual IChildNode *toFirst() = 0; + virtual IChildNode *toLast() = 0; + virtual IChildNode *toNext() = 0; + virtual IChildNode *toPrev() = 0; + virtual IChildNode *current() const = 0; + virtual void release() = 0; +}; + +class INode +{ + public: + virtual QString id() const = 0; + virtual QString label() const = 0; + virtual QString linkId() const = 0; + virtual IChildNodeIterator *children() const = 0; +}; + +class INodeIterator +{ + public: + virtual INode *toFirst() = 0; + virtual INode *toLast() = 0; + virtual INode *toNext() = 0; + virtual INode *toPrev() = 0; + virtual INode *current() const = 0; + virtual void release() = 0; +}; + +class IGraph +{ + public: + virtual INodeIterator *nodes() const = 0; + virtual ~IGraph() {} +}; + class IMember { public: @@ -501,6 +567,33 @@ class ICompound * zero, the memory for the compound will be released. */ virtual void release() = 0; + + // TODO: + // class: + // IRelatedCompoundIterator *baseClasses() + // IRelatedCompoundIterator *derivedClasses() + // ICompoundIterator *innerClasses() + // ITemplateParamListIterator *templateParamLists() + // listOfAllMembers() + // IDotGraph *inheritanceGraph() + // IDotGraph *collaborationGraph() + // locationFile() + // locationLine() + // locationBodyStartLine() + // locationBodyEndLine() + // namespace: + // ICompound *innerNamespaces() + // file: + // includes() + // includedBy() + // IDotGraph *includeDependencyGraph() + // IDotGraph *includedByDependencyGraph() + // IDocProgramListing *source() + // group: + // Title() + // innerFile() + // innerPage() + // page: }; class ICompoundIterator diff --git a/addon/doxmlparser/src/doxmlparser.pro.in b/addon/doxmlparser/src/doxmlparser.pro.in index 889f069..1d05f5b 100644 --- a/addon/doxmlparser/src/doxmlparser.pro.in +++ b/addon/doxmlparser/src/doxmlparser.pro.in @@ -4,12 +4,12 @@ HEADERS = basehandler.h mainhandler.h \ compoundhandler.h sectionhandler.h \ memberhandler.h paramhandler.h \ dochandler.h linkedtexthandler.h \ - debug.h + debug.h graphhandler.h SOURCES = mainhandler.cpp \ compoundhandler.cpp sectionhandler.cpp \ memberhandler.cpp paramhandler.cpp \ dochandler.cpp linkedtexthandler.cpp \ - basehandler.cpp debug.cpp + basehandler.cpp debug.cpp graphhandler.cpp unix:LIBS += -L../../../lib -lqtools win32:INCLUDEPATH += . win32-mingw:LIBS += -L../../../lib -lqtools diff --git a/addon/doxmlparser/src/graphhandler.cpp b/addon/doxmlparser/src/graphhandler.cpp new file mode 100644 index 0000000..9c822de --- /dev/null +++ b/addon/doxmlparser/src/graphhandler.cpp @@ -0,0 +1,86 @@ +#include "graphhandler.h" + +GraphHandler::GraphHandler(IBaseHandler *parent,const char *endTag) + : m_parent(parent) +{ + addEndHandler(endTag,this,&GraphHandler::endGraph); + addStartHandler("node",this,&GraphHandler::startNode); + m_nodes.setAutoDelete(TRUE); +} + +GraphHandler::~GraphHandler() +{ +} + +void GraphHandler::startGraph(const QXmlAttributes &) +{ + m_parent->setDelegate(this); +} + +void GraphHandler::endGraph() +{ + m_parent->setDelegate(0); +} + +void GraphHandler::startNode(const QXmlAttributes &attrib) +{ + NodeHandler *n = new NodeHandler(this); + n->startNode(attrib); + m_nodes.append(n); +} + +INodeIterator *GraphHandler::nodes() const +{ + return new NodeIterator(*this); +} + +//------------------------------------------------------------------------ + +NodeHandler::NodeHandler(IBaseHandler *parent) + : m_parent(parent) +{ + addEndHandler("node",this,&NodeHandler::endNode); + addStartHandler("link",this,&NodeHandler::startLink); + addEndHandler("link",this,&NodeHandler::endLink); + addStartHandler("label",this,&NodeHandler::startLabel); + addEndHandler("label",this,&NodeHandler::endLabel); +} + +NodeHandler::~NodeHandler() +{ +} + +void NodeHandler::startNode(const QXmlAttributes &attrib) +{ + m_parent->setDelegate(this); + m_id = attrib.value("id"); +} + +void NodeHandler::endNode() +{ + m_parent->setDelegate(0); +} + +void NodeHandler::startLink(const QXmlAttributes &attrib) +{ + m_link = attrib.value("id"); +} + +void NodeHandler::endLink() +{ +} + +void NodeHandler::startLabel(const QXmlAttributes &/*attrib*/) +{ + m_curString=""; +} + +void NodeHandler::endLabel() +{ + m_label = m_curString; +} + + + + + diff --git a/addon/doxmlparser/src/graphhandler.h b/addon/doxmlparser/src/graphhandler.h new file mode 100644 index 0000000..47222d1 --- /dev/null +++ b/addon/doxmlparser/src/graphhandler.h @@ -0,0 +1,110 @@ +/****************************************************************************** + * + * $Id$ + * + * + * Copyright (C) 1997-2002 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + */ + +#ifndef _GRAPHHANDLER_H +#define _GRAPHHANDLER_H + +#include "doxmlintf.h" +#include "basehandler.h" +#include "baseiterator.h" + +class NodeHandler; +class ChildNodeHandler; + +class GraphHandler : public IGraph, public BaseHandler<GraphHandler> +{ + friend class NodeIterator; + public: + GraphHandler(IBaseHandler *parent,const char *endTag); + virtual ~GraphHandler(); + + void startGraph(const QXmlAttributes &attrib); + void endGraph(); + void startNode(const QXmlAttributes &attrib); + + // IGraph + virtual INodeIterator *nodes() const; + + private: + IBaseHandler *m_parent; + QList<NodeHandler> m_nodes; +}; + +//---------------------------------------------------------------------- + +class NodeHandler : public INode, public BaseHandler<NodeHandler> +{ + friend class ChildNodeIterator; + public: + NodeHandler(IBaseHandler *parent); + virtual ~NodeHandler(); + + void startNode(const QXmlAttributes &attrib); + void endNode(); + void startLabel(const QXmlAttributes &attrib); + void endLabel(); + void startLink(const QXmlAttributes &attrib); + void endLink(); + + // INode + virtual QString id() const { return m_id; } + virtual QString label() const { return m_label; } + virtual QString linkId() const { return m_link; } + virtual IChildNodeIterator *children() const { return 0; } // TODO: implement + + private: + IBaseHandler *m_parent; + QString m_id; + QString m_label; + QString m_link; + QList<ChildNodeHandler> m_children; +}; + +class NodeIterator : public BaseIterator<INodeIterator,INode,NodeHandler> +{ + public: + NodeIterator(const GraphHandler &handler) : + BaseIterator<INodeIterator,INode,NodeHandler>(handler.m_nodes) {} +}; + +//---------------------------------------------------------------------- + +class ChildNodeHandler : public IChildNode, public BaseHandler<ChildNodeHandler> +{ + public: + ChildNodeHandler(IBaseHandler *parent); + virtual ~ChildNodeHandler(); + + void startChildNode(const QXmlAttributes &attrib); + void endChildNode(); + + // IChildNode + virtual QString id() const { return m_id; } + + private: + IBaseHandler *m_parent; + QString m_id; +}; + +class ChildNodeIterator : public BaseIterator<IChildNodeIterator,IChildNode,ChildNodeHandler> +{ + public: + ChildNodeIterator(const NodeHandler &handler) : + BaseIterator<IChildNodeIterator,IChildNode,ChildNodeHandler>(handler.m_children) {} +}; + + +#endif + diff --git a/addon/doxmlparser/src/mainhandler.cpp b/addon/doxmlparser/src/mainhandler.cpp index 99cb665..98249ee 100644 --- a/addon/doxmlparser/src/mainhandler.cpp +++ b/addon/doxmlparser/src/mainhandler.cpp @@ -16,6 +16,7 @@ #include <qxml.h> #include "mainhandler.h" #include "compoundhandler.h" +#include "sectionhandler.h" #include "debug.h" class ErrorHandler : public QXmlErrorHandler |