diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2002-05-12 17:38:45 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2002-05-12 17:38:45 (GMT) |
commit | bcf2f33d5be8c6de4de5bb7cbe8ea8b90f19cf88 (patch) | |
tree | 2f87712e9d2e8da7138ca908bf03c9937ba71bdb /addon/doxmlparser | |
parent | 758291b1be0c43c13088389b0cfbb560efe00c1f (diff) | |
download | Doxygen-bcf2f33d5be8c6de4de5bb7cbe8ea8b90f19cf88.zip Doxygen-bcf2f33d5be8c6de4de5bb7cbe8ea8b90f19cf88.tar.gz Doxygen-bcf2f33d5be8c6de4de5bb7cbe8ea8b90f19cf88.tar.bz2 |
Release-1.2.15-20020512
Diffstat (limited to 'addon/doxmlparser')
-rw-r--r-- | addon/doxmlparser/include/doxmlintf.h | 160 | ||||
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.cpp | 58 | ||||
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.h | 17 | ||||
-rw-r--r-- | addon/doxmlparser/src/doxmlintf.h | 160 | ||||
-rw-r--r-- | addon/doxmlparser/src/memberhandler.cpp | 25 | ||||
-rw-r--r-- | addon/doxmlparser/src/memberhandler.h | 9 | ||||
-rw-r--r-- | addon/doxmlparser/test/main.cpp | 48 |
7 files changed, 411 insertions, 66 deletions
diff --git a/addon/doxmlparser/include/doxmlintf.h b/addon/doxmlparser/include/doxmlintf.h index 5c051dd..d0d3c2a 100644 --- a/addon/doxmlparser/include/doxmlintf.h +++ b/addon/doxmlparser/include/doxmlintf.h @@ -1,3 +1,18 @@ +/****************************************************************************** + * + * $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 _DOXMLINTF_H #define _DOXMLINTF_H @@ -480,7 +495,8 @@ class IMember virtual const IString * name() const = 0; virtual bool isConst() const = 0; virtual bool isVolatile() const = 0; - virtual IParamIterator *params() const = 0; + virtual IParamIterator *parameters() const = 0; + virtual IParamIterator *templateParameters() const = 0; virtual ILinkedTextIterator *initializer() const = 0; virtual ILinkedTextIterator *exceptions() const = 0; virtual IMemberReferenceIterator *references() const = 0; @@ -507,27 +523,79 @@ class IMemberIterator virtual void release() = 0; }; +/*! \brief The interface to a section in the object model. + * + * A compound can have a number of sections, where each + * section contains a set of members with the properties implied by + * the section kind. The kind() method returns the kind of the section. + * The members of the section can be accessed via members(). Apart + * from using kind(), some of the individual properties of the section can + * also be inspected via isStatic(), isPublic(), isProtected() and + * isPrivate(). + */ class ISection { public: - enum SectionKind { Invalid=0, - UserDefined, - PubTypes, PubFuncs, PubAttribs, PubSlots, - Signals, DCOPFuncs, Properties, - PubStatFuncs, PubStatAttribs, - ProTypes, ProFuncs, ProAttribs, ProSlots, - ProStatFuncs, ProStatAttribs, - PriTypes, PriFuncs, PriAttribs, PriSlots, - PriStatFuncs, PriStatAttribs, - Friend, Related, Defines, Prototypes, Typedefs, - Enums, Functions, Variables - }; + /*! Possible section types */ + enum SectionKind + { Invalid=0, + UserDefined, //!< A user defined member group + PubTypes, //!< Public member typedefs + PubFuncs, //!< Public member functions + PubAttribs, //!< Public member attributes + PubSlots, //!< Public Qt Slots + Signals, //!< Qt Signals + DCOPFuncs, //!< KDE-DCOP interface functions + Properties, //!< IDL properties + PubStatFuncs, //!< Public static member functions + PubStatAttribs, //!< Public static attributes + ProTypes, //!< Protected member typedefs + ProFuncs, //!< Protected member functions + ProAttribs, //!< Protected member attributes + ProSlots, //!< Protected slots + ProStatFuncs, //!< Protected static member functions + ProStatAttribs, //!< Protected static member attributes + PriTypes, //!< Private member typedefs + PriFuncs, //!< Private member functions + PriAttribs, //!< Private member attributes + PriSlots, //!< Private Qt slots + PriStatFuncs, //!< Private static member functions + PriStatAttribs, //!< Private static member attributes + Friend, //!< Friends + Related, //!< Function marked as related + Defines, //!< Preprocessor defines + Prototypes, //!< Global function prototypes + Typedefs, //!< Global typedefs + Enums, //!< Enumerations + Functions, //!< Global functions + Variables //!< Global variables + }; + + /*! Returns a string representation of the value returned by kind() */ virtual const IString * kindString() const = 0; + + /*! Returns what kind of section this is */ virtual SectionKind kind() const = 0; + + /*! Returns an iterator for the members of this section */ virtual IMemberIterator *members() const = 0; + + /*! Returns \c true if this section contains statics */ virtual bool isStatic() const = 0; + + /*! Returns \c true if this section belongs to a + * public section of a class + */ virtual bool isPublic() const = 0; + + /*! Returns \c true if this section belongs to a + * private section of a class + */ virtual bool isPrivate() const = 0; + + /*! Returns \c true if this section belongs to a + * protected section of a class + * */ virtual bool isProtected() const = 0; }; @@ -542,6 +610,31 @@ class ISectionIterator virtual void release() = 0; }; +/*! \brief The interface to a compound in the object model. + * + * A compound has a name which can be obtained via the name() method + * and a unique id, which is return via the id() method. + * A compound consists zero or more members which are grouped into sections. + * The sections() method can be used to access the individual sections. + * Alternatively, members can be obtained by name or id. There are + * different types of compounds. The kind() method returns what kind of + * compound this is. Depending on the return value one can dynamically + * cast an interface pointer to an more specialised interface that provides + * additional methods. + * Example: + * \code + * ICompound *comp=...; + * if (comp->kind()==ICompound::Class) + * { + * IClass *cls = dynamic_cast<IClass*>(comp); + * // use methods of IClass + * } + * \endcode + * The documentation that is provided by a compound is available via + * the briefDescription() and detailedDescription() methods. + * To avoid excessive memory usage, release() should be called (once) on each + * compound interface pointer that is no longer needed. + */ class ICompound { public: @@ -634,14 +727,16 @@ class IRelatedCompoundIterator virtual void release() = 0; }; +/*! \brief The interface to a class in the object model. + */ 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; + virtual IRelatedCompoundIterator *baseCompounds() const = 0; + virtual IRelatedCompoundIterator *derivedCompounds() const = 0; + virtual ICompoundIterator *nestedCompounds() const = 0; // TODO: // class: @@ -653,35 +748,56 @@ class IClass : public ICompound // locationBodyEndLine() }; +/*! \brief The interface to a struct in the object model. + */ class IStruct : public ICompound { + public: + virtual ICompoundIterator *nestedCompounds() const = 0; + virtual IRelatedCompoundIterator *baseCompounds() const = 0; + virtual IRelatedCompoundIterator *derivedCompounds() const = 0; }; +/*! \brief The interface to a union in the object model. + */ class IUnion : public ICompound { + public: + virtual ICompoundIterator *nestedCompounds() const = 0; }; +/*! \brief The interface to a Java/IDL interface in the object model. + */ class IInterface : public ICompound { + public: + virtual IRelatedCompoundIterator *baseCompounds() const = 0; + virtual IRelatedCompoundIterator *derivedCompounds() const = 0; }; +/*! \brief The interface to a Java/IDL exception in the object model. + */ class IException : public ICompound { }; +/*! \brief The interface to a namespace in the object model. + */ class INamespace : public ICompound { - // namespace: - // ICompound *innerNamespaces() - // ICompoundIterator *innerClasses() + public: + virtual ICompoundIterator *nestedCompounds() const = 0; }; +/*! \brief The interface to a file in the object model. + */ class IFile : public ICompound { public: virtual IGraph *includeDependencyGraph() const = 0; virtual IGraph *includedByDependencyGraph() const = 0; virtual IDocProgramListing *source() const = 0; + virtual ICompoundIterator *nestedCompounds() const = 0; // file: // includes() @@ -690,14 +806,20 @@ class IFile : public ICompound // ICompoundIterator *innerClasses() }; +/*! \brief The interface to a group in the object model. + */ class IGroup : public ICompound { + public: + virtual ICompoundIterator *nestedCompounds() const = 0; // group: // Title() // innerFile() // innerPage() }; +/*! \brief The interface to a page in the object model. + */ class IPage : public ICompound { }; diff --git a/addon/doxmlparser/src/compoundhandler.cpp b/addon/doxmlparser/src/compoundhandler.cpp index b6c6235..62275ce 100644 --- a/addon/doxmlparser/src/compoundhandler.cpp +++ b/addon/doxmlparser/src/compoundhandler.cpp @@ -145,13 +145,15 @@ CompoundHandler::CompoundHandler(const QString &xmlDir) : m_brief(0), m_detailed(0), m_programListing(0), m_xmlDir(xmlDir), m_refCount(1), m_memberDict(257), m_memberNameDict(257), m_mainHandler(0), m_inheritanceGraph(0), m_collaborationGraph(0), - m_includeDependencyGraph(0), m_includedByDependencyGraph(0) + m_includeDependencyGraph(0), m_includedByDependencyGraph(0), + m_hasTemplateParams(FALSE) { m_superClasses.setAutoDelete(TRUE); m_subClasses.setAutoDelete(TRUE); m_sections.setAutoDelete(TRUE); m_memberNameDict.setAutoDelete(TRUE); - m_innerClasses.setAutoDelete(TRUE); + m_innerCompounds.setAutoDelete(TRUE); + m_templateParams.setAutoDelete(TRUE); addStartHandler("doxygen"); addEndHandler("doxygen"); @@ -190,6 +192,20 @@ CompoundHandler::CompoundHandler(const QString &xmlDir) addStartHandler("innerclass",this,&CompoundHandler::startInnerClass); addEndHandler("innerclass"); + addStartHandler("innernamespace",this,&CompoundHandler::startInnerNamespace); + addEndHandler("innernamespace"); + + addStartHandler("innerfile",this,&CompoundHandler::startInnerFile); + addEndHandler("innerfile"); + + addStartHandler("innergroup",this,&CompoundHandler::startInnerGroup); + addEndHandler("innergroup"); + + addStartHandler("templateparamlist"); + addEndHandler("templateparamlist"); + + addStartHandler("param",this,&CompoundHandler::startParam); + addEndHandler("param"); } CompoundHandler::~CompoundHandler() @@ -259,7 +275,30 @@ void CompoundHandler::endCompoundName() void CompoundHandler::startInnerClass(const QXmlAttributes& attrib) { - m_innerClasses.append(new QString(attrib.value("refid"))); + m_innerCompounds.append(new QString(attrib.value("refid"))); +} + +void CompoundHandler::startInnerNamespace(const QXmlAttributes& attrib) +{ + m_innerCompounds.append(new QString(attrib.value("refid"))); +} + +void CompoundHandler::startInnerFile(const QXmlAttributes& attrib) +{ + m_innerCompounds.append(new QString(attrib.value("refid"))); +} + +void CompoundHandler::startInnerGroup(const QXmlAttributes& attrib) +{ + m_innerCompounds.append(new QString(attrib.value("refid"))); +} + +void CompoundHandler::startParam(const QXmlAttributes& attrib) +{ + m_hasTemplateParams = TRUE; + ParamHandler *ph = new ParamHandler(this); + ph->startParam(attrib); + m_templateParams.append(ph); } void CompoundHandler::addSuperClass(const QXmlAttributes& attrib) @@ -445,19 +484,19 @@ IGraph *CompoundHandler::includedByDependencyGraph() const return m_includedByDependencyGraph; } -IRelatedCompoundIterator *CompoundHandler::baseClasses() const +IRelatedCompoundIterator *CompoundHandler::baseCompounds() const { return new RelatedCompoundIterator(m_superClasses); } -IRelatedCompoundIterator *CompoundHandler::derivedClasses() const +IRelatedCompoundIterator *CompoundHandler::derivedCompounds() const { return new RelatedCompoundIterator(m_subClasses); } -ICompoundIterator *CompoundHandler::nestedClasses() const +ICompoundIterator *CompoundHandler::nestedCompounds() const { - return new CompoundIdIterator(m_mainHandler,m_innerClasses); + return new CompoundIdIterator(m_mainHandler,m_innerCompounds); } IDocProgramListing *CompoundHandler::source() const @@ -465,3 +504,8 @@ IDocProgramListing *CompoundHandler::source() const return m_programListing; } +IParamIterator *CompoundHandler::templateParameters() const +{ + return m_hasTemplateParams ? new ParamIterator(m_templateParams) : 0; +} + diff --git a/addon/doxmlparser/src/compoundhandler.h b/addon/doxmlparser/src/compoundhandler.h index bc725e3..ae567b6 100644 --- a/addon/doxmlparser/src/compoundhandler.h +++ b/addon/doxmlparser/src/compoundhandler.h @@ -31,6 +31,7 @@ class GraphHandler; class MemberHandler; class CompoundHandler; class SectionHandler; +class ParamHandler; class RelatedCompound : public IRelatedCompound @@ -92,6 +93,10 @@ class CompoundHandler : public IClass, virtual void startIncludeDependencyGraph(const QXmlAttributes& attrib); virtual void startIncludedByDependencyGraph(const QXmlAttributes& attrib); virtual void startInnerClass(const QXmlAttributes& attrib); + virtual void startInnerNamespace(const QXmlAttributes& attrib); + virtual void startInnerFile(const QXmlAttributes& attrib); + virtual void startInnerGroup(const QXmlAttributes& attrib); + virtual void startParam(const QXmlAttributes& attrib); virtual void addref() { m_refCount++; } CompoundHandler(const QString &dirName); @@ -111,14 +116,16 @@ class CompoundHandler : public IClass, IDocRoot *detailedDescription() const; IMember *memberById(const char *id) const; IMemberIterator *memberByName(const char *name) const; + IParamIterator *templateParameters() const; void release(); // IClass implementation IGraph *inheritanceGraph() const; IGraph *collaborationGraph() const; - IRelatedCompoundIterator *baseClasses() const; - IRelatedCompoundIterator *derivedClasses() const; - ICompoundIterator *nestedClasses() const; + IRelatedCompoundIterator *baseCompounds() const; + IRelatedCompoundIterator *derivedCompounds() const; + ICompoundIterator *nestedCompounds() const; + ICompoundIterator *nestedGroup() const; // IFile implementation IGraph *includeDependencyGraph() const; @@ -129,6 +136,7 @@ class CompoundHandler : public IClass, QList<RelatedCompound> m_superClasses; QList<RelatedCompound> m_subClasses; QList<SectionHandler> m_sections; + QList<ParamHandler> m_templateParams; DocHandler *m_brief; DocHandler *m_detailed; ProgramListingHandler *m_programListing; @@ -147,8 +155,9 @@ class CompoundHandler : public IClass, GraphHandler *m_collaborationGraph; GraphHandler *m_includeDependencyGraph; GraphHandler *m_includedByDependencyGraph; - QList<QString> m_innerClasses; + QList<QString> m_innerCompounds; ProgramListingHandler *m_source; + bool m_hasTemplateParams; }; diff --git a/addon/doxmlparser/src/doxmlintf.h b/addon/doxmlparser/src/doxmlintf.h index 5c051dd..d0d3c2a 100644 --- a/addon/doxmlparser/src/doxmlintf.h +++ b/addon/doxmlparser/src/doxmlintf.h @@ -1,3 +1,18 @@ +/****************************************************************************** + * + * $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 _DOXMLINTF_H #define _DOXMLINTF_H @@ -480,7 +495,8 @@ class IMember virtual const IString * name() const = 0; virtual bool isConst() const = 0; virtual bool isVolatile() const = 0; - virtual IParamIterator *params() const = 0; + virtual IParamIterator *parameters() const = 0; + virtual IParamIterator *templateParameters() const = 0; virtual ILinkedTextIterator *initializer() const = 0; virtual ILinkedTextIterator *exceptions() const = 0; virtual IMemberReferenceIterator *references() const = 0; @@ -507,27 +523,79 @@ class IMemberIterator virtual void release() = 0; }; +/*! \brief The interface to a section in the object model. + * + * A compound can have a number of sections, where each + * section contains a set of members with the properties implied by + * the section kind. The kind() method returns the kind of the section. + * The members of the section can be accessed via members(). Apart + * from using kind(), some of the individual properties of the section can + * also be inspected via isStatic(), isPublic(), isProtected() and + * isPrivate(). + */ class ISection { public: - enum SectionKind { Invalid=0, - UserDefined, - PubTypes, PubFuncs, PubAttribs, PubSlots, - Signals, DCOPFuncs, Properties, - PubStatFuncs, PubStatAttribs, - ProTypes, ProFuncs, ProAttribs, ProSlots, - ProStatFuncs, ProStatAttribs, - PriTypes, PriFuncs, PriAttribs, PriSlots, - PriStatFuncs, PriStatAttribs, - Friend, Related, Defines, Prototypes, Typedefs, - Enums, Functions, Variables - }; + /*! Possible section types */ + enum SectionKind + { Invalid=0, + UserDefined, //!< A user defined member group + PubTypes, //!< Public member typedefs + PubFuncs, //!< Public member functions + PubAttribs, //!< Public member attributes + PubSlots, //!< Public Qt Slots + Signals, //!< Qt Signals + DCOPFuncs, //!< KDE-DCOP interface functions + Properties, //!< IDL properties + PubStatFuncs, //!< Public static member functions + PubStatAttribs, //!< Public static attributes + ProTypes, //!< Protected member typedefs + ProFuncs, //!< Protected member functions + ProAttribs, //!< Protected member attributes + ProSlots, //!< Protected slots + ProStatFuncs, //!< Protected static member functions + ProStatAttribs, //!< Protected static member attributes + PriTypes, //!< Private member typedefs + PriFuncs, //!< Private member functions + PriAttribs, //!< Private member attributes + PriSlots, //!< Private Qt slots + PriStatFuncs, //!< Private static member functions + PriStatAttribs, //!< Private static member attributes + Friend, //!< Friends + Related, //!< Function marked as related + Defines, //!< Preprocessor defines + Prototypes, //!< Global function prototypes + Typedefs, //!< Global typedefs + Enums, //!< Enumerations + Functions, //!< Global functions + Variables //!< Global variables + }; + + /*! Returns a string representation of the value returned by kind() */ virtual const IString * kindString() const = 0; + + /*! Returns what kind of section this is */ virtual SectionKind kind() const = 0; + + /*! Returns an iterator for the members of this section */ virtual IMemberIterator *members() const = 0; + + /*! Returns \c true if this section contains statics */ virtual bool isStatic() const = 0; + + /*! Returns \c true if this section belongs to a + * public section of a class + */ virtual bool isPublic() const = 0; + + /*! Returns \c true if this section belongs to a + * private section of a class + */ virtual bool isPrivate() const = 0; + + /*! Returns \c true if this section belongs to a + * protected section of a class + * */ virtual bool isProtected() const = 0; }; @@ -542,6 +610,31 @@ class ISectionIterator virtual void release() = 0; }; +/*! \brief The interface to a compound in the object model. + * + * A compound has a name which can be obtained via the name() method + * and a unique id, which is return via the id() method. + * A compound consists zero or more members which are grouped into sections. + * The sections() method can be used to access the individual sections. + * Alternatively, members can be obtained by name or id. There are + * different types of compounds. The kind() method returns what kind of + * compound this is. Depending on the return value one can dynamically + * cast an interface pointer to an more specialised interface that provides + * additional methods. + * Example: + * \code + * ICompound *comp=...; + * if (comp->kind()==ICompound::Class) + * { + * IClass *cls = dynamic_cast<IClass*>(comp); + * // use methods of IClass + * } + * \endcode + * The documentation that is provided by a compound is available via + * the briefDescription() and detailedDescription() methods. + * To avoid excessive memory usage, release() should be called (once) on each + * compound interface pointer that is no longer needed. + */ class ICompound { public: @@ -634,14 +727,16 @@ class IRelatedCompoundIterator virtual void release() = 0; }; +/*! \brief The interface to a class in the object model. + */ 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; + virtual IRelatedCompoundIterator *baseCompounds() const = 0; + virtual IRelatedCompoundIterator *derivedCompounds() const = 0; + virtual ICompoundIterator *nestedCompounds() const = 0; // TODO: // class: @@ -653,35 +748,56 @@ class IClass : public ICompound // locationBodyEndLine() }; +/*! \brief The interface to a struct in the object model. + */ class IStruct : public ICompound { + public: + virtual ICompoundIterator *nestedCompounds() const = 0; + virtual IRelatedCompoundIterator *baseCompounds() const = 0; + virtual IRelatedCompoundIterator *derivedCompounds() const = 0; }; +/*! \brief The interface to a union in the object model. + */ class IUnion : public ICompound { + public: + virtual ICompoundIterator *nestedCompounds() const = 0; }; +/*! \brief The interface to a Java/IDL interface in the object model. + */ class IInterface : public ICompound { + public: + virtual IRelatedCompoundIterator *baseCompounds() const = 0; + virtual IRelatedCompoundIterator *derivedCompounds() const = 0; }; +/*! \brief The interface to a Java/IDL exception in the object model. + */ class IException : public ICompound { }; +/*! \brief The interface to a namespace in the object model. + */ class INamespace : public ICompound { - // namespace: - // ICompound *innerNamespaces() - // ICompoundIterator *innerClasses() + public: + virtual ICompoundIterator *nestedCompounds() const = 0; }; +/*! \brief The interface to a file in the object model. + */ class IFile : public ICompound { public: virtual IGraph *includeDependencyGraph() const = 0; virtual IGraph *includedByDependencyGraph() const = 0; virtual IDocProgramListing *source() const = 0; + virtual ICompoundIterator *nestedCompounds() const = 0; // file: // includes() @@ -690,14 +806,20 @@ class IFile : public ICompound // ICompoundIterator *innerClasses() }; +/*! \brief The interface to a group in the object model. + */ class IGroup : public ICompound { + public: + virtual ICompoundIterator *nestedCompounds() const = 0; // group: // Title() // innerFile() // innerPage() }; +/*! \brief The interface to a page in the object model. + */ class IPage : public ICompound { }; diff --git a/addon/doxmlparser/src/memberhandler.cpp b/addon/doxmlparser/src/memberhandler.cpp index 31b5d84..018dfbd 100644 --- a/addon/doxmlparser/src/memberhandler.cpp +++ b/addon/doxmlparser/src/memberhandler.cpp @@ -159,6 +159,9 @@ MemberHandler::MemberHandler(IBaseHandler *parent) addStartHandler("location",this,&MemberHandler::startLocation); addEndHandler("location"); + addStartHandler("templateparamlist",this,&MemberHandler::startTemplateParamList); + addEndHandler("templateparamlist",this,&MemberHandler::endTemplateParamList); + m_type.setAutoDelete(TRUE); m_initializer.setAutoDelete(TRUE); m_exception.setAutoDelete(TRUE); @@ -172,6 +175,8 @@ MemberHandler::MemberHandler(IBaseHandler *parent) m_defLine=0; m_bodyStart=0; m_bodyEnd=0; + m_insideTemplateParamList=FALSE; + m_hasTemplateParamList=FALSE; } MemberHandler::~MemberHandler() @@ -313,7 +318,14 @@ void MemberHandler::startParam(const QXmlAttributes& attrib) { ParamHandler *paramHandler = new ParamHandler(this); paramHandler->startParam(attrib); - m_params.append(paramHandler); + if (m_insideTemplateParamList) + { + m_templateParams.append(paramHandler); + } + else + { + m_params.append(paramHandler); + } } void MemberHandler::startEnumValue(const QXmlAttributes& attrib) @@ -323,6 +335,17 @@ void MemberHandler::startEnumValue(const QXmlAttributes& attrib) m_enumValues.append(evh); } +void MemberHandler::startTemplateParamList(const QXmlAttributes&) +{ + m_insideTemplateParamList = TRUE; + m_hasTemplateParamList = TRUE; +} + +void MemberHandler::endTemplateParamList() +{ + m_insideTemplateParamList = FALSE; +} + void MemberHandler::initialize(MainHandler *mh) { { diff --git a/addon/doxmlparser/src/memberhandler.h b/addon/doxmlparser/src/memberhandler.h index f95fa58..abbe27c 100644 --- a/addon/doxmlparser/src/memberhandler.h +++ b/addon/doxmlparser/src/memberhandler.h @@ -106,6 +106,8 @@ class MemberHandler : public IMember, public BaseHandler<MemberHandler> virtual void startInitializer(const QXmlAttributes& attrib); virtual void startException(const QXmlAttributes& attrib); virtual void startEnumValue(const QXmlAttributes& attrib); + virtual void startTemplateParamList(const QXmlAttributes &attrib); + virtual void endTemplateParamList(); MemberHandler(IBaseHandler *parent); virtual ~MemberHandler(); @@ -136,8 +138,10 @@ class MemberHandler : public IMember, public BaseHandler<MemberHandler> that->m_typeString = LinkedTextHandler::toString(m_type); return &m_typeString; } - virtual IParamIterator *params() const + virtual IParamIterator *parameters() const { return new ParamIterator(m_params); } + virtual IParamIterator *templateParameters() const + { return m_hasTemplateParamList ? new ParamIterator(m_templateParams) : 0; } virtual IMemberReferenceIterator *references() const { return new MemberReferenceIterator(m_references); } virtual IMemberReferenceIterator *referencedBy() const @@ -186,6 +190,7 @@ class MemberHandler : public IMember, public BaseHandler<MemberHandler> DocHandler *m_brief; DocHandler *m_detailed; QList<ParamHandler> m_params; + QList<ParamHandler> m_templateParams; QList<MemberReference> m_references; QList<MemberReference> m_referencedBy; MemberReference *m_reimplements; @@ -198,6 +203,8 @@ class MemberHandler : public IMember, public BaseHandler<MemberHandler> bool m_isVolatile; LinkedTextHandler *m_linkedTextHandler; QList<EnumValueHandler> m_enumValues; + bool m_insideTemplateParamList; + bool m_hasTemplateParamList; }; class MemberIterator : public BaseIterator<IMemberIterator,IMember,MemberHandler> diff --git a/addon/doxmlparser/test/main.cpp b/addon/doxmlparser/test/main.cpp index 31beab8..47854b2 100644 --- a/addon/doxmlparser/test/main.cpp +++ b/addon/doxmlparser/test/main.cpp @@ -432,6 +432,27 @@ void DumpGraph(IGraph *graph) } +void DumpParamList(IParamIterator *pli,int indent) +{ + QString indentStr; + indentStr.fill(' ',indent); + IParam *par; + for (pli->toFirst();(par=pli->current());pli->toNext()) + { + ILinkedTextIterator *lti = par->type(); + QString parType = linkedTextToString(lti); + lti->release(); + lti = par->defaultValue(); + QString defVal = linkedTextToString(lti); + lti->release(); + printf("%sParam type=%s decl_name=%s def_name=%s defvalue=%s\n", + indentStr.data(), parType.latin1(), + par->declarationName()->latin1(), + par->definitionName()->latin1(), + defVal.latin1()); + } +} + int main(int argc,char **argv) { if (argc!=2) @@ -471,19 +492,8 @@ int main(int argc,char **argv) linkedTextToString(lti).latin1(),mem->name()->latin1()); lti->release(); - IParamIterator *pli = mem->params(); - IParam *par; - for (pli->toFirst();(par=pli->current());pli->toNext()) - { - lti = par->type(); - QString parType = linkedTextToString(lti); - lti->release(); - lti = par->defaultValue(); - QString defVal = linkedTextToString(lti); - lti->release(); - printf(" Param type=%s name=%s defvalue=%s\n", - parType.latin1(), par->definitionName()->latin1(),defVal.latin1()); - } + IParamIterator *pli = mem->parameters(); + DumpParamList(pli,6); pli->release(); IMemberReferenceIterator *mri = mem->references(); IMemberReference *mr; @@ -513,6 +523,14 @@ int main(int argc,char **argv) } evi->release(); + pli = mem->templateParameters(); + if (pli) + { + printf(" Template parameters\n"); + DumpParamList(pli,8); + pli->release(); + } + IDoc *doc = mem->briefDescription(); if (doc) { @@ -557,7 +575,7 @@ int main(int argc,char **argv) DumpGraph(cls->collaborationGraph()); printf("==== base classes ==== \n"); - IRelatedCompoundIterator *bcli = cls->baseClasses(); + IRelatedCompoundIterator *bcli = cls->baseCompounds(); IRelatedCompound *bClass; for (bcli->toFirst();(bClass=bcli->current());bcli->toNext()) { @@ -568,7 +586,7 @@ int main(int argc,char **argv) bcli->release(); printf("==== derived classes ==== \n"); - IRelatedCompoundIterator *dcli = cls->derivedClasses(); + IRelatedCompoundIterator *dcli = cls->derivedCompounds(); IRelatedCompound *dClass; for (dcli->toFirst();(dClass=dcli->current());dcli->toNext()) { |