diff options
Diffstat (limited to 'addon')
-rw-r--r-- | addon/doxmlparser/include/doxmlintf.h | 136 | ||||
-rw-r--r-- | addon/doxmlparser/src/basehandler.h | 4 | ||||
-rw-r--r-- | addon/doxmlparser/src/baseiterator.h | 15 | ||||
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.cpp | 140 | ||||
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.h | 72 | ||||
-rw-r--r-- | addon/doxmlparser/src/dochandler.cpp | 9 | ||||
-rw-r--r-- | addon/doxmlparser/src/dochandler.h | 249 | ||||
-rw-r--r-- | addon/doxmlparser/src/doxmlintf.h | 136 | ||||
-rw-r--r-- | addon/doxmlparser/src/graphhandler.cpp | 30 | ||||
-rw-r--r-- | addon/doxmlparser/src/graphhandler.h | 18 | ||||
-rw-r--r-- | addon/doxmlparser/src/linkedtexthandler.cpp | 16 | ||||
-rw-r--r-- | addon/doxmlparser/src/linkedtexthandler.h | 21 | ||||
-rw-r--r-- | addon/doxmlparser/src/mainhandler.cpp | 4 | ||||
-rw-r--r-- | addon/doxmlparser/src/memberhandler.cpp | 2 | ||||
-rw-r--r-- | addon/doxmlparser/src/memberhandler.h | 8 | ||||
-rw-r--r-- | addon/doxmlparser/src/paramhandler.h | 19 | ||||
-rw-r--r-- | addon/doxmlparser/src/sectionhandler.h | 7 | ||||
-rw-r--r-- | addon/doxmlparser/test/main.cpp | 84 |
18 files changed, 726 insertions, 244 deletions
diff --git a/addon/doxmlparser/include/doxmlintf.h b/addon/doxmlparser/include/doxmlintf.h index 880df30..92d4e2d 100644 --- a/addon/doxmlparser/include/doxmlintf.h +++ b/addon/doxmlparser/include/doxmlintf.h @@ -7,13 +7,13 @@ class IMember; class IDocIterator; class ICompound; class ISection; +class INode; class ILinkedText { public: enum Kind { Kind_Text, Kind_Ref }; virtual Kind kind() const = 0; - virtual ~ILinkedText() {} }; class ILT_Text : public ILinkedText @@ -52,7 +52,6 @@ class IParam virtual QString attrib() const = 0; virtual QString arraySpecifier() const = 0; virtual ILinkedTextIterator *defaultValue() const = 0; - virtual ~IParam() {} }; class IParamIterator @@ -71,7 +70,6 @@ class IMemberReference public: virtual IMember *member() const = 0; virtual QString memberName() const = 0; - virtual ~IMemberReference() {} }; class IMemberReferenceIterator @@ -90,7 +88,6 @@ class IEnumValue public: virtual QString name() const = 0; virtual QString initializer() const = 0; - virtual ~IEnumValue() {} }; class IEnumValueIterator @@ -142,7 +139,6 @@ class IDoc Root // 30 -> IDocRoot }; virtual Kind kind() const = 0; - virtual ~IDoc() {} }; class IDocMarkup : public IDoc @@ -232,7 +228,8 @@ class IDocSimpleSect : public IDoc Todo, Test, RCS, EnumValues, Examples }; - virtual Types sectionType() const = 0; + virtual Types type() const = 0; + virtual QString typeString() const = 0; virtual IDocTitle *title() const = 0; virtual IDocPara *description() const = 0; }; @@ -411,7 +408,7 @@ class IChildNode enum NodeRelation { PublicInheritance, ProtectedInheritance, PrivateInheritance, Usage, TemplateInstance }; - virtual QString id() const = 0; + virtual INode * node() const = 0; virtual NodeRelation relation() const = 0; virtual QString relationString() const = 0; virtual IEdgeLabelIterator *edgeLabels() const = 0; @@ -452,7 +449,6 @@ class IGraph { public: virtual INodeIterator *nodes() const = 0; - virtual ~IGraph() {} }; class IMember @@ -488,7 +484,6 @@ class IMember virtual IEnumValueIterator *enumValues() const = 0; virtual IDocRoot *briefDescription() const = 0; virtual IDocRoot *detailedDescription() const = 0; - virtual ~IMember() {} }; class IMemberIterator @@ -524,7 +519,6 @@ class ISection virtual bool isPublic() const = 0; virtual bool isPrivate() const = 0; virtual bool isProtected() const = 0; - virtual ~ISection() {} }; class ISectionIterator @@ -541,19 +535,43 @@ class ISectionIterator class ICompound { public: + /*! Represents the kind of compounds recognised by doxygen. */ enum CompoundKind { Invalid=0, Class, Struct, Union, Interface, Exception, - Namespace, File, Group, Page, Package + Namespace, File, Group, Page }; + /*! Returns the name of this compound */ virtual QString name() const = 0; + + /*! Returns the id of this compound. The id is a + * unique string representing a specific compound object. + */ virtual QString id() const = 0; + + /*! Returns the kind of compound. See #CompoundKind for possible + * values. + */ virtual CompoundKind kind() const = 0; + + /*! Returns a string representation of the compound kind. + * @see kind() + */ virtual QString kindString() const = 0; + + /*! Returns an iterator for the different member sections in this + * compound. + */ virtual ISectionIterator *sections() const = 0; + + /*! Returns a tree-structured representation of the brief + * description that is attached to this compound. + */ virtual IDocRoot *briefDescription() const = 0; + + /*! Returns a tree-structured representation of the detailed + * description that is attached to this compound. + */ virtual IDocRoot *detailedDescription() const = 0; - virtual IGraph *inheritanceGraph() const = 0; - virtual IGraph *collaborationGraph() const = 0; /*! Returns an interface to a member given its id. * @param id The member id. @@ -561,7 +579,8 @@ class ICompound virtual IMember *memberById(const QString &id) const = 0; /*! Returns a list of all members within the compound having a certain - * name. Overloading is the reason why there can be more than one member. + * name. Member overloading is the reason why there can be more than + * one member. * @param name The name of the member. */ virtual IMemberIterator *memberByName(const QString &name) const = 0; @@ -570,44 +589,105 @@ class ICompound * zero, the memory for the compound will be released. */ virtual void release() = 0; +}; + +class ICompoundIterator +{ + public: + virtual void toFirst() = 0; + virtual void toLast() = 0; + virtual void toNext() = 0; + virtual void toPrev() = 0; + virtual ICompound *current() const = 0; + virtual void release() = 0; +}; + +class IRelatedCompound +{ + public: + enum Protection { Public, Protected, Private }; + enum Kind { Normal, Virtual }; + virtual ICompound *compound() const = 0; + virtual Protection protection() const = 0; + virtual Kind kind() const = 0; + +}; + +class IRelatedCompoundIterator +{ + public: + virtual IRelatedCompound *toFirst() = 0; + virtual IRelatedCompound *toLast() = 0; + virtual IRelatedCompound *toNext() = 0; + virtual IRelatedCompound *toPrev() = 0; + virtual IRelatedCompound *current() const = 0; + virtual void release() = 0; +}; + +class IClass : public ICompound +{ + public: + virtual IGraph *inheritanceGraph() const = 0; + virtual IGraph *collaborationGraph() const = 0; + virtual IRelatedCompoundIterator *baseClasses() const = 0; + virtual IRelatedCompoundIterator *derivedClasses() const = 0; + virtual ICompoundIterator *nestedClasses() const = 0; // TODO: // class: - // IRelatedCompoundIterator *baseClasses() - // IRelatedCompoundIterator *derivedClasses() - // ICompoundIterator *innerClasses() // ITemplateParamListIterator *templateParamLists() // listOfAllMembers() - // IDotGraph *inheritanceGraph() - // IDotGraph *collaborationGraph() // locationFile() // locationLine() // locationBodyStartLine() // locationBodyEndLine() +}; + +class IStruct : public ICompound +{ +}; + +class IUnion : public ICompound +{ +}; + +class IInterface : public ICompound +{ +}; + +class IException : public ICompound +{ +}; + +class INamespace : public ICompound +{ // namespace: // ICompound *innerNamespaces() + // ICompoundIterator *innerClasses() +}; + +class IFile : public ICompound +{ // file: // includes() // includedBy() // IDotGraph *includeDependencyGraph() // IDotGraph *includedByDependencyGraph() // IDocProgramListing *source() + // ICompound *innerNamespaces() + // ICompoundIterator *innerClasses() +}; + +class IGroup : public ICompound +{ // group: // Title() // innerFile() // innerPage() - // page: }; -class ICompoundIterator +class IPage : public ICompound { - public: - virtual void toFirst() = 0; - virtual void toLast() = 0; - virtual void toNext() = 0; - virtual void toPrev() = 0; - virtual ICompound *current() const = 0; - virtual void release() = 0; }; /*! Root node of the object model. */ diff --git a/addon/doxmlparser/src/basehandler.h b/addon/doxmlparser/src/basehandler.h index c86316b..0fb59bd 100644 --- a/addon/doxmlparser/src/basehandler.h +++ b/addon/doxmlparser/src/basehandler.h @@ -75,8 +75,8 @@ template<class T> class ElementMapper Handler m_handler; }; - typedef StartElementHandler<T> StartElementHandlerT; - typedef EndElementHandler<T> EndElementHandlerT; + typedef StartElementHandler StartElementHandlerT; + typedef EndElementHandler EndElementHandlerT; public: ElementMapper() : m_startHandlers(67), m_endHandlers(67) diff --git a/addon/doxmlparser/src/baseiterator.h b/addon/doxmlparser/src/baseiterator.h index 847d1ef..bbcf7cf 100644 --- a/addon/doxmlparser/src/baseiterator.h +++ b/addon/doxmlparser/src/baseiterator.h @@ -32,4 +32,19 @@ template<class Intf,class ElemIntf,class ElemImpl> class BaseIterator : virtual void release() { delete this; } }; +template<class Intf,class ElemIntf,class ElemImpl,class Intermediate> + class BaseIteratorVia : + public Intf, public QListIterator<ElemImpl> +{ + public: + BaseIteratorVia(const QList<ElemImpl> &list) : QListIterator<ElemImpl>(list) {} + virtual ~BaseIteratorVia() {} + virtual ElemIntf *toFirst() { return static_cast<Intermediate *>(QListIterator<ElemImpl>::toFirst()); } + virtual ElemIntf *toLast() { return static_cast<Intermediate *>(QListIterator<ElemImpl>::toLast()); } + virtual ElemIntf *toNext() { return static_cast<Intermediate *>(QListIterator<ElemImpl>::operator++()); } + virtual ElemIntf *toPrev() { return static_cast<Intermediate *>(QListIterator<ElemImpl>::operator--()); } + virtual ElemIntf *current() const { return static_cast<Intermediate *>(QListIterator<ElemImpl>::current()); } + virtual void release() { delete this; } +}; + #endif diff --git a/addon/doxmlparser/src/compoundhandler.cpp b/addon/doxmlparser/src/compoundhandler.cpp index 2873da5..ce7c852 100644 --- a/addon/doxmlparser/src/compoundhandler.cpp +++ b/addon/doxmlparser/src/compoundhandler.cpp @@ -20,6 +20,53 @@ #include "graphhandler.h" #include "sectionhandler.h" +//---------------------------------------------------------------------------- + +class CompoundIdIterator : public ICompoundIterator, + public QListIterator<QString> +{ + public: + CompoundIdIterator(const MainHandler *m,const QList<QString> &list) : + QListIterator<QString>(list), m_mainHandler(m) {} + virtual ~CompoundIdIterator() {} + + virtual void toFirst() + { + QListIterator<QString>::toFirst(); + } + virtual void toLast() + { + QListIterator<QString>::toLast(); + } + virtual void toNext() + { + QListIterator<QString>::operator++(); + } + virtual void toPrev() + { + QListIterator<QString>::operator--(); + } + virtual ICompound *current() const + { + QString *id = QListIterator<QString>::current(); + return id ? m_mainHandler->compoundById(*id) : 0; + } + virtual void release() + { delete this; } + + private: + const MainHandler *m_mainHandler; +}; + +//---------------------------------------------------------------------------- + +ICompound *RelatedCompound::compound() const +{ + return m_parent->m_mainHandler->compoundById(m_id); +} + +//---------------------------------------------------------------------------- + class CompoundErrorHandler : public QXmlErrorHandler { public: @@ -62,7 +109,6 @@ class CompoundTypeMap m_map.insert("file",new int(ICompound::File)); m_map.insert("group",new int(ICompound::Group)); m_map.insert("page",new int(ICompound::Page)); - m_map.insert("package",new int(ICompound::Package)); } virtual ~CompoundTypeMap() { @@ -104,6 +150,7 @@ CompoundHandler::CompoundHandler(const QString &xmlDir) m_subClasses.setAutoDelete(TRUE); m_sections.setAutoDelete(TRUE); m_memberNameDict.setAutoDelete(TRUE); + m_innerClasses.setAutoDelete(TRUE); addStartHandler("doxygen"); addEndHandler("doxygen"); @@ -135,6 +182,9 @@ CompoundHandler::CompoundHandler(const QString &xmlDir) addStartHandler("collaborationgraph",this,&CompoundHandler::startCollaborationGraph); + addStartHandler("innerclass",this,&CompoundHandler::startInnerClass); + addEndHandler("innerclass"); + } CompoundHandler::~CompoundHandler() @@ -143,6 +193,8 @@ CompoundHandler::~CompoundHandler() delete m_brief; delete m_detailed; delete m_programListing; + delete m_inheritanceGraph; + delete m_collaborationGraph; } void CompoundHandler::startSection(const QXmlAttributes& attrib) @@ -198,31 +250,56 @@ void CompoundHandler::endCompoundName() debug(2,"Compound name `%s'\n",m_name.data()); } +void CompoundHandler::startInnerClass(const QXmlAttributes& attrib) +{ + m_innerClasses.append(new QString(attrib.value("refid"))); +} + void CompoundHandler::addSuperClass(const QXmlAttributes& attrib) { - RelatedClass *sc=new RelatedClass( + IRelatedCompound::Protection prot = IRelatedCompound::Public; + QString protString = attrib.value("prot"); + if (protString=="protected") prot = IRelatedCompound::Protected; + else if (protString=="private") prot = IRelatedCompound::Private; + + IRelatedCompound::Kind kind = IRelatedCompound::Normal; + QString kindString = attrib.value("virt"); + if (kindString=="virtual") kind = IRelatedCompound::Virtual; + + RelatedCompound *sc=new RelatedCompound( + this, attrib.value("refid"), - attrib.value("prot"), - attrib.value("virt") + prot, + kind ); debug(2,"super class id=`%s' prot=`%s' virt=`%s'\n", - sc->m_id.data(), - sc->m_protection.data(), - sc->m_virtualness.data()); + attrib.value("refid").data(), + protString.data(), + kindString.data()); m_superClasses.append(sc); } void CompoundHandler::addSubClass(const QXmlAttributes& attrib) { - RelatedClass *sc = new RelatedClass( + IRelatedCompound::Protection prot = IRelatedCompound::Public; + QString protString = attrib.value("prot"); + if (protString=="protected") prot = IRelatedCompound::Protected; + else if (protString=="private") prot = IRelatedCompound::Private; + + IRelatedCompound::Kind kind = IRelatedCompound::Normal; + QString kindString = attrib.value("virt"); + if (kindString=="virtual") kind = IRelatedCompound::Virtual; + + RelatedCompound *sc = new RelatedCompound( + this, attrib.value("refid"), - attrib.value("prot"), - attrib.value("virt") + prot, + kind ); debug(2,"sub class id=`%s' prot=`%s' virt=`%s'\n", - sc->m_id.data(), - sc->m_protection.data(), - sc->m_virtualness.data()); + attrib.value("refid").data(), + protString.data(), + kindString.data()); m_subClasses.append(sc); } @@ -242,9 +319,9 @@ bool CompoundHandler::parseXML(const QString &compId) void CompoundHandler::initialize(MainHandler *mh) { m_mainHandler = mh; - QListIterator<ISection> msi(m_sections); + QListIterator<SectionHandler> msi(m_sections); SectionHandler *sec; - for (;(sec=(SectionHandler *)msi.current());++msi) + for (;(sec=msi.current());++msi) { sec->initialize(this); } @@ -262,6 +339,24 @@ void CompoundHandler::insertMember(MemberHandler *mh) mhl->append(mh); } +ICompound *CompoundHandler::toICompound() const +{ + switch (m_kind) + { + case IClass::Class: return (IClass *)this; + case IStruct::Struct: return (IStruct *)this; + case IUnion::Union: return (IUnion *)this; + case IException::Exception: return (IException *)this; + case IInterface::Interface: return (IInterface *)this; + case INamespace::Namespace: return (INamespace *)this; + case IFile::File: return (IFile *)this; + case IGroup::Group: return (IGroup *)this; + case IPage::Page: return (IPage *)this; + default: return 0; + } + return 0; +} + void CompoundHandler::release() { debug(2,"CompoundHandler::release() %d->%d\n",m_refCount,m_refCount-1); @@ -321,3 +416,18 @@ IGraph *CompoundHandler::collaborationGraph() const return m_collaborationGraph; } +IRelatedCompoundIterator *CompoundHandler::baseClasses() const +{ + return new RelatedCompoundIterator(m_superClasses); +} + +IRelatedCompoundIterator *CompoundHandler::derivedClasses() const +{ + return new RelatedCompoundIterator(m_subClasses); +} + +ICompoundIterator *CompoundHandler::nestedClasses() const +{ + return new CompoundIdIterator(m_mainHandler,m_innerClasses); +} + diff --git a/addon/doxmlparser/src/compoundhandler.h b/addon/doxmlparser/src/compoundhandler.h index c90b466..965e4c1 100644 --- a/addon/doxmlparser/src/compoundhandler.h +++ b/addon/doxmlparser/src/compoundhandler.h @@ -28,9 +28,52 @@ class DocHandler; class ProgramListingHandler; class GraphHandler; class MemberHandler; +class CompoundHandler; +class SectionHandler; -class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> + +class RelatedCompound : public IRelatedCompound +{ + public: + RelatedCompound(CompoundHandler *parent, + const QString &id, + Protection prot, + Kind kind + ) : + m_parent(parent), m_id(id), m_protection(prot), m_kind(kind) {} + virtual ~RelatedCompound() {} + + virtual ICompound *compound() const; + virtual Protection protection() const { return m_protection; } + virtual Kind kind() const { return m_kind; } + + private: + CompoundHandler *m_parent; + QString m_id; + Protection m_protection; + Kind m_kind; +}; + +class RelatedCompoundIterator : public BaseIterator<IRelatedCompoundIterator,IRelatedCompound,RelatedCompound> +{ + public: + RelatedCompoundIterator(const QList<RelatedCompound> &list) : + BaseIterator<IRelatedCompoundIterator,IRelatedCompound,RelatedCompound>(list) {} +}; + + +class CompoundHandler : public IClass, + public IStruct, + public IUnion, + public IException, + public IInterface, + public INamespace, + public IFile, + public IGroup, + public IPage, + public BaseHandler<CompoundHandler> { + friend class RelatedCompound; public: virtual void startSection(const QXmlAttributes& attrib); virtual void startCompound(const QXmlAttributes& attrib); @@ -44,6 +87,7 @@ class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> virtual void startProgramListing(const QXmlAttributes& attrib); virtual void startInheritanceGraph(const QXmlAttributes& attrib); virtual void startCollaborationGraph(const QXmlAttributes& attrib); + virtual void startInnerClass(const QXmlAttributes& attrib); virtual void addref() { m_refCount++; } CompoundHandler(const QString &dirName); @@ -51,6 +95,7 @@ class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> bool parseXML(const QString &compId); void initialize(MainHandler *mh); void insertMember(MemberHandler *mh); + ICompound *toICompound() const; // ICompound implementation QString name() const { return m_name; } @@ -60,25 +105,21 @@ class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> ISectionIterator *sections() const; IDocRoot *briefDescription() const; IDocRoot *detailedDescription() const; - IGraph *inheritanceGraph() const; - IGraph *collaborationGraph() const; IMember *memberById(const QString &id) const; IMemberIterator *memberByName(const QString &name) const; void release(); + // IClass implementation + IGraph *inheritanceGraph() const; + IGraph *collaborationGraph() const; + IRelatedCompoundIterator *baseClasses() const; + IRelatedCompoundIterator *derivedClasses() const; + ICompoundIterator *nestedClasses() const; + private: - struct RelatedClass - { - 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; - }; - QList<RelatedClass> m_superClasses; - QList<RelatedClass> m_subClasses; - QList<ISection> m_sections; + QList<RelatedCompound> m_superClasses; + QList<RelatedCompound> m_subClasses; + QList<SectionHandler> m_sections; DocHandler *m_brief; DocHandler *m_detailed; ProgramListingHandler *m_programListing; @@ -95,6 +136,7 @@ class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> MainHandler *m_mainHandler; GraphHandler *m_inheritanceGraph; GraphHandler *m_collaborationGraph; + QList<QString> m_innerClasses; }; diff --git a/addon/doxmlparser/src/dochandler.cpp b/addon/doxmlparser/src/dochandler.cpp index 8f1249f..4c91ba5 100644 --- a/addon/doxmlparser/src/dochandler.cpp +++ b/addon/doxmlparser/src/dochandler.cpp @@ -94,7 +94,7 @@ void dochandler_exit() // MarkupHandler //---------------------------------------------------------------------- -MarkupHandler::MarkupHandler(QList<IDoc> &children,QString &curString) +MarkupHandler::MarkupHandler(QList<DocImpl> &children,QString &curString) : m_children(children), m_curString(curString), m_curMarkup(IDocMarkup::Normal) { addStartHandler("bold",this,&MarkupHandler::startBold); @@ -700,8 +700,9 @@ SimpleSectHandler::~SimpleSectHandler() void SimpleSectHandler::startSimpleSect(const QXmlAttributes& attrib) { - m_type = s_typeMapper->stringToType(attrib.value("kind")); - debug(2,"start simple section %s\n",attrib.value("kind").data()); + m_typeString = attrib.value("kind"); + m_type = s_typeMapper->stringToType(m_typeString); + debug(2,"start simple section %s\n",m_typeString.data()); m_parent->setDelegate(this); } @@ -846,7 +847,7 @@ HighlightHandler::HighlightHandler(IBaseHandler *parent) m_children.setAutoDelete(TRUE); addEndHandler("highlight",this,&HighlightHandler::endHighlight); addStartHandler("ref",this,&HighlightHandler::startRef); - m_hl = Invalid; + m_hl = IDocHighlight::Invalid; } HighlightHandler::~HighlightHandler() diff --git a/addon/doxmlparser/src/dochandler.h b/addon/doxmlparser/src/dochandler.h index c3b8242..894296a 100644 --- a/addon/doxmlparser/src/dochandler.h +++ b/addon/doxmlparser/src/dochandler.h @@ -28,11 +28,50 @@ class ParagraphHandler; //----------------------------------------------------------------------------- +class DocImpl : public IDoc { public: virtual ~DocImpl() {} }; + +#define DEFINE_CLS_IMPL(cls) \ + class cls##Impl : public I##cls, public DocImpl { public: virtual ~cls##Impl() {} } + +DEFINE_CLS_IMPL(DocMarkup); +DEFINE_CLS_IMPL(DocPara); +DEFINE_CLS_IMPL(DocText); +DEFINE_CLS_IMPL(DocMarkupModifier); +DEFINE_CLS_IMPL(DocItemizedList); +DEFINE_CLS_IMPL(DocOrderedList); +DEFINE_CLS_IMPL(DocListItem); +DEFINE_CLS_IMPL(DocParameterList); +DEFINE_CLS_IMPL(DocParameter); +DEFINE_CLS_IMPL(DocTitle); +DEFINE_CLS_IMPL(DocSimpleSect); +DEFINE_CLS_IMPL(DocRef); +DEFINE_CLS_IMPL(DocVariableList); +DEFINE_CLS_IMPL(DocVariableListEntry); +DEFINE_CLS_IMPL(DocHRuler); +DEFINE_CLS_IMPL(DocLineBreak); +DEFINE_CLS_IMPL(DocULink); +DEFINE_CLS_IMPL(DocEMail); +DEFINE_CLS_IMPL(DocLink); +DEFINE_CLS_IMPL(DocProgramListing); +DEFINE_CLS_IMPL(DocCodeLine); +DEFINE_CLS_IMPL(DocHighlight); +DEFINE_CLS_IMPL(DocFormula); +DEFINE_CLS_IMPL(DocImage); +DEFINE_CLS_IMPL(DocDotFile); +DEFINE_CLS_IMPL(DocIndexEntry); +DEFINE_CLS_IMPL(DocTable); +DEFINE_CLS_IMPL(DocRow); +DEFINE_CLS_IMPL(DocEntry); +DEFINE_CLS_IMPL(DocSection); +DEFINE_CLS_IMPL(DocRoot); + +//----------------------------------------------------------------------------- + /*! \brief Node representing a piece of text. * */ -class TextNode : public IDocText +class TextNode : public DocTextImpl { public: TextNode(const QString &t,int markup) @@ -40,7 +79,7 @@ class TextNode : public IDocText virtual ~TextNode() {} // IDocText - virtual Kind kind() const { return Text; } + virtual Kind kind() const { return DocImpl::Text; } virtual QString text() const { return m_text; } virtual int markup() const { return m_markup; } @@ -54,7 +93,7 @@ class TextNode : public IDocText /*! \brief Node representing a change in the markup style. * */ -class MarkupModifierNode : public IDocMarkupModifier +class MarkupModifierNode : public DocMarkupModifierImpl { public: MarkupModifierNode(int markup,bool enabled) @@ -62,7 +101,7 @@ class MarkupModifierNode : public IDocMarkupModifier virtual ~MarkupModifierNode() {} // IDocMarkupModifier - virtual Kind kind() const { return MarkupModifier; } + virtual Kind kind() const { return DocImpl::MarkupModifier; } virtual bool enabled() const { return m_enabled; } virtual int markup() const { return m_markup; } @@ -80,7 +119,7 @@ class MarkupModifierNode : public IDocMarkupModifier class MarkupHandler : public BaseFallBackHandler<MarkupHandler> { public: - MarkupHandler(QList<IDoc> &children,QString &curString); + MarkupHandler(QList<DocImpl> &children,QString &curString); virtual ~MarkupHandler(); int markup() const { return m_curMarkup; } @@ -103,8 +142,8 @@ class MarkupHandler : public BaseFallBackHandler<MarkupHandler> private: void addTextNode(); - QList<IDoc> &m_children; - QString &m_curString; + QList<DocImpl> &m_children; + QString &m_curString; int m_curMarkup; }; @@ -122,7 +161,7 @@ class MarkupHandler : public BaseFallBackHandler<MarkupHandler> // bold, computeroutput, emphasis, center, // small, subscript, superscript. // -class ParagraphHandler : public IDocPara, +class ParagraphHandler : public DocParaImpl, public BaseHandler<ParagraphHandler> { friend class ParagraphIterator; @@ -152,21 +191,21 @@ class ParagraphHandler : public IDocPara, virtual ~ParagraphHandler(); // IDocPara - virtual Kind kind() const { return Para; } + virtual Kind kind() const { return DocImpl::Para; } virtual IDocIterator *contents() const; private: void addTextNode(); IBaseHandler *m_parent; - QList<IDoc> m_children; + QList<DocImpl> m_children; MarkupHandler *m_markupHandler; }; -class ParagraphIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +class ParagraphIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> { public: ParagraphIterator(const ParagraphHandler &handler) : - BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} }; //----------------------------------------------------------------------------- @@ -174,7 +213,7 @@ class ParagraphIterator : public BaseIterator<IDocIterator,IDoc,IDoc> /*! \brief Node representing a list item. * */ -class ListItemHandler : public IDocListItem, public BaseHandler<ListItemHandler> +class ListItemHandler : public DocListItemImpl, public BaseHandler<ListItemHandler> { friend class ListItemIterator; public: @@ -185,19 +224,19 @@ class ListItemHandler : public IDocListItem, public BaseHandler<ListItemHandler> virtual void startParagraph(const QXmlAttributes& attrib); // IDocItem - virtual Kind kind() const { return ListItem; } + virtual Kind kind() const { return DocImpl::ListItem; } virtual IDocIterator *contents() const; private: IBaseHandler *m_parent; - QList<IDoc> m_children; + QList<DocImpl> m_children; }; -class ListItemIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +class ListItemIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> { public: ListItemIterator(const ListItemHandler &handler) : - BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} }; @@ -206,7 +245,7 @@ class ListItemIterator : public BaseIterator<IDocIterator,IDoc,IDoc> /*! \brief Node representing list of items. * */ -class OrderedListHandler : public IDocOrderedList, public BaseHandler<OrderedListHandler> +class OrderedListHandler : public DocOrderedListImpl, public BaseHandler<OrderedListHandler> { friend class OrderedListIterator; public: @@ -217,19 +256,19 @@ class OrderedListHandler : public IDocOrderedList, public BaseHandler<OrderedLis virtual void startOrderedListItem(const QXmlAttributes& attrib); // IDocOrderedList - virtual Kind kind() const { return OrderedList; } + virtual Kind kind() const { return DocImpl::OrderedList; } virtual IDocIterator *elements() const; private: IBaseHandler *m_parent; - QList<IDoc> m_children; + QList<DocImpl> m_children; }; -class OrderedListIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +class OrderedListIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> { public: OrderedListIterator(const OrderedListHandler &handler) : - BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} }; @@ -238,7 +277,7 @@ class OrderedListIterator : public BaseIterator<IDocIterator,IDoc,IDoc> /*! \brief Node representing list of items. * */ -class ItemizedListHandler : public IDocItemizedList, public BaseHandler<ItemizedListHandler> +class ItemizedListHandler : public DocItemizedListImpl, public BaseHandler<ItemizedListHandler> { friend class ItemizedListIterator; public: @@ -249,19 +288,19 @@ class ItemizedListHandler : public IDocItemizedList, public BaseHandler<Itemized virtual void startItemizedListItem(const QXmlAttributes& attrib); // IDocItemizedList - virtual Kind kind() const { return ItemizedList; } + virtual Kind kind() const { return DocImpl::ItemizedList; } virtual IDocIterator *elements() const; private: IBaseHandler *m_parent; - QList<IDoc> m_children; + QList<DocImpl> m_children; }; -class ItemizedListIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +class ItemizedListIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> { public: ItemizedListIterator(const ItemizedListHandler &handler) : - BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} }; @@ -269,7 +308,7 @@ class ItemizedListIterator : public BaseIterator<IDocIterator,IDoc,IDoc> /*! \brief Node representing a parameter. * */ -class ParameterHandler : public IDocParameter, +class ParameterHandler : public DocParameterImpl, public BaseHandler<ParameterHandler> { public: @@ -282,7 +321,7 @@ class ParameterHandler : public IDocParameter, virtual void startParagraph(const QXmlAttributes& attrib); // IDocParameter - virtual Kind kind() const { return Parameter; } + virtual Kind kind() const { return DocImpl::Parameter; } virtual QString name() const { return m_name; } virtual IDocPara *description() const { return m_description; } @@ -297,7 +336,7 @@ class ParameterHandler : public IDocParameter, /* \brief Node representing a parameter list. * */ -class ParameterListHandler : public IDocParameterList, +class ParameterListHandler : public DocParameterListImpl, public BaseHandler<ParameterListHandler> { friend class ParameterListIterator; @@ -310,7 +349,7 @@ class ParameterListHandler : public IDocParameterList, virtual void startParameterDescription(const QXmlAttributes& attrib); // IDocParameterList - virtual Kind kind() const { return ParameterList; } + virtual Kind kind() const { return DocImpl::ParameterList; } virtual Types listType() const { return m_type; } virtual IDocIterator *params() const; @@ -321,11 +360,11 @@ class ParameterListHandler : public IDocParameterList, Types m_type; }; -class ParameterListIterator : public BaseIterator<IDocIterator,IDoc,ParameterHandler> +class ParameterListIterator : public BaseIteratorVia<IDocIterator,IDoc,ParameterHandler,DocImpl> { public: ParameterListIterator(const ParameterListHandler &handler) : - BaseIterator<IDocIterator,IDoc,ParameterHandler>(handler.m_parameters) {} + BaseIteratorVia<IDocIterator,IDoc,ParameterHandler,DocImpl>(handler.m_parameters) {} }; //----------------------------------------------------------------------------- @@ -333,7 +372,7 @@ class ParameterListIterator : public BaseIterator<IDocIterator,IDoc,ParameterHan /* \brief Node representing a horizontal ruler * */ -class LineBreakHandler : public IDocLineBreak, public BaseHandler<LineBreakHandler> +class LineBreakHandler : public DocLineBreakImpl, public BaseHandler<LineBreakHandler> { public: LineBreakHandler(IBaseHandler *parent); @@ -343,7 +382,7 @@ class LineBreakHandler : public IDocLineBreak, public BaseHandler<LineBreakHandl void endLineBreak(); // IDocLineBreak - virtual Kind kind() const { return LineBreak; } + virtual Kind kind() const { return DocImpl::LineBreak; } private: IBaseHandler *m_parent; @@ -354,7 +393,7 @@ class LineBreakHandler : public IDocLineBreak, public BaseHandler<LineBreakHandl /* \brief Node representing a link to section * */ -class LinkHandler : public IDocLink, public BaseHandler<LinkHandler> +class LinkHandler : public DocLinkImpl, public BaseHandler<LinkHandler> { public: LinkHandler(IBaseHandler *parent); @@ -364,7 +403,7 @@ class LinkHandler : public IDocLink, public BaseHandler<LinkHandler> void endLink(); // IDocLink - virtual Kind kind() const { return Link; } + virtual Kind kind() const { return DocImpl::Link; } virtual QString refId() const { return m_ref; } virtual QString text() const { return m_text; } @@ -380,7 +419,7 @@ class LinkHandler : public IDocLink, public BaseHandler<LinkHandler> /* \brief Node representing a link to an email address * */ -class EMailHandler : public IDocEMail, public BaseHandler<EMailHandler> +class EMailHandler : public DocEMailImpl, public BaseHandler<EMailHandler> { public: EMailHandler(IBaseHandler *parent); @@ -390,7 +429,7 @@ class EMailHandler : public IDocEMail, public BaseHandler<EMailHandler> void endEMail(); // IDocEMail - virtual Kind kind() const { return EMail; } + virtual Kind kind() const { return DocImpl::EMail; } virtual QString address() const { return m_address; } private: @@ -404,7 +443,7 @@ class EMailHandler : public IDocEMail, public BaseHandler<EMailHandler> /* \brief Node representing a link to an URL * */ -class ULinkHandler : public IDocULink, public BaseHandler<ULinkHandler> +class ULinkHandler : public DocULinkImpl, public BaseHandler<ULinkHandler> { public: ULinkHandler(IBaseHandler *parent); @@ -414,7 +453,7 @@ class ULinkHandler : public IDocULink, public BaseHandler<ULinkHandler> void endULink(); // IDocULink - virtual Kind kind() const { return ULink; } + virtual Kind kind() const { return DocImpl::ULink; } virtual QString url() const { return m_url; } virtual QString text() const { return m_text; } @@ -429,7 +468,7 @@ class ULinkHandler : public IDocULink, public BaseHandler<ULinkHandler> /* \brief Node representing a horizontal ruler * */ -class HRulerHandler : public IDocHRuler, public BaseHandler<HRulerHandler> +class HRulerHandler : public DocHRulerImpl, public BaseHandler<HRulerHandler> { public: HRulerHandler(IBaseHandler *parent); @@ -439,7 +478,7 @@ class HRulerHandler : public IDocHRuler, public BaseHandler<HRulerHandler> void endHRuler(); // IDocHRuler - virtual Kind kind() const { return HRuler; } + virtual Kind kind() const { return DocImpl::HRuler; } private: IBaseHandler *m_parent; @@ -450,7 +489,7 @@ class HRulerHandler : public IDocHRuler, public BaseHandler<HRulerHandler> /* \brief Node representing a reference to another item * */ -class RefHandler : public IDocRef, public BaseHandler<RefHandler> +class RefHandler : public DocRefImpl, public BaseHandler<RefHandler> { public: RefHandler(IBaseHandler *parent); @@ -459,7 +498,7 @@ class RefHandler : public IDocRef, public BaseHandler<RefHandler> void endRef(); // IDocRef - virtual Kind kind() const { return Ref; } + virtual Kind kind() const { return DocImpl::Ref; } virtual QString refId() const { return m_refId; } virtual TargetKind targetKind() const { return m_targetKind; } virtual QString external() const { return m_extId; } @@ -482,7 +521,7 @@ class RefHandler : public IDocRef, public BaseHandler<RefHandler> // children handled by MarkupHandler: // bold, computeroutput, emphasis, center, // small, subscript, superscript. -class TitleHandler : public IDocTitle, public BaseHandler<TitleHandler> +class TitleHandler : public DocTitleImpl, public BaseHandler<TitleHandler> { friend class TitleIterator; public: @@ -494,20 +533,20 @@ class TitleHandler : public IDocTitle, public BaseHandler<TitleHandler> void addTextNode(); // IDocTitle - virtual Kind kind() const { return Title; } + virtual Kind kind() const { return DocImpl::Title; } virtual IDocIterator *title() const; private: IBaseHandler *m_parent; - QList<IDoc> m_children; + QList<DocImpl> m_children; MarkupHandler *m_markupHandler; }; -class TitleIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +class TitleIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> { public: TitleIterator(const TitleHandler &handler) : - BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} }; //----------------------------------------------------------------------------- @@ -516,7 +555,7 @@ class TitleIterator : public BaseIterator<IDocIterator,IDoc,IDoc> * */ // children: title, para -class SimpleSectHandler : public IDocSimpleSect, +class SimpleSectHandler : public DocSimpleSectImpl, public BaseHandler<SimpleSectHandler> { public: @@ -528,8 +567,9 @@ class SimpleSectHandler : public IDocSimpleSect, virtual void startParagraph(const QXmlAttributes& attrib); // IDocSimpleSect - virtual Kind kind() const { return SimpleSect; } - virtual Types sectionType() const { return m_type; } + virtual Kind kind() const { return DocImpl::SimpleSect; } + virtual Types type() const { return m_type; } + virtual QString typeString() const { return m_typeString; } virtual IDocTitle *title() const { return m_title; } virtual IDocPara *description() const { return m_paragraph; } @@ -537,6 +577,7 @@ class SimpleSectHandler : public IDocSimpleSect, IBaseHandler *m_parent; ParagraphHandler *m_paragraph; Types m_type; + QString m_typeString; TitleHandler *m_title; }; @@ -545,7 +586,7 @@ class SimpleSectHandler : public IDocSimpleSect, /* \brief Node representing an named item of a VariableList. * */ -class VariableListEntryHandler : public IDocVariableListEntry, +class VariableListEntryHandler : public DocVariableListEntryImpl, public BaseHandler<VariableListEntryHandler> { public: @@ -561,7 +602,7 @@ class VariableListEntryHandler : public IDocVariableListEntry, virtual ~VariableListEntryHandler(); // IDocVariableListEntry - virtual Kind kind() const { return VariableListEntry; } + virtual Kind kind() const { return DocImpl::VariableListEntry; } virtual QString term() const { return m_term; } virtual IDocPara *description() const { return m_description; } @@ -577,7 +618,7 @@ class VariableListEntryHandler : public IDocVariableListEntry, * */ // children: varlistentry, listitem -class VariableListHandler : public IDocVariableList, +class VariableListHandler : public DocVariableListImpl, public BaseHandler<VariableListHandler> { friend class VariableListIterator; @@ -592,7 +633,7 @@ class VariableListHandler : public IDocVariableList, virtual ~VariableListHandler(); // IDocVariableList - virtual Kind kind() const { return VariableList; } + virtual Kind kind() const { return DocImpl::VariableList; } virtual IDocIterator *entries() const; private: @@ -601,11 +642,11 @@ class VariableListHandler : public IDocVariableList, VariableListEntryHandler *m_curEntry; }; -class VariableListIterator : public BaseIterator<IDocIterator,IDoc,VariableListEntryHandler> +class VariableListIterator : public BaseIteratorVia<IDocIterator,IDoc,VariableListEntryHandler,DocImpl> { public: VariableListIterator(const VariableListHandler &handler) : - BaseIterator<IDocIterator,IDoc,VariableListEntryHandler>(handler.m_entries) {} + BaseIteratorVia<IDocIterator,IDoc,VariableListEntryHandler,DocImpl>(handler.m_entries) {} }; //----------------------------------------------------------------------------- @@ -614,7 +655,7 @@ class VariableListIterator : public BaseIterator<IDocIterator,IDoc,VariableListE * */ // children: ref -class HighlightHandler : public IDocHighlight, public BaseHandler<HighlightHandler> +class HighlightHandler : public DocHighlightImpl, public BaseHandler<HighlightHandler> { friend class HighlightIterator; public: @@ -625,7 +666,7 @@ class HighlightHandler : public IDocHighlight, public BaseHandler<HighlightHandl virtual void startRef(const QXmlAttributes&); // IDocHighlight - virtual Kind kind() const { return Highlight; } + virtual Kind kind() const { return DocImpl::Highlight; } virtual HighlightKind highlightKind() const { return m_hl; } virtual IDocIterator *codeElements() const; @@ -635,14 +676,14 @@ class HighlightHandler : public IDocHighlight, public BaseHandler<HighlightHandl IBaseHandler *m_parent; HighlightKind m_hl; QString m_hlString; - QList<IDoc> m_children; + QList<DocImpl> m_children; }; -class HighlightIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +class HighlightIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> { public: HighlightIterator(const HighlightHandler &handler) : - BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} }; //----------------------------------------------------------------------------- @@ -651,7 +692,7 @@ class HighlightIterator : public BaseIterator<IDocIterator,IDoc,IDoc> * */ // children: linenumber, highlight, anchor, ref -class CodeLineHandler : public IDocCodeLine, public BaseHandler<CodeLineHandler> +class CodeLineHandler : public DocCodeLineImpl, public BaseHandler<CodeLineHandler> { friend class CodeLineIterator; public: @@ -667,7 +708,7 @@ class CodeLineHandler : public IDocCodeLine, public BaseHandler<CodeLineHandler> virtual ~CodeLineHandler(); // IDocCodeLine - virtual Kind kind() const { return CodeLine; } + virtual Kind kind() const { return DocImpl::CodeLine; } virtual int lineNumber() const { return m_lineNumber; } virtual QString refId() const { return m_refId; } virtual IDocIterator *codeElements() const; @@ -678,14 +719,14 @@ class CodeLineHandler : public IDocCodeLine, public BaseHandler<CodeLineHandler> IBaseHandler *m_parent; int m_lineNumber; QString m_refId; - QList<IDoc> m_children; + QList<DocImpl> m_children; }; -class CodeLineIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +class CodeLineIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> { public: CodeLineIterator(const CodeLineHandler &handler) : - BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} }; //----------------------------------------------------------------------------- @@ -694,7 +735,7 @@ class CodeLineIterator : public BaseIterator<IDocIterator,IDoc,IDoc> * */ // children: codeline, linenumber -class ProgramListingHandler : public IDocProgramListing, public BaseHandler<ProgramListingHandler> +class ProgramListingHandler : public DocProgramListingImpl, public BaseHandler<ProgramListingHandler> { friend class ProgramListingIterator; public: @@ -707,7 +748,7 @@ class ProgramListingHandler : public IDocProgramListing, public BaseHandler<Prog virtual ~ProgramListingHandler(); // IDocProgramListing - virtual Kind kind() const { return ProgramListing; } + virtual Kind kind() const { return DocImpl::ProgramListing; } virtual IDocIterator *codeLines() const; private: @@ -718,11 +759,11 @@ class ProgramListingHandler : public IDocProgramListing, public BaseHandler<Prog //----------------------------------------------------------------------------- -class ProgramListingIterator : public BaseIterator<IDocIterator,IDoc,CodeLineHandler> +class ProgramListingIterator : public BaseIteratorVia<IDocIterator,IDoc,CodeLineHandler,DocImpl> { public: ProgramListingIterator(const ProgramListingHandler &handler) : - BaseIterator<IDocIterator,IDoc,CodeLineHandler>(handler.m_children) {} + BaseIteratorVia<IDocIterator,IDoc,CodeLineHandler,DocImpl>(handler.m_children) {} }; //----------------------------------------------------------------------------- @@ -731,7 +772,7 @@ class ProgramListingIterator : public BaseIterator<IDocIterator,IDoc,CodeLineHan * */ // children: - -class FormulaHandler : public IDocFormula, public BaseHandler<FormulaHandler> +class FormulaHandler : public DocFormulaImpl, public BaseHandler<FormulaHandler> { public: FormulaHandler(IBaseHandler *parent); @@ -740,7 +781,7 @@ class FormulaHandler : public IDocFormula, public BaseHandler<FormulaHandler> void endFormula(); // IDocFormula - virtual Kind kind() const { return Formula; } + virtual Kind kind() const { return DocImpl::Formula; } virtual QString id() const { return m_id; } virtual QString text() const { return m_text; } @@ -756,7 +797,7 @@ class FormulaHandler : public IDocFormula, public BaseHandler<FormulaHandler> * */ // children: - -class ImageHandler : public IDocImage, public BaseHandler<ImageHandler> +class ImageHandler : public DocImageImpl, public BaseHandler<ImageHandler> { public: ImageHandler(IBaseHandler *parent); @@ -765,7 +806,7 @@ class ImageHandler : public IDocImage, public BaseHandler<ImageHandler> void endImage(); // IDocImage - virtual Kind kind() const { return Image; } + virtual Kind kind() const { return DocImpl::Image; } virtual QString name() const { return m_name; } virtual QString caption() const { return m_caption; } @@ -781,7 +822,7 @@ class ImageHandler : public IDocImage, public BaseHandler<ImageHandler> * */ // children: - -class DotFileHandler : public IDocDotFile, public BaseHandler<DotFileHandler> +class DotFileHandler : public DocDotFileImpl, public BaseHandler<DotFileHandler> { public: DotFileHandler(IBaseHandler *parent); @@ -790,7 +831,7 @@ class DotFileHandler : public IDocDotFile, public BaseHandler<DotFileHandler> void endDotFile(); // IDocDotFile - virtual Kind kind() const { return DotFile; } + virtual Kind kind() const { return DocImpl::DotFile; } virtual QString name() const { return m_name; } virtual QString caption() const { return m_caption; } @@ -806,7 +847,7 @@ class DotFileHandler : public IDocDotFile, public BaseHandler<DotFileHandler> * */ // children: - -class IndexEntryHandler : public IDocIndexEntry, public BaseHandler<IndexEntryHandler> +class IndexEntryHandler : public DocIndexEntryImpl, public BaseHandler<IndexEntryHandler> { public: IndexEntryHandler(IBaseHandler *parent); @@ -819,7 +860,7 @@ class IndexEntryHandler : public IDocIndexEntry, public BaseHandler<IndexEntryHa void endSecondaryIE(); // IDocIndexEntry - virtual Kind kind() const { return IndexEntry; } + virtual Kind kind() const { return DocImpl::IndexEntry; } virtual QString primary() const { return m_primary; } virtual QString secondary() const { return m_secondary; } @@ -835,7 +876,7 @@ class IndexEntryHandler : public IDocIndexEntry, public BaseHandler<IndexEntryHa * */ // children: para -class EntryHandler : public IDocEntry, public BaseHandler<EntryHandler> +class EntryHandler : public DocEntryImpl, public BaseHandler<EntryHandler> { friend class EntryIterator; public: @@ -846,19 +887,19 @@ class EntryHandler : public IDocEntry, public BaseHandler<EntryHandler> void startParagraph(const QXmlAttributes& attrib); // IDocEntry - virtual Kind kind() const { return Entry; } + virtual Kind kind() const { return DocImpl::Entry; } virtual IDocIterator *contents() const; private: IBaseHandler *m_parent; - QList<IDoc> m_children; + QList<DocImpl> m_children; }; -class EntryIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +class EntryIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> { public: EntryIterator(const EntryHandler &handler) : - BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} }; //----------------------------------------------------------------------------- @@ -867,7 +908,7 @@ class EntryIterator : public BaseIterator<IDocIterator,IDoc,IDoc> * */ // children: entry -class RowHandler : public IDocRow, public BaseHandler<RowHandler> +class RowHandler : public DocRowImpl, public BaseHandler<RowHandler> { friend class RowIterator; public: @@ -878,7 +919,7 @@ class RowHandler : public IDocRow, public BaseHandler<RowHandler> void startEntry(const QXmlAttributes& attrib); // IDocRow - virtual Kind kind() const { return Row; } + virtual Kind kind() const { return DocImpl::Row; } virtual IDocIterator *entries() const; private: @@ -886,11 +927,11 @@ class RowHandler : public IDocRow, public BaseHandler<RowHandler> QList<EntryHandler> m_children; }; -class RowIterator : public BaseIterator<IDocIterator,IDoc,EntryHandler> +class RowIterator : public BaseIteratorVia<IDocIterator,IDoc,EntryHandler,DocImpl> { public: RowIterator(const RowHandler &handler) : - BaseIterator<IDocIterator,IDoc,EntryHandler>(handler.m_children) {} + BaseIteratorVia<IDocIterator,IDoc,EntryHandler,DocImpl>(handler.m_children) {} }; //----------------------------------------------------------------------------- @@ -899,7 +940,7 @@ class RowIterator : public BaseIterator<IDocIterator,IDoc,EntryHandler> * */ // children: row, caption -class TableHandler : public IDocTable, public BaseHandler<TableHandler> +class TableHandler : public DocTableImpl, public BaseHandler<TableHandler> { friend class TableIterator; public: @@ -912,7 +953,7 @@ class TableHandler : public IDocTable, public BaseHandler<TableHandler> void endCaption(); // IDocTable - virtual Kind kind() const { return Table; } + virtual Kind kind() const { return DocImpl::Table; } virtual IDocIterator *rows() const; virtual int numColumns() const { return m_numColumns; } virtual QString caption() const { return m_caption; } @@ -924,11 +965,11 @@ class TableHandler : public IDocTable, public BaseHandler<TableHandler> QString m_caption; }; -class TableIterator : public BaseIterator<IDocIterator,IDoc,RowHandler> +class TableIterator : public BaseIteratorVia<IDocIterator,IDoc,RowHandler,DocImpl> { public: TableIterator(const TableHandler &handler) : - BaseIterator<IDocIterator,IDoc,RowHandler>(handler.m_children) {} + BaseIteratorVia<IDocIterator,IDoc,RowHandler,DocImpl>(handler.m_children) {} }; @@ -941,7 +982,7 @@ class TableIterator : public BaseIterator<IDocIterator,IDoc,RowHandler> // children handled by MarkupHandler: // bold, computeroutput, emphasis, center, // small, subscript, superscript. -class DocSectionHandler : public IDocSection, public BaseHandler<DocSectionHandler> +class DocSectionHandler : public DocSectionImpl, public BaseHandler<DocSectionHandler> { friend class DocSectionIterator; public: @@ -953,24 +994,24 @@ class DocSectionHandler : public IDocSection, public BaseHandler<DocSectionHandl void addTextNode(); // IDocSection - virtual Kind kind() const { return Section; } + virtual Kind kind() const { return DocImpl::Section; } virtual QString id() const { return m_id; } virtual int level() const { return m_level; } virtual IDocIterator *title() const; private: IBaseHandler *m_parent; - QList<IDoc> m_children; + QList<DocImpl> m_children; MarkupHandler *m_markupHandler; QString m_id; int m_level; }; -class DocSectionIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +class DocSectionIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> { public: DocSectionIterator(const DocSectionHandler &handler) : - BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} }; //----------------------------------------------------------------------------- @@ -979,7 +1020,7 @@ class DocSectionIterator : public BaseIterator<IDocIterator,IDoc,IDoc> * */ // children: para, title, sect1, sect2, sect3 -class DocHandler : public IDocRoot, public BaseHandler<DocHandler> +class DocHandler : public DocRootImpl, public BaseHandler<DocHandler> { friend class DocIterator; public: @@ -995,19 +1036,19 @@ class DocHandler : public IDocRoot, public BaseHandler<DocHandler> virtual ~DocHandler(); // IDocRoot - virtual Kind kind() const { return Root; } + virtual Kind kind() const { return DocImpl::Root; } virtual IDocIterator *contents() const; private: IBaseHandler *m_parent; - QList<IDoc> m_children; + QList<DocImpl> m_children; }; -class DocIterator : public BaseIterator<IDocIterator,IDoc,IDoc> +class DocIterator : public BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl> { public: DocIterator(const DocHandler &handler) : - BaseIterator<IDocIterator,IDoc,IDoc>(handler.m_children) {} + BaseIteratorVia<IDocIterator,IDoc,DocImpl,DocImpl>(handler.m_children) {} }; void dochandler_init(); diff --git a/addon/doxmlparser/src/doxmlintf.h b/addon/doxmlparser/src/doxmlintf.h index 880df30..92d4e2d 100644 --- a/addon/doxmlparser/src/doxmlintf.h +++ b/addon/doxmlparser/src/doxmlintf.h @@ -7,13 +7,13 @@ class IMember; class IDocIterator; class ICompound; class ISection; +class INode; class ILinkedText { public: enum Kind { Kind_Text, Kind_Ref }; virtual Kind kind() const = 0; - virtual ~ILinkedText() {} }; class ILT_Text : public ILinkedText @@ -52,7 +52,6 @@ class IParam virtual QString attrib() const = 0; virtual QString arraySpecifier() const = 0; virtual ILinkedTextIterator *defaultValue() const = 0; - virtual ~IParam() {} }; class IParamIterator @@ -71,7 +70,6 @@ class IMemberReference public: virtual IMember *member() const = 0; virtual QString memberName() const = 0; - virtual ~IMemberReference() {} }; class IMemberReferenceIterator @@ -90,7 +88,6 @@ class IEnumValue public: virtual QString name() const = 0; virtual QString initializer() const = 0; - virtual ~IEnumValue() {} }; class IEnumValueIterator @@ -142,7 +139,6 @@ class IDoc Root // 30 -> IDocRoot }; virtual Kind kind() const = 0; - virtual ~IDoc() {} }; class IDocMarkup : public IDoc @@ -232,7 +228,8 @@ class IDocSimpleSect : public IDoc Todo, Test, RCS, EnumValues, Examples }; - virtual Types sectionType() const = 0; + virtual Types type() const = 0; + virtual QString typeString() const = 0; virtual IDocTitle *title() const = 0; virtual IDocPara *description() const = 0; }; @@ -411,7 +408,7 @@ class IChildNode enum NodeRelation { PublicInheritance, ProtectedInheritance, PrivateInheritance, Usage, TemplateInstance }; - virtual QString id() const = 0; + virtual INode * node() const = 0; virtual NodeRelation relation() const = 0; virtual QString relationString() const = 0; virtual IEdgeLabelIterator *edgeLabels() const = 0; @@ -452,7 +449,6 @@ class IGraph { public: virtual INodeIterator *nodes() const = 0; - virtual ~IGraph() {} }; class IMember @@ -488,7 +484,6 @@ class IMember virtual IEnumValueIterator *enumValues() const = 0; virtual IDocRoot *briefDescription() const = 0; virtual IDocRoot *detailedDescription() const = 0; - virtual ~IMember() {} }; class IMemberIterator @@ -524,7 +519,6 @@ class ISection virtual bool isPublic() const = 0; virtual bool isPrivate() const = 0; virtual bool isProtected() const = 0; - virtual ~ISection() {} }; class ISectionIterator @@ -541,19 +535,43 @@ class ISectionIterator class ICompound { public: + /*! Represents the kind of compounds recognised by doxygen. */ enum CompoundKind { Invalid=0, Class, Struct, Union, Interface, Exception, - Namespace, File, Group, Page, Package + Namespace, File, Group, Page }; + /*! Returns the name of this compound */ virtual QString name() const = 0; + + /*! Returns the id of this compound. The id is a + * unique string representing a specific compound object. + */ virtual QString id() const = 0; + + /*! Returns the kind of compound. See #CompoundKind for possible + * values. + */ virtual CompoundKind kind() const = 0; + + /*! Returns a string representation of the compound kind. + * @see kind() + */ virtual QString kindString() const = 0; + + /*! Returns an iterator for the different member sections in this + * compound. + */ virtual ISectionIterator *sections() const = 0; + + /*! Returns a tree-structured representation of the brief + * description that is attached to this compound. + */ virtual IDocRoot *briefDescription() const = 0; + + /*! Returns a tree-structured representation of the detailed + * description that is attached to this compound. + */ virtual IDocRoot *detailedDescription() const = 0; - virtual IGraph *inheritanceGraph() const = 0; - virtual IGraph *collaborationGraph() const = 0; /*! Returns an interface to a member given its id. * @param id The member id. @@ -561,7 +579,8 @@ class ICompound virtual IMember *memberById(const QString &id) const = 0; /*! Returns a list of all members within the compound having a certain - * name. Overloading is the reason why there can be more than one member. + * name. Member overloading is the reason why there can be more than + * one member. * @param name The name of the member. */ virtual IMemberIterator *memberByName(const QString &name) const = 0; @@ -570,44 +589,105 @@ class ICompound * zero, the memory for the compound will be released. */ virtual void release() = 0; +}; + +class ICompoundIterator +{ + public: + virtual void toFirst() = 0; + virtual void toLast() = 0; + virtual void toNext() = 0; + virtual void toPrev() = 0; + virtual ICompound *current() const = 0; + virtual void release() = 0; +}; + +class IRelatedCompound +{ + public: + enum Protection { Public, Protected, Private }; + enum Kind { Normal, Virtual }; + virtual ICompound *compound() const = 0; + virtual Protection protection() const = 0; + virtual Kind kind() const = 0; + +}; + +class IRelatedCompoundIterator +{ + public: + virtual IRelatedCompound *toFirst() = 0; + virtual IRelatedCompound *toLast() = 0; + virtual IRelatedCompound *toNext() = 0; + virtual IRelatedCompound *toPrev() = 0; + virtual IRelatedCompound *current() const = 0; + virtual void release() = 0; +}; + +class IClass : public ICompound +{ + public: + virtual IGraph *inheritanceGraph() const = 0; + virtual IGraph *collaborationGraph() const = 0; + virtual IRelatedCompoundIterator *baseClasses() const = 0; + virtual IRelatedCompoundIterator *derivedClasses() const = 0; + virtual ICompoundIterator *nestedClasses() const = 0; // TODO: // class: - // IRelatedCompoundIterator *baseClasses() - // IRelatedCompoundIterator *derivedClasses() - // ICompoundIterator *innerClasses() // ITemplateParamListIterator *templateParamLists() // listOfAllMembers() - // IDotGraph *inheritanceGraph() - // IDotGraph *collaborationGraph() // locationFile() // locationLine() // locationBodyStartLine() // locationBodyEndLine() +}; + +class IStruct : public ICompound +{ +}; + +class IUnion : public ICompound +{ +}; + +class IInterface : public ICompound +{ +}; + +class IException : public ICompound +{ +}; + +class INamespace : public ICompound +{ // namespace: // ICompound *innerNamespaces() + // ICompoundIterator *innerClasses() +}; + +class IFile : public ICompound +{ // file: // includes() // includedBy() // IDotGraph *includeDependencyGraph() // IDotGraph *includedByDependencyGraph() // IDocProgramListing *source() + // ICompound *innerNamespaces() + // ICompoundIterator *innerClasses() +}; + +class IGroup : public ICompound +{ // group: // Title() // innerFile() // innerPage() - // page: }; -class ICompoundIterator +class IPage : public ICompound { - public: - virtual void toFirst() = 0; - virtual void toLast() = 0; - virtual void toNext() = 0; - virtual void toPrev() = 0; - virtual ICompound *current() const = 0; - virtual void release() = 0; }; /*! Root node of the object model. */ diff --git a/addon/doxmlparser/src/graphhandler.cpp b/addon/doxmlparser/src/graphhandler.cpp index 0e47f10..a11273d 100644 --- a/addon/doxmlparser/src/graphhandler.cpp +++ b/addon/doxmlparser/src/graphhandler.cpp @@ -39,19 +39,23 @@ GraphHandler::GraphHandler(IBaseHandler *parent,const char *endTag) addEndHandler(endTag,this,&GraphHandler::endGraph); addStartHandler("node",this,&GraphHandler::startNode); m_nodes.setAutoDelete(TRUE); + m_nodeDict = new QDict<NodeHandler>(1009); } GraphHandler::~GraphHandler() { + delete m_nodeDict; } void GraphHandler::startGraph(const QXmlAttributes &) { + debug(2,"startGraph\n"); m_parent->setDelegate(this); } void GraphHandler::endGraph() { + debug(2,"endGraph\n"); m_parent->setDelegate(0); } @@ -60,6 +64,7 @@ void GraphHandler::startNode(const QXmlAttributes &attrib) NodeHandler *n = new NodeHandler(this); n->startNode(attrib); m_nodes.append(n); + m_nodeDict->insert(attrib.value("id"),n); } INodeIterator *GraphHandler::nodes() const @@ -67,10 +72,15 @@ INodeIterator *GraphHandler::nodes() const return new NodeIterator(*this); } +NodeHandler *GraphHandler::getNodeById(const QString &id) const +{ + return m_nodeDict->find(id); +} + //------------------------------------------------------------------------ -NodeHandler::NodeHandler(IBaseHandler *parent) - : m_parent(parent) +NodeHandler::NodeHandler(GraphHandler *gh) + : m_parent(gh), m_graph(gh) { addEndHandler("node",this,&NodeHandler::endNode); addStartHandler("link",this,&NodeHandler::startLink); @@ -87,12 +97,14 @@ NodeHandler::~NodeHandler() void NodeHandler::startNode(const QXmlAttributes &attrib) { + debug(2,"startNode\n"); m_parent->setDelegate(this); m_id = attrib.value("id"); } void NodeHandler::endNode() { + debug(2,"endNode\n"); m_parent->setDelegate(0); } @@ -117,7 +129,7 @@ void NodeHandler::endLabel() void NodeHandler::startChildNode(const QXmlAttributes &attrib) { - ChildNodeHandler *cnh = new ChildNodeHandler(this); + ChildNodeHandler *cnh = new ChildNodeHandler(this,m_graph); cnh->startChildNode(attrib); m_children.append(cnh); } @@ -129,9 +141,10 @@ IChildNodeIterator *NodeHandler::children() const //------------------------------------------------------------------------ -ChildNodeHandler::ChildNodeHandler(IBaseHandler *parent) - : m_parent(parent) +ChildNodeHandler::ChildNodeHandler(IBaseHandler *parent,GraphHandler *gh) + : m_parent(parent), m_graph(gh) { + addEndHandler("childnode",this,&ChildNodeHandler::endChildNode); addStartHandler("edgelabel",this,&ChildNodeHandler::startEdgeLabel); m_edgeLabels.setAutoDelete(TRUE); } @@ -142,6 +155,7 @@ ChildNodeHandler::~ChildNodeHandler() void ChildNodeHandler::startChildNode(const QXmlAttributes &attrib) { + debug(2,"startChildNode\n"); m_id = attrib.value("id"); m_relationString = attrib.value("relation"); m_relation = s_edgeRelationMapper->stringToNodeRelation(m_relationString); @@ -150,6 +164,7 @@ void ChildNodeHandler::startChildNode(const QXmlAttributes &attrib) void ChildNodeHandler::endChildNode() { + debug(2,"endChildNode\n"); m_parent->setDelegate(0); } @@ -166,12 +181,17 @@ IEdgeLabelIterator *ChildNodeHandler::edgeLabels() const return new EdgeLabelIterator(*this); } +INode *ChildNodeHandler::node() const +{ + return m_graph->getNodeById(m_id); +} //----------------------------------------------------------------------- EdgeLabelHandler::EdgeLabelHandler(IBaseHandler *parent) : m_parent(parent) { + addEndHandler("edgelabel",this,&EdgeLabelHandler::endEdgeLabel); } EdgeLabelHandler::~EdgeLabelHandler() diff --git a/addon/doxmlparser/src/graphhandler.h b/addon/doxmlparser/src/graphhandler.h index d9e0ae4..ebcc352 100644 --- a/addon/doxmlparser/src/graphhandler.h +++ b/addon/doxmlparser/src/graphhandler.h @@ -34,6 +34,7 @@ class GraphHandler : public IGraph, public BaseHandler<GraphHandler> void startGraph(const QXmlAttributes &attrib); void endGraph(); void startNode(const QXmlAttributes &attrib); + NodeHandler *getNodeById(const QString &id) const; // IGraph virtual INodeIterator *nodes() const; @@ -41,6 +42,7 @@ class GraphHandler : public IGraph, public BaseHandler<GraphHandler> private: IBaseHandler *m_parent; QList<NodeHandler> m_nodes; + QDict<NodeHandler> *m_nodeDict; }; //---------------------------------------------------------------------- @@ -49,7 +51,7 @@ class NodeHandler : public INode, public BaseHandler<NodeHandler> { friend class ChildNodeIterator; public: - NodeHandler(IBaseHandler *parent); + NodeHandler(GraphHandler *gh); virtual ~NodeHandler(); void startNode(const QXmlAttributes &attrib); @@ -72,6 +74,7 @@ class NodeHandler : public INode, public BaseHandler<NodeHandler> QString m_label; QString m_link; QList<ChildNodeHandler> m_children; + GraphHandler *m_graph; }; class NodeIterator : public BaseIterator<INodeIterator,INode,NodeHandler> @@ -87,7 +90,7 @@ class ChildNodeHandler : public IChildNode, public BaseHandler<ChildNodeHandler> { friend class EdgeLabelIterator; public: - ChildNodeHandler(IBaseHandler *parent); + ChildNodeHandler(IBaseHandler *parent,GraphHandler *gh); virtual ~ChildNodeHandler(); void startChildNode(const QXmlAttributes &attrib); @@ -95,17 +98,18 @@ class ChildNodeHandler : public IChildNode, public BaseHandler<ChildNodeHandler> void startEdgeLabel(const QXmlAttributes &attrib); // IChildNode - virtual QString id() const { return m_id; } + virtual INode *node() const; virtual NodeRelation relation() const { return m_relation; } virtual QString relationString() const { return m_relationString; } virtual IEdgeLabelIterator *edgeLabels() const; private: - IBaseHandler *m_parent; - QString m_id; - NodeRelation m_relation; - QString m_relationString; + IBaseHandler *m_parent; + QString m_id; + NodeRelation m_relation; + QString m_relationString; QList<EdgeLabelHandler> m_edgeLabels; + GraphHandler *m_graph; }; class ChildNodeIterator : public BaseIterator<IChildNodeIterator,IChildNode,ChildNodeHandler> diff --git a/addon/doxmlparser/src/linkedtexthandler.cpp b/addon/doxmlparser/src/linkedtexthandler.cpp index 972e32e..2eb170f 100644 --- a/addon/doxmlparser/src/linkedtexthandler.cpp +++ b/addon/doxmlparser/src/linkedtexthandler.cpp @@ -16,7 +16,7 @@ #include "debug.h" #include <doxmlintf.h> -class LT_Text : public ILT_Text +class LT_Text : public LinkedTextImpl, public ILT_Text { public: LT_Text(const QString &text) : m_text(text) {} @@ -24,12 +24,12 @@ class LT_Text : public ILT_Text // ILT_Text virtual QString text() const { return m_text; } - virtual Kind kind() const { return Kind_Text; } + virtual Kind kind() const { return LinkedTextImpl::Kind_Text; } private: QString m_text; }; -class LT_Ref : public ILT_Ref +class LT_Ref : public LinkedTextImpl, public ILT_Ref { public: LT_Ref() {} @@ -44,7 +44,7 @@ class LT_Ref : public ILT_Ref virtual QString id() const { return m_refId; } virtual TargetKind targetKind() const { return m_targetKind; } virtual QString external() const { return m_extId; } - virtual Kind kind() const { return Kind_Ref; } + virtual Kind kind() const { return LinkedTextImpl::Kind_Ref; } private: QString m_refId; @@ -54,7 +54,7 @@ class LT_Ref : public ILT_Ref }; LinkedTextHandler::LinkedTextHandler(IBaseHandler *parent, - QList<ILinkedText> &children + QList<LinkedTextImpl> &children ) : m_parent(parent), m_children(children) { @@ -110,11 +110,11 @@ void LinkedTextHandler::endRef() m_ref=0; } -QString LinkedTextHandler::toString(const QList<ILinkedText> &list) +QString LinkedTextHandler::toString(const QList<LinkedTextImpl> &list) { - QListIterator<ILinkedText> li(list); + QListIterator<LinkedTextImpl> li(list); QString result; - ILinkedText *lt; + LinkedTextImpl *lt; for (li.toFirst();(lt=li.current());++li) { switch(lt->kind()) diff --git a/addon/doxmlparser/src/linkedtexthandler.h b/addon/doxmlparser/src/linkedtexthandler.h index 6055d29..c023c9f 100644 --- a/addon/doxmlparser/src/linkedtexthandler.h +++ b/addon/doxmlparser/src/linkedtexthandler.h @@ -19,29 +19,36 @@ #include "basehandler.h" class LT_Ref; - -class LinkedTextIterator : public BaseIterator<ILinkedTextIterator,ILinkedText,ILinkedText> +class LinkedTextImpl : public ILinkedText { public: - LinkedTextIterator(const QList<ILinkedText> &list) : - BaseIterator<ILinkedTextIterator,ILinkedText,ILinkedText>(list) {} + virtual ~LinkedTextImpl() {} }; class LinkedTextHandler : public BaseHandler<LinkedTextHandler> { public: - LinkedTextHandler(IBaseHandler *parent,QList<ILinkedText> &children); + LinkedTextHandler(IBaseHandler *parent,QList<LinkedTextImpl> &children); virtual ~LinkedTextHandler(); virtual void start(const char *endTag); virtual void end(); virtual void startRef(const QXmlAttributes& attrib); virtual void endRef(); - static QString toString(const QList<ILinkedText> &list); + static QString toString(const QList<LinkedTextImpl> &list); + + // ILinkedText private: IBaseHandler *m_parent; - QList<ILinkedText> &m_children; + QList<LinkedTextImpl> &m_children; LT_Ref *m_ref; }; +class LinkedTextIterator : public BaseIterator<ILinkedTextIterator,ILinkedText,LinkedTextImpl> +{ + public: + LinkedTextIterator(const QList<LinkedTextImpl> &list) : + BaseIterator<ILinkedTextIterator,ILinkedText,LinkedTextImpl>(list) {} +}; + #endif diff --git a/addon/doxmlparser/src/mainhandler.cpp b/addon/doxmlparser/src/mainhandler.cpp index aa54cda..99b1e2c 100644 --- a/addon/doxmlparser/src/mainhandler.cpp +++ b/addon/doxmlparser/src/mainhandler.cpp @@ -201,7 +201,7 @@ ICompound *MainHandler::compoundById(const QString &id) const if (ch) // compound already in memory { ch->addref(); // returning alias -> increase reference counter - return ch; + return ch->toICompound(); } CompoundEntry *ce = m_compoundDict.find(id); if (ce==0) return 0; // id not found @@ -219,7 +219,7 @@ ICompound *MainHandler::compoundById(const QString &id) const MainHandler *that = (MainHandler *)this; ch->initialize(that); that->m_compoundsLoaded.insert(id,ch); - return ch; + return ch->toICompound(); } void MainHandler::unloadCompound(CompoundHandler *ch) diff --git a/addon/doxmlparser/src/memberhandler.cpp b/addon/doxmlparser/src/memberhandler.cpp index d98035b..31b5d84 100644 --- a/addon/doxmlparser/src/memberhandler.cpp +++ b/addon/doxmlparser/src/memberhandler.cpp @@ -360,7 +360,7 @@ void MemberHandler::setCompoundHandler(CompoundHandler *c) ICompound *MemberHandler::compound() const { m_compound->addref(); - return m_compound; + return m_compound->toICompound(); } void MemberHandler::setSectionHandler(SectionHandler *c) diff --git a/addon/doxmlparser/src/memberhandler.h b/addon/doxmlparser/src/memberhandler.h index 3232a4c..2807ae0 100644 --- a/addon/doxmlparser/src/memberhandler.h +++ b/addon/doxmlparser/src/memberhandler.h @@ -175,13 +175,13 @@ class MemberHandler : public IMember, public BaseHandler<MemberHandler> QString m_id; QString m_protection; QString m_virtualness; - QList<ILinkedText> m_type; - QList<ILinkedText> m_initializer; - QList<ILinkedText> m_exception; + QList<LinkedTextImpl> m_type; + QList<LinkedTextImpl> m_initializer; + QList<LinkedTextImpl> m_exception; QString m_name; DocHandler *m_brief; DocHandler *m_detailed; - QList<IParam> m_params; + QList<ParamHandler> m_params; QList<MemberReference> m_references; QList<MemberReference> m_referencedBy; MemberReference *m_reimplements; diff --git a/addon/doxmlparser/src/paramhandler.h b/addon/doxmlparser/src/paramhandler.h index ae02e96..520034a 100644 --- a/addon/doxmlparser/src/paramhandler.h +++ b/addon/doxmlparser/src/paramhandler.h @@ -25,13 +25,6 @@ #include "baseiterator.h" #include "linkedtexthandler.h" -class ParamIterator : public BaseIterator<IParamIterator,IParam,IParam> -{ - public: - ParamIterator(const QList<IParam> &list) : - BaseIterator<IParamIterator,IParam,IParam>(list) {} -}; - class ParamHandler : public IParam, public BaseHandler<ParamHandler> { public: @@ -59,13 +52,21 @@ class ParamHandler : public IParam, public BaseHandler<ParamHandler> private: IBaseHandler *m_parent; - QList<ILinkedText> m_type; + QList<LinkedTextImpl> m_type; QString m_declName; QString m_defName; QString m_attrib; QString m_array; - QList<ILinkedText> m_defVal; + QList<LinkedTextImpl> m_defVal; LinkedTextHandler *m_linkedTextHandler; }; +class ParamIterator : public BaseIterator<IParamIterator,IParam,ParamHandler> +{ + public: + ParamIterator(const QList<ParamHandler> &list) : + BaseIterator<IParamIterator,IParam,ParamHandler>(list) {} +}; + + #endif diff --git a/addon/doxmlparser/src/sectionhandler.h b/addon/doxmlparser/src/sectionhandler.h index 1f4b03a..71a5973 100644 --- a/addon/doxmlparser/src/sectionhandler.h +++ b/addon/doxmlparser/src/sectionhandler.h @@ -26,13 +26,12 @@ class MainHandler; - class SectionIterator : - public BaseIterator<ISectionIterator,ISection,ISection> + public BaseIterator<ISectionIterator,ISection,SectionHandler> { public: - SectionIterator(const QList<ISection> &list) : - BaseIterator<ISectionIterator,ISection,ISection>(list) {} + SectionIterator(const QList<SectionHandler> &list) : + BaseIterator<ISectionIterator,ISection,SectionHandler>(list) {} }; diff --git a/addon/doxmlparser/test/main.cpp b/addon/doxmlparser/test/main.cpp index 9c97db9..457d881 100644 --- a/addon/doxmlparser/test/main.cpp +++ b/addon/doxmlparser/test/main.cpp @@ -140,6 +140,10 @@ void DumpDoc(IDoc *doc) { IDocSimpleSect *ss = dynamic_cast<IDocSimpleSect*>(doc); ASSERT(ss!=0); + printf(" --- simplesect type=%s --- \n",ss->typeString().data()); + DumpDoc(ss->title()); + DumpDoc(ss->description()); + printf(" --- end simplesect --- \n"); } break; case IDoc::Title: @@ -158,8 +162,12 @@ void DumpDoc(IDoc *doc) break; case IDoc::Ref: { - IDocRef *ref = dynamic_cast<IDocRef*>(ref); + IDocRef *ref = dynamic_cast<IDocRef*>(doc); ASSERT(ref!=0); + printf(" ref=%p\n",ref); + printf(" --- ref id=%s text=%s --- \n", + ref->refId().data(),ref->text().data()); + printf(" --- end ref --- \n"); } break; case IDoc::VariableList: @@ -312,6 +320,43 @@ void DumpDoc(IDoc *doc) } } +void DumpGraph(IGraph *graph) +{ + if (graph==0) { printf(" --- no graph ---\n"); return; } + printf(" --- graph ----\n"); + INodeIterator *ni = graph->nodes(); + INode *node; + for (ni->toFirst();(node=ni->current());ni->toNext()) + { + printf(" --- node id=%s label=%s linkId=%s\n", + node->id().data(), + node->label().data(), + node->linkId().data() + ); + IChildNodeIterator *cni = node->children(); + IChildNode *cn; + for (cni->toFirst();(cn=cni->current());cni->toNext()) + { + printf(" + child id=%s label=%s relation=%s\n", + cn->node()->id().data(), + cn->node()->label().data(), + cn->relationString().data() + ); + IEdgeLabelIterator *eli = cn->edgeLabels(); + IEdgeLabel *el; + for (eli->toFirst();(el=eli->current());eli->toNext()) + { + printf(" edgeLabel=%s\n",el->label().data()); + } + eli->release(); + } + cni->release(); + } + ni->release(); + printf(" --- end graph ----\n"); + +} + int main(int argc,char **argv) { if (argc!=2) @@ -322,6 +367,8 @@ int main(int argc,char **argv) IDoxygen *dox = createObjectModel(); + dox->setDebugLevel(0); + if (!dox->readXMLDir(argv[1])) { printf("Error reading %s/index.xml\n",argv[1]); @@ -422,6 +469,41 @@ int main(int argc,char **argv) printf("===== detailed description ==== \n"); DumpDoc(doc); } + + if (comp->kind()==ICompound::Class) + { + IClass *cls = dynamic_cast<IClass*>(comp); + ASSERT(cls!=0); + + printf("==== inheritance graph ==== \n"); + DumpGraph(cls->inheritanceGraph()); + + printf("==== collabration graph ==== \n"); + DumpGraph(cls->collaborationGraph()); + + printf("==== base classes ==== \n"); + IRelatedCompoundIterator *bcli = cls->baseClasses(); + IRelatedCompound *bClass; + for (bcli->toFirst();(bClass=bcli->current());bcli->toNext()) + { + ICompound *bc = bClass->compound(); + printf(" + class %s\n",bc->name().data()); + bc->release(); + } + bcli->release(); + + printf("==== derived classes ==== \n"); + IRelatedCompoundIterator *dcli = cls->derivedClasses(); + IRelatedCompound *dClass; + for (dcli->toFirst();(dClass=dcli->current());dcli->toNext()) + { + ICompound *dc = dClass->compound(); + printf(" + class %s\n",dc->name().data()); + dc->release(); + } + dcli->release(); + } + comp->release(); } cli->release(); |