diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2004-09-28 18:26:46 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2004-09-28 18:26:46 (GMT) |
commit | b7473cd86e57053b866a719f160cd4d01e92f092 (patch) | |
tree | 01f67df4c4005875230919c5f826290b6a17a2e4 /addon/doxmlparser | |
parent | a3133b16473d093f9c525cbf9d21fabbae7ae1ac (diff) | |
download | Doxygen-b7473cd86e57053b866a719f160cd4d01e92f092.zip Doxygen-b7473cd86e57053b866a719f160cd4d01e92f092.tar.gz Doxygen-b7473cd86e57053b866a719f160cd4d01e92f092.tar.bz2 |
Release-1.3.8-20040928
Diffstat (limited to 'addon/doxmlparser')
-rw-r--r-- | addon/doxmlparser/include/doxmlintf.h | 70 | ||||
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.cpp | 81 | ||||
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.h | 40 | ||||
-rw-r--r-- | addon/doxmlparser/src/dochandler.cpp | 76 | ||||
-rw-r--r-- | addon/doxmlparser/src/dochandler.h | 53 | ||||
-rw-r--r-- | addon/doxmlparser/src/doxmlintf.h | 70 | ||||
-rw-r--r-- | addon/doxmlparser/src/mainhandler.cpp | 9 | ||||
-rw-r--r-- | addon/doxmlparser/src/memberhandler.cpp | 97 | ||||
-rw-r--r-- | addon/doxmlparser/src/memberhandler.h | 41 | ||||
-rw-r--r-- | addon/doxmlparser/src/paramhandler.cpp | 19 | ||||
-rw-r--r-- | addon/doxmlparser/src/paramhandler.h | 4 | ||||
-rw-r--r-- | addon/doxmlparser/test/main.cpp | 21 |
12 files changed, 490 insertions, 91 deletions
diff --git a/addon/doxmlparser/include/doxmlintf.h b/addon/doxmlparser/include/doxmlintf.h index 7296b6e..cd6beba 100644 --- a/addon/doxmlparser/include/doxmlintf.h +++ b/addon/doxmlparser/include/doxmlintf.h @@ -33,6 +33,7 @@ class ICompound; class ISection; class INode; class IDocInternal; +class IDocRoot; /*! \brief Read only interface to a string. */ @@ -51,6 +52,11 @@ class IString virtual int length() const = 0; }; +/*! \brief Base interface for hyperlinked text + * + * Depending on the result of kind() the interface is extended by + * ILT_Text or ILT_Ref. + */ class ILinkedText { public: @@ -58,12 +64,16 @@ class ILinkedText virtual Kind kind() const = 0; }; +/*! \brief Plain text fragment. + */ class ILT_Text : public ILinkedText { public: virtual const IString *text() const = 0; }; +/*! \brief Reference to an object. + */ class ILT_Ref : public ILinkedText { public: @@ -74,6 +84,8 @@ class ILT_Ref : public ILinkedText virtual const IString *text() const = 0; }; +/*! \brief Iterates over a list of ILinkedText fragments. + */ class ILinkedTextIterator { public: @@ -85,6 +97,7 @@ class ILinkedTextIterator virtual void release() = 0; }; +/*! \brief Representation of a parameter of a function. */ class IParam { public: @@ -94,6 +107,7 @@ class IParam virtual const IString * attrib() const = 0; virtual const IString * arraySpecifier() const = 0; virtual ILinkedTextIterator *defaultValue() const = 0; + virtual IDocRoot *briefDescription() const = 0; }; class IParamIterator @@ -171,7 +185,8 @@ class IDoc Anchor, // 34 -> IDocAnchor Symbol, // 35 -> IDocSymbol Internal, // 36 -> IDocInternal - Root // 37 -> IDocRoot + Root, // 37 -> IDocRoot + ParameterItem // 38 -> IDocParameterItem }; virtual Kind kind() const = 0; }; @@ -238,15 +253,21 @@ class IDocParameterList : public IDoc { public: enum Types { Param, RetVal, Exception }; - virtual Types listType() const = 0; + virtual Types sectType() const = 0; virtual IDocIterator *params() const = 0; }; +class IDocParameterItem : public IDoc +{ + public: + virtual IDocIterator *paramNames() const = 0; + virtual IDocPara *description() const = 0; +}; + class IDocParameter : public IDoc { public: virtual const IString * name() const = 0; - virtual IDocPara *description() const = 0; }; class IDocTitle : public IDoc @@ -562,8 +583,18 @@ class IMember virtual ILinkedTextIterator *type() const = 0; virtual const IString * typeString() const = 0; virtual const IString * name() const = 0; + virtual const IString * readAccessor() const = 0; + virtual const IString * writeAccessor() const = 0; + virtual const IString * definition() const = 0; + virtual const IString * argsstring() const = 0; virtual bool isConst() const = 0; virtual bool isVolatile() const = 0; + virtual bool isStatic() const = 0; + virtual bool isExplicit() const = 0; + virtual bool isInline() const = 0; + virtual bool isMutable() const = 0; + virtual bool isReadable() const = 0; + virtual bool isWritable() const = 0; virtual IParamIterator *parameters() const = 0; virtual IParamIterator *templateParameters() const = 0; virtual ILinkedTextIterator *initializer() const = 0; @@ -578,6 +609,7 @@ class IMember virtual IMemberReferenceIterator *reimplementedBy() const = 0; virtual IDocRoot *briefDescription() const = 0; virtual IDocRoot *detailedDescription() const = 0; + virtual IDocRoot *inbodyDescription() const = 0; }; class IDefine : public IMember @@ -636,19 +668,26 @@ class IEnumValue : public IMember virtual const IString * name() const = 0; }; -#if 0 -class IEnumValueIterator +/*! \brief Include relation + */ +class IInclude { public: - virtual IEnumValue *toFirst() = 0; - virtual IEnumValue *toLast() = 0; - virtual IEnumValue *toNext() = 0; - virtual IEnumValue *toPrev() = 0; - virtual IEnumValue *current() const = 0; - virtual void release() = 0; + virtual const IString * name() const = 0; + virtual const IString * refId() const = 0; + virtual bool isLocal() const = 0; }; -#endif +class IIncludeIterator +{ + public: + virtual IInclude *toFirst() = 0; + virtual IInclude *toLast() = 0; + virtual IInclude *toNext() = 0; + virtual IInclude *toPrev() = 0; + virtual IInclude *current() const = 0; + virtual void release() = 0; +}; class IMemberIterator { @@ -936,6 +975,7 @@ class IInterface : public ICompound virtual IRelatedCompoundIterator *derivedCompounds() const = 0; }; + /*! \brief The interface to a Java/IDL exception in the object model. */ class IException : public ICompound @@ -960,9 +1000,9 @@ class IFile : public ICompound virtual IDocProgramListing *source() const = 0; virtual ICompoundIterator *nestedCompounds() const = 0; - // file: - // includes() - // includedBy() + virtual IIncludeIterator *includes() const = 0; + virtual IIncludeIterator *includedBy() const = 0; + // ICompound *innerNamespaces() // ICompoundIterator *innerClasses() }; diff --git a/addon/doxmlparser/src/compoundhandler.cpp b/addon/doxmlparser/src/compoundhandler.cpp index f75b330..26f0848 100644 --- a/addon/doxmlparser/src/compoundhandler.cpp +++ b/addon/doxmlparser/src/compoundhandler.cpp @@ -25,6 +25,33 @@ //---------------------------------------------------------------------------- +IncludeHandler::IncludeHandler(IBaseHandler *parent,const char *endtag) : + m_parent(parent) +{ + addEndHandler(endtag,this,&IncludeHandler::endInclude); +} + +IncludeHandler::~IncludeHandler() +{ +} + +void IncludeHandler::startInclude(const QXmlAttributes &attrib) +{ + m_curString = ""; + m_refId = attrib.value("refid"); + m_isLocal = attrib.value("local")=="yes"; + m_parent->setDelegate(this); +} + +void IncludeHandler::endInclude() +{ + m_name = m_curString; + m_parent->setDelegate(0); + debug(2,"Found include %s\n",m_name.data()); +} + +//---------------------------------------------------------------------------- + class CompoundIdIterator : public ICompoundIterator, public QListIterator<QString> { @@ -107,11 +134,15 @@ class CompoundTypeMap m_map.insert("struct",new int(ICompound::Struct)); m_map.insert("union",new int(ICompound::Union)); m_map.insert("interface",new int(ICompound::Interface)); + m_map.insert("protocol",new int(ICompound::Interface)); + m_map.insert("category",new int(ICompound::Interface)); m_map.insert("exception",new int(ICompound::Exception)); - m_map.insert("namespace",new int(ICompound::Namespace)); m_map.insert("file",new int(ICompound::File)); + m_map.insert("namespace",new int(ICompound::Namespace)); m_map.insert("group",new int(ICompound::Group)); m_map.insert("page",new int(ICompound::Page)); + m_map.insert("example",new int(ICompound::Page)); + m_map.insert("dir",new int(ICompound::Page)); } virtual ~CompoundTypeMap() { @@ -157,6 +188,8 @@ CompoundHandler::CompoundHandler(const QString &xmlDir) m_memberNameDict.setAutoDelete(TRUE); m_innerCompounds.setAutoDelete(TRUE); m_params.setAutoDelete(TRUE); + m_includes.setAutoDelete(TRUE); + m_includedBy.setAutoDelete(TRUE); addStartHandler("doxygen"); addEndHandler("doxygen"); @@ -175,13 +208,16 @@ CompoundHandler::CompoundHandler(const QString &xmlDir) addStartHandler("derivedcompoundref",this,&CompoundHandler::addSubClass); addEndHandler("derivedcompoundref"); - // includes - // includedby - + addStartHandler("includes",this,&CompoundHandler::startIncludes); + addStartHandler("includedby",this,&CompoundHandler::startIncludedBy); + addStartHandler("incdepgraph",this,&CompoundHandler::startIncludeDependencyGraph); addStartHandler("invincdepgraph",this,&CompoundHandler::startIncludedByDependencyGraph); + addStartHandler("innerdir",this,&CompoundHandler::startInnerDir); + addEndHandler("innerdir"); + addStartHandler("innerfile",this,&CompoundHandler::startInnerFile); addEndHandler("innerfile"); @@ -191,7 +227,8 @@ CompoundHandler::CompoundHandler(const QString &xmlDir) addStartHandler("innernamespace",this,&CompoundHandler::startInnerNamespace); addEndHandler("innernamespace"); - // innerpage + addStartHandler("innerpage",this,&CompoundHandler::startInnerPage); + addEndHandler("innerpage"); addStartHandler("innergroup",this,&CompoundHandler::startInnerGroup); addEndHandler("innergroup"); @@ -259,6 +296,20 @@ void CompoundHandler::startProgramListing(const QXmlAttributes& attrib) m_programListing = plHandler; } +void CompoundHandler::startIncludes(const QXmlAttributes& attrib) +{ + IncludeHandler *inc = new IncludeHandler(this,"includes"); + m_includes.append(inc); + inc->startInclude(attrib); +} + +void CompoundHandler::startIncludedBy(const QXmlAttributes& attrib) +{ + IncludeHandler *inc = new IncludeHandler(this,"includedby"); + m_includedBy.append(inc); + inc->startInclude(attrib); +} + void CompoundHandler::startCompound(const QXmlAttributes& attrib) { m_id = attrib.value("id"); @@ -307,6 +358,16 @@ void CompoundHandler::startInnerGroup(const QXmlAttributes& attrib) m_innerCompounds.append(new QString(attrib.value("refid"))); } +void CompoundHandler::startInnerPage(const QXmlAttributes& attrib) +{ + m_innerCompounds.append(new QString(attrib.value("refid"))); +} + +void CompoundHandler::startInnerDir(const QXmlAttributes& attrib) +{ + m_innerCompounds.append(new QString(attrib.value("refid"))); +} + void CompoundHandler::startTemplateParamList(const QXmlAttributes& attrib) { m_templateParamList = new TemplateParamListHandler(this); @@ -539,6 +600,16 @@ IDocProgramListing *CompoundHandler::source() const return m_programListing; } +IIncludeIterator *CompoundHandler::includes() const +{ + return new IncludeIterator(m_includes); +} + +IIncludeIterator *CompoundHandler::includedBy() const +{ + return new IncludeIterator(m_includedBy); +} + IParamIterator *CompoundHandler::templateParameters() const { return m_templateParamList ? m_templateParamList->templateParams() : 0; diff --git a/addon/doxmlparser/src/compoundhandler.h b/addon/doxmlparser/src/compoundhandler.h index 82cb13a..d3e25e6 100644 --- a/addon/doxmlparser/src/compoundhandler.h +++ b/addon/doxmlparser/src/compoundhandler.h @@ -36,6 +36,38 @@ class TemplateParamListHandler; class TitleHandler; class ListOfAllMembersHandler; +class IncludeHandler : public IInclude, public BaseHandler<IncludeHandler>\ +{ + public: + IncludeHandler(IBaseHandler *parent,const char *endtag); + virtual ~IncludeHandler(); + + void startInclude(const QXmlAttributes &attrib); + void endInclude(); + + // IInclude + virtual const IString * name() const + { return &m_name; } + virtual const IString * refId() const + { return &m_refId; } + virtual bool isLocal() const + { return &m_isLocal; } + + private: + IBaseHandler *m_parent; + StringImpl m_name; + StringImpl m_refId; + bool m_isLocal; +}; + +class IncludeIterator : public BaseIterator<IIncludeIterator,IInclude,IncludeHandler> +{ + public: + IncludeIterator(const QList<IncludeHandler> &list) : + BaseIterator<IIncludeIterator,IInclude,IncludeHandler>(list) {} +}; + + class RelatedCompound : public IRelatedCompound { public: @@ -94,10 +126,14 @@ class CompoundHandler : public IClass, virtual void startCollaborationGraph(const QXmlAttributes& attrib); virtual void startIncludeDependencyGraph(const QXmlAttributes& attrib); virtual void startIncludedByDependencyGraph(const QXmlAttributes& attrib); + virtual void startIncludes(const QXmlAttributes& attrib); + virtual void startIncludedBy(const QXmlAttributes& attrib); + virtual void startInnerDir(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 startInnerPage(const QXmlAttributes& attrib); virtual void startTitle(const QXmlAttributes& attrib); virtual void startTemplateParamList(const QXmlAttributes& attrib); virtual void startListOfAllMembers(const QXmlAttributes& attrib); @@ -140,6 +176,8 @@ class CompoundHandler : public IClass, IGraph *includeDependencyGraph() const; IGraph *includedByDependencyGraph() const; IDocProgramListing *source() const; + IIncludeIterator *includes() const; + IIncludeIterator *includedBy() const; // IPage implementation const IDocTitle *title() const; @@ -149,6 +187,8 @@ class CompoundHandler : public IClass, QList<RelatedCompound> m_subClasses; QList<SectionHandler> m_sections; QList<ParamHandler> m_params; + QList<IncludeHandler> m_includes; + QList<IncludeHandler> m_includedBy; DocHandler* m_brief; DocHandler* m_detailed; ProgramListingHandler* m_programListing; diff --git a/addon/doxmlparser/src/dochandler.cpp b/addon/doxmlparser/src/dochandler.cpp index 6b85d59..517e70c 100644 --- a/addon/doxmlparser/src/dochandler.cpp +++ b/addon/doxmlparser/src/dochandler.cpp @@ -551,16 +551,13 @@ void TocItemHandler::endTocItem() //---------------------------------------------------------------------- ParameterHandler::ParameterHandler(IBaseHandler *parent) : - m_parent(parent), m_description(0) + m_parent(parent) { addEndHandler("parametername",this,&ParameterHandler::endParameterName); - addEndHandler("parameterdescription",this,&ParameterHandler::endParameterDescription); - addStartHandler("para",this,&ParameterHandler::startParagraph); } ParameterHandler::~ParameterHandler() { - delete m_description; } void ParameterHandler::startParameterName(const QXmlAttributes& /*attrib*/) @@ -576,23 +573,57 @@ void ParameterHandler::endParameterName() m_parent->setDelegate(0); } -void ParameterHandler::startParameterDescription(const QXmlAttributes& /*attrib*/) +//---------------------------------------------------------------------- +// ParameterListHandler +//---------------------------------------------------------------------- + +ParameterItemHandler::ParameterItemHandler(IBaseHandler *parent) + : m_parent(parent) +{ + addEndHandler("parameteritem",this,&ParameterItemHandler::endParameterItem); + addStartHandler("parameternamelist"); + addEndHandler("parameternamelist"); + addStartHandler("parametername",this,&ParameterItemHandler::startParameterName); + addStartHandler("parameterdescription"); + addEndHandler("parameterdescription"); + addStartHandler("para",this,&ParameterItemHandler::startParagraph); + m_parameters.setAutoDelete(TRUE); + m_description = 0; +} + +ParameterItemHandler::~ParameterItemHandler() +{ + delete m_description; +} + +void ParameterItemHandler::startParameterItem(const QXmlAttributes&) { m_parent->setDelegate(this); } -void ParameterHandler::endParameterDescription() +void ParameterItemHandler::endParameterItem() { m_parent->setDelegate(0); } -void ParameterHandler::startParagraph(const QXmlAttributes& attrib) +void ParameterItemHandler::startParameterName(const QXmlAttributes& attrib) +{ + ParameterHandler *param = new ParameterHandler(this); + m_parameters.append(param); + param->startParameterName(attrib); +} + +void ParameterItemHandler::startParagraph(const QXmlAttributes& attrib) { - ASSERT(m_description==0); m_description = new ParagraphHandler(this); m_description->startParagraph(attrib); } +IDocIterator *ParameterItemHandler::paramNames() const +{ + return new ParameterItemIterator(*this); +} + //---------------------------------------------------------------------- // ParameterListHandler //---------------------------------------------------------------------- @@ -601,12 +632,8 @@ ParameterListHandler::ParameterListHandler(IBaseHandler *parent) : m_parent(parent) { addEndHandler("parameterlist",this,&ParameterListHandler::endParameterList); - addStartHandler("parametername",this,&ParameterListHandler::startParameterName); - addStartHandler("parameterdescription",this,&ParameterListHandler::startParameterDescription); - addStartHandler("title"); - addEndHandler("title"); - m_parameters.setAutoDelete(TRUE); - m_curParam=0; + addStartHandler("parameteritem",this,&ParameterListHandler::startParameterItem); + m_paramItems.setAutoDelete(TRUE); } ParameterListHandler::~ParameterListHandler() @@ -632,17 +659,11 @@ void ParameterListHandler::endParameterList() m_parent->setDelegate(0); } -void ParameterListHandler::startParameterName(const QXmlAttributes& attrib) -{ - m_curParam = new ParameterHandler(this); - m_parameters.append(m_curParam); - m_curParam->startParameterName(attrib); -} - -void ParameterListHandler::startParameterDescription(const QXmlAttributes& attrib) +void ParameterListHandler::startParameterItem(const QXmlAttributes& attrib) { - ASSERT(m_curParam!=0); - m_curParam->startParameterDescription(attrib); + ParameterItemHandler *paramItem = new ParameterItemHandler(this); + m_paramItems.append(paramItem); + paramItem->startParameterItem(attrib); } IDocIterator *ParameterListHandler::params() const @@ -1734,9 +1755,9 @@ void ParagraphHandler::startOrderedList(const QXmlAttributes& attrib) void ParagraphHandler::startParameterList(const QXmlAttributes& attrib) { addTextNode(); - ParameterListHandler *parListHandler = new ParameterListHandler(this); - parListHandler->startParameterList(attrib); - m_children.append(parListHandler); + ParameterListHandler *listHandler = new ParameterListHandler(this); + listHandler->startParameterList(attrib); + m_children.append(listHandler); } void ParagraphHandler::startSimpleSect(const QXmlAttributes& attrib) @@ -2148,6 +2169,7 @@ DocHandler::DocHandler(IBaseHandler *parent) : m_parent(parent) addEndHandler("briefdescription",this,&DocHandler::endDoc); addEndHandler("detaileddescription",this,&DocHandler::endDoc); + addEndHandler("inbodydescription",this,&DocHandler::endDoc); addEndHandler("internal"); addStartHandler("para",this,&DocHandler::startParagraph); diff --git a/addon/doxmlparser/src/dochandler.h b/addon/doxmlparser/src/dochandler.h index be577aa..6977254 100644 --- a/addon/doxmlparser/src/dochandler.h +++ b/addon/doxmlparser/src/dochandler.h @@ -45,6 +45,7 @@ DEFINE_CLS_IMPL(DocItemizedList); DEFINE_CLS_IMPL(DocOrderedList); DEFINE_CLS_IMPL(DocListItem); DEFINE_CLS_IMPL(DocParameterList); +DEFINE_CLS_IMPL(DocParameterItem); DEFINE_CLS_IMPL(DocParameter); DEFINE_CLS_IMPL(DocTitle); DEFINE_CLS_IMPL(DocSimpleSect); @@ -418,24 +419,54 @@ class ParameterHandler : public DocParameterImpl, virtual ~ParameterHandler(); virtual void startParameterName(const QXmlAttributes& attrib); virtual void endParameterName(); - virtual void startParameterDescription(const QXmlAttributes& attrib); - virtual void endParameterDescription(); - virtual void startParagraph(const QXmlAttributes& attrib); // IDocParameter virtual Kind kind() const { return DocImpl::Parameter; } virtual const IString *name() const { return &m_name; } - virtual IDocPara *description() const { return m_description; } private: IBaseHandler *m_parent; StringImpl m_name; +}; + +//----------------------------------------------------------------------------- + +/* \brief Node representing a list of param names with a single description. + * + */ +class ParameterItemHandler : public DocParameterItemImpl, + public BaseHandler<ParameterItemHandler> +{ + friend class ParameterItemIterator; + public: + ParameterItemHandler(IBaseHandler *parent); + virtual ~ParameterItemHandler(); + virtual void startParameterItem(const QXmlAttributes& attrib); + virtual void endParameterItem(); + virtual void startParameterName(const QXmlAttributes& attrib); + virtual void startParagraph(const QXmlAttributes& attrib); + + // IDocParameterItem + virtual Kind kind() const { return DocImpl::ParameterItem; } + virtual IDocIterator *paramNames() const; + virtual IDocPara *description() const { return m_description; } + + private: + IBaseHandler *m_parent; + QList<ParameterHandler> m_parameters; ParagraphHandler *m_description; }; +class ParameterItemIterator : public BaseIteratorVia<IDocIterator,IDoc,ParameterHandler,DocImpl> +{ + public: + ParameterItemIterator(const ParameterItemHandler &handler) : + BaseIteratorVia<IDocIterator,IDoc,ParameterHandler,DocImpl>(handler.m_parameters) {} +}; + //----------------------------------------------------------------------------- -/* \brief Node representing a parameter list. +/* \brief Node representing a parameter section. * */ class ParameterListHandler : public DocParameterListImpl, @@ -447,26 +478,24 @@ class ParameterListHandler : public DocParameterListImpl, virtual ~ParameterListHandler(); virtual void startParameterList(const QXmlAttributes& attrib); virtual void endParameterList(); - virtual void startParameterName(const QXmlAttributes& attrib); - virtual void startParameterDescription(const QXmlAttributes& attrib); + virtual void startParameterItem(const QXmlAttributes& attrib); // IDocParameterList virtual Kind kind() const { return DocImpl::ParameterList; } - virtual Types listType() const { return m_type; } + virtual Types sectType() const { return m_type; } virtual IDocIterator *params() const; private: IBaseHandler *m_parent; - QList<ParameterHandler> m_parameters; - ParameterHandler *m_curParam; + QList<ParameterItemHandler> m_paramItems; Types m_type; }; -class ParameterListIterator : public BaseIteratorVia<IDocIterator,IDoc,ParameterHandler,DocImpl> +class ParameterListIterator : public BaseIteratorVia<IDocIterator,IDoc,ParameterItemHandler,DocImpl> { public: ParameterListIterator(const ParameterListHandler &handler) : - BaseIteratorVia<IDocIterator,IDoc,ParameterHandler,DocImpl>(handler.m_parameters) {} + BaseIteratorVia<IDocIterator,IDoc,ParameterItemHandler,DocImpl>(handler.m_paramItems) {} }; //----------------------------------------------------------------------------- diff --git a/addon/doxmlparser/src/doxmlintf.h b/addon/doxmlparser/src/doxmlintf.h index 7296b6e..cd6beba 100644 --- a/addon/doxmlparser/src/doxmlintf.h +++ b/addon/doxmlparser/src/doxmlintf.h @@ -33,6 +33,7 @@ class ICompound; class ISection; class INode; class IDocInternal; +class IDocRoot; /*! \brief Read only interface to a string. */ @@ -51,6 +52,11 @@ class IString virtual int length() const = 0; }; +/*! \brief Base interface for hyperlinked text + * + * Depending on the result of kind() the interface is extended by + * ILT_Text or ILT_Ref. + */ class ILinkedText { public: @@ -58,12 +64,16 @@ class ILinkedText virtual Kind kind() const = 0; }; +/*! \brief Plain text fragment. + */ class ILT_Text : public ILinkedText { public: virtual const IString *text() const = 0; }; +/*! \brief Reference to an object. + */ class ILT_Ref : public ILinkedText { public: @@ -74,6 +84,8 @@ class ILT_Ref : public ILinkedText virtual const IString *text() const = 0; }; +/*! \brief Iterates over a list of ILinkedText fragments. + */ class ILinkedTextIterator { public: @@ -85,6 +97,7 @@ class ILinkedTextIterator virtual void release() = 0; }; +/*! \brief Representation of a parameter of a function. */ class IParam { public: @@ -94,6 +107,7 @@ class IParam virtual const IString * attrib() const = 0; virtual const IString * arraySpecifier() const = 0; virtual ILinkedTextIterator *defaultValue() const = 0; + virtual IDocRoot *briefDescription() const = 0; }; class IParamIterator @@ -171,7 +185,8 @@ class IDoc Anchor, // 34 -> IDocAnchor Symbol, // 35 -> IDocSymbol Internal, // 36 -> IDocInternal - Root // 37 -> IDocRoot + Root, // 37 -> IDocRoot + ParameterItem // 38 -> IDocParameterItem }; virtual Kind kind() const = 0; }; @@ -238,15 +253,21 @@ class IDocParameterList : public IDoc { public: enum Types { Param, RetVal, Exception }; - virtual Types listType() const = 0; + virtual Types sectType() const = 0; virtual IDocIterator *params() const = 0; }; +class IDocParameterItem : public IDoc +{ + public: + virtual IDocIterator *paramNames() const = 0; + virtual IDocPara *description() const = 0; +}; + class IDocParameter : public IDoc { public: virtual const IString * name() const = 0; - virtual IDocPara *description() const = 0; }; class IDocTitle : public IDoc @@ -562,8 +583,18 @@ class IMember virtual ILinkedTextIterator *type() const = 0; virtual const IString * typeString() const = 0; virtual const IString * name() const = 0; + virtual const IString * readAccessor() const = 0; + virtual const IString * writeAccessor() const = 0; + virtual const IString * definition() const = 0; + virtual const IString * argsstring() const = 0; virtual bool isConst() const = 0; virtual bool isVolatile() const = 0; + virtual bool isStatic() const = 0; + virtual bool isExplicit() const = 0; + virtual bool isInline() const = 0; + virtual bool isMutable() const = 0; + virtual bool isReadable() const = 0; + virtual bool isWritable() const = 0; virtual IParamIterator *parameters() const = 0; virtual IParamIterator *templateParameters() const = 0; virtual ILinkedTextIterator *initializer() const = 0; @@ -578,6 +609,7 @@ class IMember virtual IMemberReferenceIterator *reimplementedBy() const = 0; virtual IDocRoot *briefDescription() const = 0; virtual IDocRoot *detailedDescription() const = 0; + virtual IDocRoot *inbodyDescription() const = 0; }; class IDefine : public IMember @@ -636,19 +668,26 @@ class IEnumValue : public IMember virtual const IString * name() const = 0; }; -#if 0 -class IEnumValueIterator +/*! \brief Include relation + */ +class IInclude { public: - virtual IEnumValue *toFirst() = 0; - virtual IEnumValue *toLast() = 0; - virtual IEnumValue *toNext() = 0; - virtual IEnumValue *toPrev() = 0; - virtual IEnumValue *current() const = 0; - virtual void release() = 0; + virtual const IString * name() const = 0; + virtual const IString * refId() const = 0; + virtual bool isLocal() const = 0; }; -#endif +class IIncludeIterator +{ + public: + virtual IInclude *toFirst() = 0; + virtual IInclude *toLast() = 0; + virtual IInclude *toNext() = 0; + virtual IInclude *toPrev() = 0; + virtual IInclude *current() const = 0; + virtual void release() = 0; +}; class IMemberIterator { @@ -936,6 +975,7 @@ class IInterface : public ICompound virtual IRelatedCompoundIterator *derivedCompounds() const = 0; }; + /*! \brief The interface to a Java/IDL exception in the object model. */ class IException : public ICompound @@ -960,9 +1000,9 @@ class IFile : public ICompound virtual IDocProgramListing *source() const = 0; virtual ICompoundIterator *nestedCompounds() const = 0; - // file: - // includes() - // includedBy() + virtual IIncludeIterator *includes() const = 0; + virtual IIncludeIterator *includedBy() const = 0; + // ICompound *innerNamespaces() // ICompoundIterator *innerClasses() }; diff --git a/addon/doxmlparser/src/mainhandler.cpp b/addon/doxmlparser/src/mainhandler.cpp index c610f04..d2422ed 100644 --- a/addon/doxmlparser/src/mainhandler.cpp +++ b/addon/doxmlparser/src/mainhandler.cpp @@ -133,6 +133,7 @@ void MainHandler::endName() else { m_curCompound->name = m_curString; + m_compoundNameDict.insert(m_curString,m_curCompound); } } @@ -230,16 +231,16 @@ ICompound *MainHandler::compoundById(const char *id) const // unchanged. MainHandler *that = (MainHandler *)this; ch->initialize(that); - printf("loading compound %s in memory\n",id); + //printf("loading compound %s in memory\n",id); that->m_compoundsLoaded.insert(id,ch); return ch->toICompound(); } void MainHandler::unloadCompound(CompoundHandler *ch) { - printf("unloading compound %s from memory\n",ch->id()->latin1()); + //printf("unloading compound %s from memory\n",ch->id()->latin1()); bool result = m_compoundsLoaded.remove(ch->id()->latin1()); - if (!result) printf("Failed to unload!\n"); + if (!result) debug(1,"Failed to unload component!\n"); } ICompound *MainHandler::compoundByName(const char *name) const @@ -257,7 +258,7 @@ ICompound *MainHandler::memberById(const char *id) const if (ids.isEmpty()) return 0; MemberEntry *me = m_memberDict[id]; if (me==0) return 0; // id not found - return compoundById(me->id); + return compoundById(me->compound->id); } ICompoundIterator *MainHandler::memberByName(const char *name) const diff --git a/addon/doxmlparser/src/memberhandler.cpp b/addon/doxmlparser/src/memberhandler.cpp index 55c8a58..dc1f6bc 100644 --- a/addon/doxmlparser/src/memberhandler.cpp +++ b/addon/doxmlparser/src/memberhandler.cpp @@ -154,7 +154,7 @@ void EnumValueHandler::startDetailedDesc(const QXmlAttributes& attrib) //------------------------------------------------------------------------------ MemberHandler::MemberHandler(IBaseHandler *parent) - : m_parent(parent), m_compound(0), m_brief(0), m_detailed(0) + : m_parent(parent), m_compound(0), m_brief(0), m_detailed(0), m_inbody(0) { //printf("MemberHandler::MemberHandler() %p\n",this); addEndHandler("memberdef",this,&MemberHandler::endMember); @@ -163,11 +163,22 @@ MemberHandler::MemberHandler(IBaseHandler *parent) addEndHandler("templateparamlist",this,&MemberHandler::endTemplateParamList); addStartHandler("type",this,&MemberHandler::startType); - // definition - // argsstring + + addStartHandler("definition",this,&MemberHandler::startDefinition); + addEndHandler("definition",this,&MemberHandler::endDefinition); + + addStartHandler("argsstring",this,&MemberHandler::startArgsString); + addEndHandler("argsstring",this,&MemberHandler::endArgsString); + addStartHandler("name",this,&MemberHandler::startName); addEndHandler("name",this,&MemberHandler::endName); + addStartHandler("read",this,&MemberHandler::startRead); + addEndHandler("read",this,&MemberHandler::endRead); + + addStartHandler("write",this,&MemberHandler::startWrite); + addEndHandler("write",this,&MemberHandler::endWrite); + addStartHandler("reimplements",this,&MemberHandler::startReimplements); addEndHandler("reimplements",this,&MemberHandler::endReimplements); @@ -180,13 +191,13 @@ MemberHandler::MemberHandler(IBaseHandler *parent) addEndHandler("enumvalue",this,&MemberHandler::endMember); addStartHandler("initializer",this,&MemberHandler::startInitializer); - addStartHandler("exception",this,&MemberHandler::startException); + addStartHandler("exceptions",this,&MemberHandler::startException); addStartHandler("briefdescription",this,&MemberHandler::startBriefDesc); addStartHandler("detaileddescription",this,&MemberHandler::startDetailedDesc); - // inbodydescription + addStartHandler("inbodydescription",this,&MemberHandler::startInbodyDesc); addStartHandler("location",this,&MemberHandler::startLocation); addEndHandler("location"); @@ -219,6 +230,7 @@ MemberHandler::~MemberHandler() debug(2,"MemberHandler::~MemberHandler() %p\n",this); delete m_brief; delete m_detailed; + delete m_inbody; delete m_linkedTextHandler; delete m_reimplements; } @@ -230,10 +242,17 @@ void MemberHandler::startMember(const QXmlAttributes& attrib) //printf("startMember kindString=`%s'\n",m_kindString.data()); m_kind = s_typeMap->map(m_kindString); m_id = attrib.value("id"); - m_virtualness = attrib.value("virt"); m_protection = attrib.value("prot"); + m_isStatic = attrib.value("static")=="yes"; m_isConst = attrib.value("const")=="yes"; + m_isExplicit = attrib.value("explicit")=="yes"; + m_isInline = attrib.value("inline")=="yes"; + m_virtualness = attrib.value("virt"); m_isVolatile = attrib.value("volatile")=="yes"; + m_isMutable = attrib.value("mutable")=="yes"; + m_isReadable = attrib.value("readable")=="yes"; + m_isWritable = attrib.value("writable")=="yes"; + debug(2,"member kind=`%s' id=`%s' prot=`%s' virt=`%s'\n", m_kindString.data(),m_id.data(),m_protection.data(),m_virtualness.data()); } @@ -245,10 +264,16 @@ void MemberHandler::startEnumValue(const QXmlAttributes& attrib) //printf("startEnumValue kindString=`%s'\n",m_kindString.data()); m_kind = s_typeMap->map(m_kindString); m_id = attrib.value("id"); - m_virtualness = "non-virtual"; m_protection = attrib.value("prot"); + m_isStatic = FALSE; m_isConst = FALSE; + m_isExplicit = FALSE; + m_isInline = FALSE; + m_virtualness = "non-virtual"; m_isVolatile = FALSE; + m_isMutable = FALSE; + m_isReadable = FALSE; + m_isWritable = FALSE; debug(2,"member kind=`%s' id=`%s' prot=`%s' virt=`%s'\n", m_kindString.data(),m_id.data(),m_protection.data(),m_virtualness.data()); } @@ -275,6 +300,13 @@ void MemberHandler::startDetailedDesc(const QXmlAttributes& attrib) m_detailed = docHandler; } +void MemberHandler::startInbodyDesc(const QXmlAttributes& attrib) +{ + DocHandler *docHandler = new DocHandler(this); + docHandler->startDoc(attrib); + m_inbody = docHandler; +} + void MemberHandler::startLocation(const QXmlAttributes& attrib) { m_defFile = attrib.value("file"); @@ -364,7 +396,7 @@ void MemberHandler::startException(const QXmlAttributes &) debug(2,"startException!\n"); delete m_linkedTextHandler; m_linkedTextHandler = new LinkedTextHandler(this,m_exception); - m_linkedTextHandler->start("exception"); + m_linkedTextHandler->start("exceptions"); } void MemberHandler::startName(const QXmlAttributes &) @@ -378,6 +410,50 @@ void MemberHandler::endName() debug(2,"member name=`%s'\n",m_name.data()); } +void MemberHandler::startRead(const QXmlAttributes &) +{ + m_curString=""; +} + +void MemberHandler::endRead() +{ + m_read = m_curString.stripWhiteSpace(); + debug(2,"member read=`%s'\n",m_read.data()); +} + +void MemberHandler::startWrite(const QXmlAttributes &) +{ + m_curString=""; +} + +void MemberHandler::endWrite() +{ + m_write = m_curString.stripWhiteSpace(); + debug(2,"member write=`%s'\n",m_write.data()); +} + +void MemberHandler::startDefinition(const QXmlAttributes&) +{ + m_curString=""; +} + +void MemberHandler::endDefinition() +{ + m_definition = m_curString.stripWhiteSpace(); + debug(2,"definition=%s\n",m_definition.data()); +} + +void MemberHandler::startArgsString(const QXmlAttributes&) +{ + m_curString=""; +} + +void MemberHandler::endArgsString() +{ + m_argsstring = m_curString.stripWhiteSpace(); + debug(2,"arggstring=%s\n",m_argsstring.data()); +} + void MemberHandler::startParam(const QXmlAttributes& attrib) { ParamHandler *paramHandler = new ParamHandler(this); @@ -515,3 +591,8 @@ IDocRoot *MemberHandler::detailedDescription() const return m_detailed; } +IDocRoot *MemberHandler::inbodyDescription() const +{ + return m_inbody; +} + diff --git a/addon/doxmlparser/src/memberhandler.h b/addon/doxmlparser/src/memberhandler.h index 4897fa2..f1af61e 100644 --- a/addon/doxmlparser/src/memberhandler.h +++ b/addon/doxmlparser/src/memberhandler.h @@ -129,8 +129,17 @@ class MemberHandler : public IDefine, virtual void startType(const QXmlAttributes& attrib); virtual void startName(const QXmlAttributes& attrib); virtual void endName(); + virtual void startRead(const QXmlAttributes& attrib); + virtual void endRead(); + virtual void startWrite(const QXmlAttributes& attrib); + virtual void endWrite(); + virtual void startDefinition(const QXmlAttributes& attrib); + virtual void endDefinition(); + virtual void startArgsString(const QXmlAttributes& attrib); + virtual void endArgsString(); virtual void startBriefDesc(const QXmlAttributes& attrib); virtual void startDetailedDesc(const QXmlAttributes& attrib); + virtual void startInbodyDesc(const QXmlAttributes& attrib); virtual void startLocation(const QXmlAttributes& attrib); virtual void startReferences(const QXmlAttributes& attrib); virtual void endReferences(); @@ -165,10 +174,30 @@ class MemberHandler : public IDefine, { return &m_virtualness; } virtual const IString *name() const { return &m_name; } + virtual const IString *readAccessor() const + { return &m_read; } + virtual const IString *writeAccessor() const + { return &m_write; } + virtual const IString *definition() const + { return &m_definition; } + virtual const IString *argsstring() const + { return &m_argsstring; } virtual bool isConst() const { return m_isConst; } virtual bool isVolatile() const { return m_isVolatile; } + virtual bool isStatic() const + { return m_isStatic; } + virtual bool isExplicit() const + { return m_isExplicit; } + virtual bool isInline() const + { return m_isInline; } + virtual bool isMutable() const + { return m_isMutable; } + virtual bool isReadable() const + { return m_isReadable; } + virtual bool isWritable() const + { return m_isWritable; } virtual ILinkedTextIterator *type() const; virtual const IString *typeString() const; virtual IParamIterator *parameters() const; @@ -190,6 +219,7 @@ class MemberHandler : public IDefine, virtual IMemberReferenceIterator *reimplementedBy() const; virtual IDocRoot *briefDescription() const; virtual IDocRoot *detailedDescription() const; + virtual IDocRoot *inbodyDescription() const; // IEnum virtual IMemberIterator *enumValues() const; @@ -212,8 +242,13 @@ class MemberHandler : public IDefine, QList<LinkedTextImpl> m_initializer; QList<LinkedTextImpl> m_exception; StringImpl m_name; + StringImpl m_read; + StringImpl m_write; + StringImpl m_definition; + StringImpl m_argsstring; DocHandler *m_brief; DocHandler *m_detailed; + DocHandler *m_inbody; QList<ParamHandler> m_params; QList<ParamHandler> m_templateParams; QList<MemberReference> m_references; @@ -230,6 +265,12 @@ class MemberHandler : public IDefine, QList<MemberHandler> m_enumValues; bool m_insideTemplateParamList; bool m_hasTemplateParamList; + bool m_isStatic; + bool m_isExplicit; + bool m_isInline; + bool m_isMutable; + bool m_isReadable; + bool m_isWritable; }; class MemberIterator : public BaseIteratorVia<IMemberIterator, diff --git a/addon/doxmlparser/src/paramhandler.cpp b/addon/doxmlparser/src/paramhandler.cpp index f06d19d..29d6942 100644 --- a/addon/doxmlparser/src/paramhandler.cpp +++ b/addon/doxmlparser/src/paramhandler.cpp @@ -17,6 +17,7 @@ #include "memberhandler.h" #include "linkedtexthandler.h" #include "debug.h" +#include "dochandler.h" TemplateParamListHandler::TemplateParamListHandler(IBaseHandler *parent) : m_parent(parent) { @@ -49,7 +50,7 @@ void TemplateParamListHandler::endTemplateParamList() /////////////////////////////////////////////////////////////////////////////////////////////////////// -ParamHandler::ParamHandler(IBaseHandler *parent) : m_parent(parent) +ParamHandler::ParamHandler(IBaseHandler *parent) : m_parent(parent), m_brief(0) { addEndHandler("param",this,&ParamHandler::endParam); @@ -67,6 +68,8 @@ ParamHandler::ParamHandler(IBaseHandler *parent) : m_parent(parent) addStartHandler("attribute"); addEndHandler("attribute",this,&ParamHandler::endAttrib); + addStartHandler("briefdescription",this,&ParamHandler::startBriefDesc); + addStartHandler("defval",this,&ParamHandler::startDefVal); m_linkedTextHandler = 0; @@ -74,6 +77,7 @@ ParamHandler::ParamHandler(IBaseHandler *parent) : m_parent(parent) ParamHandler::~ParamHandler() { + delete m_brief; delete m_linkedTextHandler; } @@ -128,6 +132,13 @@ void ParamHandler::startDefVal(const QXmlAttributes& /*attrib*/) debug(2,"member defVal\n"); } +void ParamHandler::startBriefDesc(const QXmlAttributes& attrib) +{ + DocHandler *docHandler = new DocHandler(this); + docHandler->startDoc(attrib); + m_brief = docHandler; +} + ILinkedTextIterator *ParamHandler::type() const { return new LinkedTextIterator(m_type); @@ -138,4 +149,10 @@ ILinkedTextIterator *ParamHandler::defaultValue() const return new LinkedTextIterator(m_defVal); } +IDocRoot *ParamHandler::briefDescription() const +{ + return m_brief; +} + + diff --git a/addon/doxmlparser/src/paramhandler.h b/addon/doxmlparser/src/paramhandler.h index ee88a70..c4c4c10 100644 --- a/addon/doxmlparser/src/paramhandler.h +++ b/addon/doxmlparser/src/paramhandler.h @@ -27,6 +27,7 @@ class LinkedTextImpl; class LinkedTextHandler; +class DocHandler; class ParamHandler : public IParam, public BaseHandler<ParamHandler> @@ -40,6 +41,7 @@ class ParamHandler : public IParam, public BaseHandler<ParamHandler> virtual void endAttrib(); virtual void endArray(); virtual void startDefVal(const QXmlAttributes& attrib); + virtual void startBriefDesc(const QXmlAttributes& attrib); ParamHandler(IBaseHandler *parent); virtual ~ParamHandler(); @@ -51,9 +53,11 @@ class ParamHandler : public IParam, public BaseHandler<ParamHandler> virtual const IString * attrib() const { return &m_attrib; } virtual const IString * arraySpecifier() const { return &m_array; } virtual ILinkedTextIterator *defaultValue() const; + virtual IDocRoot *briefDescription() const; private: IBaseHandler *m_parent; + DocHandler *m_brief; QList<LinkedTextImpl> m_type; StringImpl m_declName; StringImpl m_defName; diff --git a/addon/doxmlparser/test/main.cpp b/addon/doxmlparser/test/main.cpp index d203285..8bf9dd2 100644 --- a/addon/doxmlparser/test/main.cpp +++ b/addon/doxmlparser/test/main.cpp @@ -130,10 +130,25 @@ void DumpDoc(IDoc *doc,int level) InPrint(("</list item>\n")); } break; + case IDoc::ParameterItem: + { + IDocParameterItem *item = dynamic_cast<IDocParameterItem*>(doc); + InPrint(("<parameter item>\n")); + IDocIterator *di = item->paramNames(); + IDoc *pdoc; + for (di->toFirst();(pdoc=di->current());di->toNext()) + { + DumpDoc(pdoc,level+1); + } + di->release(); + DumpDoc(item->description(),level+1); + InPrint(("</parameter item>\n")); + } + break; case IDoc::ParameterList: { IDocParameterList *list = dynamic_cast<IDocParameterList*>(doc); - InPrint(("<parameter list type=%d>\n",list->listType())); + InPrint(("<parameter list type=%d>\n",list->sectType())); IDocIterator *di = list->params(); IDoc *pdoc; for (di->toFirst();(pdoc=di->current());di->toNext()) @@ -149,9 +164,7 @@ void DumpDoc(IDoc *doc,int level) { IDocParameter *par = dynamic_cast<IDocParameter*>(doc); ASSERT(par!=0); - InPrint(("<parameter name=%s>\n",par->name()->latin1())); - DumpDoc(par->description(),level+1); - InPrint(("<parameter/>\n")); + InPrint(("<parameter name=%s/>\n",par->name()->latin1())); } break; case IDoc::SimpleSect: |