diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2002-04-21 17:27:45 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2002-04-21 17:27:45 (GMT) |
commit | 210582f8060fb41f6ad34d8315c9dd27b1bb6834 (patch) | |
tree | 4859bfed167f695f5ce9e9c0f2f6f02313de2ed3 /addon/doxmlparser/src | |
parent | 481a46c5ec227eaf82bfef99b742b793a727b8ec (diff) | |
download | Doxygen-210582f8060fb41f6ad34d8315c9dd27b1bb6834.zip Doxygen-210582f8060fb41f6ad34d8315c9dd27b1bb6834.tar.gz Doxygen-210582f8060fb41f6ad34d8315c9dd27b1bb6834.tar.bz2 |
Release-1.2.15-20020421
Diffstat (limited to 'addon/doxmlparser/src')
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.cpp | 44 | ||||
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.h | 34 | ||||
-rw-r--r-- | addon/doxmlparser/src/dochandler.cpp | 17 | ||||
-rw-r--r-- | addon/doxmlparser/src/dochandler.h | 95 | ||||
-rw-r--r-- | addon/doxmlparser/src/doxmlintf.h | 132 | ||||
-rw-r--r-- | addon/doxmlparser/src/doxmlparser.pro.in | 2 | ||||
-rw-r--r-- | addon/doxmlparser/src/graphhandler.h | 21 | ||||
-rw-r--r-- | addon/doxmlparser/src/linkedtexthandler.cpp | 25 | ||||
-rw-r--r-- | addon/doxmlparser/src/mainhandler.cpp | 28 | ||||
-rw-r--r-- | addon/doxmlparser/src/mainhandler.h | 8 | ||||
-rw-r--r-- | addon/doxmlparser/src/memberhandler.h | 58 | ||||
-rw-r--r-- | addon/doxmlparser/src/paramhandler.h | 17 | ||||
-rw-r--r-- | addon/doxmlparser/src/sectionhandler.h | 6 | ||||
-rw-r--r-- | addon/doxmlparser/src/stringimpl.h | 26 |
14 files changed, 311 insertions, 202 deletions
diff --git a/addon/doxmlparser/src/compoundhandler.cpp b/addon/doxmlparser/src/compoundhandler.cpp index ce7c852..59d4cd9 100644 --- a/addon/doxmlparser/src/compoundhandler.cpp +++ b/addon/doxmlparser/src/compoundhandler.cpp @@ -144,7 +144,8 @@ void compoundhandler_exit() 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_mainHandler(0), m_inheritanceGraph(0), m_collaborationGraph(0), + m_includeDependencyGraph(0), m_includedByDependencyGraph(0) { m_superClasses.setAutoDelete(TRUE); m_subClasses.setAutoDelete(TRUE); @@ -182,9 +183,14 @@ CompoundHandler::CompoundHandler(const QString &xmlDir) addStartHandler("collaborationgraph",this,&CompoundHandler::startCollaborationGraph); + addStartHandler("incdepgraph",this,&CompoundHandler::startIncludeDependencyGraph); + + addStartHandler("invincdepgraph",this,&CompoundHandler::startIncludedByDependencyGraph); + addStartHandler("innerclass",this,&CompoundHandler::startInnerClass); addEndHandler("innerclass"); + } CompoundHandler::~CompoundHandler() @@ -195,6 +201,8 @@ CompoundHandler::~CompoundHandler() delete m_programListing; delete m_inheritanceGraph; delete m_collaborationGraph; + delete m_includeDependencyGraph; + delete m_includedByDependencyGraph; } void CompoundHandler::startSection(const QXmlAttributes& attrib) @@ -303,7 +311,7 @@ void CompoundHandler::addSubClass(const QXmlAttributes& attrib) m_subClasses.append(sc); } -bool CompoundHandler::parseXML(const QString &compId) +bool CompoundHandler::parseXML(const char *compId) { QFile xmlFile(m_xmlDir+"/"+compId+".xml"); if (!xmlFile.exists()) return FALSE; @@ -329,12 +337,12 @@ void CompoundHandler::initialize(MainHandler *mh) void CompoundHandler::insertMember(MemberHandler *mh) { - m_memberDict.insert(mh->id(),mh); - QList<MemberHandler> *mhl = m_memberNameDict.find(mh->id()); + m_memberDict.insert(mh->id()->latin1(),mh); + QList<MemberHandler> *mhl = m_memberNameDict.find(mh->id()->latin1()); if (mhl==0) { mhl = new QList<MemberHandler>; - m_memberNameDict.insert(mh->name(),mhl); + m_memberNameDict.insert(mh->name()->latin1(),mhl); } mhl->append(mh); } @@ -372,7 +380,7 @@ ISectionIterator *CompoundHandler::sections() const return new SectionIterator(m_sections); } -IMemberIterator *CompoundHandler::memberByName(const QString &name) const +IMemberIterator *CompoundHandler::memberByName(const char *name) const { QList<MemberHandler> *ml = m_memberNameDict[name]; if (ml==0) return 0; @@ -391,6 +399,18 @@ void CompoundHandler::startCollaborationGraph(const QXmlAttributes &attrib) m_collaborationGraph->startGraph(attrib); } +void CompoundHandler::startIncludeDependencyGraph(const QXmlAttributes &attrib) +{ + m_includeDependencyGraph = new GraphHandler(this,"incdepgraph"); + m_includeDependencyGraph->startGraph(attrib); +} + +void CompoundHandler::startIncludedByDependencyGraph(const QXmlAttributes &attrib) +{ + m_includedByDependencyGraph = new GraphHandler(this,"invincdepgraph"); + m_includedByDependencyGraph->startGraph(attrib); +} + IDocRoot *CompoundHandler::briefDescription() const { return m_brief; @@ -401,7 +421,7 @@ IDocRoot *CompoundHandler::detailedDescription() const return m_detailed; } -IMember *CompoundHandler::memberById(const QString &id) const +IMember *CompoundHandler::memberById(const char *id) const { return m_memberDict[id]; } @@ -416,6 +436,16 @@ IGraph *CompoundHandler::collaborationGraph() const return m_collaborationGraph; } +IGraph *CompoundHandler::includeDependencyGraph() const +{ + return m_includeDependencyGraph; +} + +IGraph *CompoundHandler::includedByDependencyGraph() const +{ + return m_includedByDependencyGraph; +} + IRelatedCompoundIterator *CompoundHandler::baseClasses() const { return new RelatedCompoundIterator(m_superClasses); diff --git a/addon/doxmlparser/src/compoundhandler.h b/addon/doxmlparser/src/compoundhandler.h index 965e4c1..b331bec 100644 --- a/addon/doxmlparser/src/compoundhandler.h +++ b/addon/doxmlparser/src/compoundhandler.h @@ -20,6 +20,7 @@ #include <qxml.h> #include <doxmlintf.h> +#include "stringimpl.h" #include "basehandler.h" #include "baseiterator.h" @@ -74,6 +75,7 @@ class CompoundHandler : public IClass, public BaseHandler<CompoundHandler> { friend class RelatedCompound; + public: virtual void startSection(const QXmlAttributes& attrib); virtual void startCompound(const QXmlAttributes& attrib); @@ -87,26 +89,28 @@ class CompoundHandler : public IClass, virtual void startProgramListing(const QXmlAttributes& attrib); virtual void startInheritanceGraph(const QXmlAttributes& attrib); virtual void startCollaborationGraph(const QXmlAttributes& attrib); + virtual void startIncludeDependencyGraph(const QXmlAttributes& attrib); + virtual void startIncludedByDependencyGraph(const QXmlAttributes& attrib); virtual void startInnerClass(const QXmlAttributes& attrib); virtual void addref() { m_refCount++; } CompoundHandler(const QString &dirName); virtual ~CompoundHandler(); - bool parseXML(const QString &compId); + bool parseXML(const char *compId); void initialize(MainHandler *mh); void insertMember(MemberHandler *mh); ICompound *toICompound() const; // ICompound implementation - QString name() const { return m_name; } - QString id() const { return m_id; } + const IString *name() const { return &m_name; } + const IString *id() const { return &m_id; } CompoundKind kind() const { return m_kind; } - QString kindString() const { return m_kindString; } + const IString *kindString() const { return &m_kindString; } ISectionIterator *sections() const; IDocRoot *briefDescription() const; IDocRoot *detailedDescription() const; - IMember *memberById(const QString &id) const; - IMemberIterator *memberByName(const QString &name) const; + IMember *memberById(const char *id) const; + IMemberIterator *memberByName(const char *name) const; void release(); // IClass implementation @@ -115,18 +119,22 @@ class CompoundHandler : public IClass, IRelatedCompoundIterator *baseClasses() const; IRelatedCompoundIterator *derivedClasses() const; ICompoundIterator *nestedClasses() const; + + // IFile implementation + IGraph *includeDependencyGraph() const; + IGraph *includedByDependencyGraph() const; private: - QList<RelatedCompound> m_superClasses; - QList<RelatedCompound> m_subClasses; - QList<SectionHandler> m_sections; + QList<RelatedCompound> m_superClasses; + QList<RelatedCompound> m_subClasses; + QList<SectionHandler> m_sections; DocHandler *m_brief; DocHandler *m_detailed; ProgramListingHandler *m_programListing; - QString m_id; - QString m_kindString; + StringImpl m_id; + StringImpl m_kindString; CompoundKind m_kind; - QString m_name; + StringImpl m_name; QString m_defFile; int m_defLine; QString m_xmlDir; @@ -136,6 +144,8 @@ class CompoundHandler : public IClass, MainHandler *m_mainHandler; GraphHandler *m_inheritanceGraph; GraphHandler *m_collaborationGraph; + GraphHandler *m_includeDependencyGraph; + GraphHandler *m_includedByDependencyGraph; QList<QString> m_innerClasses; }; diff --git a/addon/doxmlparser/src/dochandler.cpp b/addon/doxmlparser/src/dochandler.cpp index 4c91ba5..f21c90f 100644 --- a/addon/doxmlparser/src/dochandler.cpp +++ b/addon/doxmlparser/src/dochandler.cpp @@ -117,6 +117,9 @@ MarkupHandler::MarkupHandler(QList<DocImpl> &children,QString &curString) addStartHandler("superscript",this,&MarkupHandler::startSuperscript); addEndHandler("superscript",this,&MarkupHandler::endSuperscript); + + addStartHandler("preformatted",this,&MarkupHandler::startPreformatted); + addEndHandler("preformatted",this,&MarkupHandler::endPreformatted); } MarkupHandler::~MarkupHandler() @@ -231,6 +234,20 @@ void MarkupHandler::endSuperscript() m_curMarkup &= ~IDocMarkup::Superscript; } +void MarkupHandler::startPreformatted(const QXmlAttributes & /*attrib*/) +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Preformatted,TRUE)); + m_curMarkup |= IDocMarkup::Preformatted; +} + +void MarkupHandler::endPreformatted() +{ + addTextNode(); + m_children.append(new MarkupModifierNode(IDocMarkup::Preformatted,FALSE)); + m_curMarkup &= ~IDocMarkup::Preformatted; +} + //---------------------------------------------------------------------- // ListItemHandler //---------------------------------------------------------------------- diff --git a/addon/doxmlparser/src/dochandler.h b/addon/doxmlparser/src/dochandler.h index 894296a..7b24458 100644 --- a/addon/doxmlparser/src/dochandler.h +++ b/addon/doxmlparser/src/dochandler.h @@ -21,6 +21,7 @@ #include <qxml.h> #include <doxmlintf.h> +#include "stringimpl.h" #include "basehandler.h" #include "baseiterator.h" @@ -80,11 +81,11 @@ class TextNode : public DocTextImpl // IDocText virtual Kind kind() const { return DocImpl::Text; } - virtual QString text() const { return m_text; } + virtual const IString *text() const { return &m_text; } virtual int markup() const { return m_markup; } private: - QString m_text; + StringImpl m_text; int m_markup; }; @@ -137,6 +138,8 @@ class MarkupHandler : public BaseFallBackHandler<MarkupHandler> virtual void endSubscript(); virtual void startSuperscript(const QXmlAttributes &attrib); virtual void endSuperscript(); + virtual void startPreformatted(const QXmlAttributes &attrib); + virtual void endPreformatted(); private: @@ -322,12 +325,12 @@ class ParameterHandler : public DocParameterImpl, // IDocParameter virtual Kind kind() const { return DocImpl::Parameter; } - virtual QString name() const { return m_name; } + virtual const IString *name() const { return &m_name; } virtual IDocPara *description() const { return m_description; } private: IBaseHandler *m_parent; - QString m_name; + StringImpl m_name; ParagraphHandler *m_description; }; @@ -404,13 +407,13 @@ class LinkHandler : public DocLinkImpl, public BaseHandler<LinkHandler> // IDocLink virtual Kind kind() const { return DocImpl::Link; } - virtual QString refId() const { return m_ref; } - virtual QString text() const { return m_text; } + virtual const IString *refId() const { return &m_ref; } + virtual const IString *text() const { return &m_text; } private: IBaseHandler *m_parent; - QString m_ref; - QString m_text; + StringImpl m_ref; + StringImpl m_text; }; @@ -430,11 +433,11 @@ class EMailHandler : public DocEMailImpl, public BaseHandler<EMailHandler> // IDocEMail virtual Kind kind() const { return DocImpl::EMail; } - virtual QString address() const { return m_address; } + virtual const IString *address() const { return &m_address; } private: IBaseHandler *m_parent; - QString m_address; + StringImpl m_address; }; @@ -454,13 +457,13 @@ class ULinkHandler : public DocULinkImpl, public BaseHandler<ULinkHandler> // IDocULink virtual Kind kind() const { return DocImpl::ULink; } - virtual QString url() const { return m_url; } - virtual QString text() const { return m_text; } + virtual const IString * url() const { return &m_url; } + virtual const IString * text() const { return &m_text; } private: IBaseHandler *m_parent; - QString m_url; - QString m_text; + StringImpl m_url; + StringImpl m_text; }; //----------------------------------------------------------------------------- @@ -499,16 +502,16 @@ class RefHandler : public DocRefImpl, public BaseHandler<RefHandler> // IDocRef virtual Kind kind() const { return DocImpl::Ref; } - virtual QString refId() const { return m_refId; } + virtual const IString *refId() const { return &m_refId; } virtual TargetKind targetKind() const { return m_targetKind; } - virtual QString external() const { return m_extId; } - virtual QString text() const { return m_linkText; } + virtual const IString *external() const { return &m_extId; } + virtual const IString *text() const { return &m_linkText; } private: IBaseHandler *m_parent; - QString m_refId; - QString m_extId; - QString m_linkText; + StringImpl m_refId; + StringImpl m_extId; + StringImpl m_linkText; TargetKind m_targetKind; }; @@ -569,7 +572,7 @@ class SimpleSectHandler : public DocSimpleSectImpl, // IDocSimpleSect virtual Kind kind() const { return DocImpl::SimpleSect; } virtual Types type() const { return m_type; } - virtual QString typeString() const { return m_typeString; } + virtual const IString *typeString() const { return &m_typeString; } virtual IDocTitle *title() const { return m_title; } virtual IDocPara *description() const { return m_paragraph; } @@ -577,7 +580,7 @@ class SimpleSectHandler : public DocSimpleSectImpl, IBaseHandler *m_parent; ParagraphHandler *m_paragraph; Types m_type; - QString m_typeString; + StringImpl m_typeString; TitleHandler *m_title; }; @@ -603,12 +606,12 @@ class VariableListEntryHandler : public DocVariableListEntryImpl, // IDocVariableListEntry virtual Kind kind() const { return DocImpl::VariableListEntry; } - virtual QString term() const { return m_term; } + virtual const IString *term() const { return &m_term; } virtual IDocPara *description() const { return m_description; } private: IBaseHandler *m_parent; - QString m_term; + StringImpl m_term; ParagraphHandler *m_description; }; @@ -710,7 +713,7 @@ class CodeLineHandler : public DocCodeLineImpl, public BaseHandler<CodeLineHandl // IDocCodeLine virtual Kind kind() const { return DocImpl::CodeLine; } virtual int lineNumber() const { return m_lineNumber; } - virtual QString refId() const { return m_refId; } + virtual const IString *refId() const { return &m_refId; } virtual IDocIterator *codeElements() const; private: @@ -718,7 +721,7 @@ class CodeLineHandler : public DocCodeLineImpl, public BaseHandler<CodeLineHandl IBaseHandler *m_parent; int m_lineNumber; - QString m_refId; + StringImpl m_refId; QList<DocImpl> m_children; }; @@ -782,13 +785,13 @@ class FormulaHandler : public DocFormulaImpl, public BaseHandler<FormulaHandler> // IDocFormula virtual Kind kind() const { return DocImpl::Formula; } - virtual QString id() const { return m_id; } - virtual QString text() const { return m_text; } + virtual const IString *id() const { return &m_id; } + virtual const IString *text() const { return &m_text; } private: IBaseHandler *m_parent; - QString m_id; - QString m_text; + StringImpl m_id; + StringImpl m_text; }; //----------------------------------------------------------------------------- @@ -807,13 +810,13 @@ class ImageHandler : public DocImageImpl, public BaseHandler<ImageHandler> // IDocImage virtual Kind kind() const { return DocImpl::Image; } - virtual QString name() const { return m_name; } - virtual QString caption() const { return m_caption; } + virtual const IString *name() const { return &m_name; } + virtual const IString *caption() const { return &m_caption; } private: IBaseHandler *m_parent; - QString m_name; - QString m_caption; + StringImpl m_name; + StringImpl m_caption; }; //----------------------------------------------------------------------------- @@ -832,13 +835,13 @@ class DotFileHandler : public DocDotFileImpl, public BaseHandler<DotFileHandler> // IDocDotFile virtual Kind kind() const { return DocImpl::DotFile; } - virtual QString name() const { return m_name; } - virtual QString caption() const { return m_caption; } + virtual const IString *name() const { return &m_name; } + virtual const IString *caption() const { return &m_caption; } private: IBaseHandler *m_parent; - QString m_name; - QString m_caption; + StringImpl m_name; + StringImpl m_caption; }; //----------------------------------------------------------------------------- @@ -861,13 +864,13 @@ class IndexEntryHandler : public DocIndexEntryImpl, public BaseHandler<IndexEntr // IDocIndexEntry virtual Kind kind() const { return DocImpl::IndexEntry; } - virtual QString primary() const { return m_primary; } - virtual QString secondary() const { return m_secondary; } + virtual const IString *primary() const { return &m_primary; } + virtual const IString *secondary() const { return &m_secondary; } private: IBaseHandler *m_parent; - QString m_primary; - QString m_secondary; + StringImpl m_primary; + StringImpl m_secondary; }; //----------------------------------------------------------------------------- @@ -956,13 +959,13 @@ class TableHandler : public DocTableImpl, public BaseHandler<TableHandler> 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; } + virtual const IString *caption() const { return &m_caption; } private: IBaseHandler *m_parent; QList<RowHandler> m_children; int m_numColumns; - QString m_caption; + StringImpl m_caption; }; class TableIterator : public BaseIteratorVia<IDocIterator,IDoc,RowHandler,DocImpl> @@ -995,7 +998,7 @@ class DocSectionHandler : public DocSectionImpl, public BaseHandler<DocSectionHa // IDocSection virtual Kind kind() const { return DocImpl::Section; } - virtual QString id() const { return m_id; } + virtual const IString *id() const { return &m_id; } virtual int level() const { return m_level; } virtual IDocIterator *title() const; @@ -1003,7 +1006,7 @@ class DocSectionHandler : public DocSectionImpl, public BaseHandler<DocSectionHa IBaseHandler *m_parent; QList<DocImpl> m_children; MarkupHandler *m_markupHandler; - QString m_id; + StringImpl m_id; int m_level; }; diff --git a/addon/doxmlparser/src/doxmlintf.h b/addon/doxmlparser/src/doxmlintf.h index 92d4e2d..becbe78 100644 --- a/addon/doxmlparser/src/doxmlintf.h +++ b/addon/doxmlparser/src/doxmlintf.h @@ -9,6 +9,15 @@ class ICompound; class ISection; class INode; +class IString +{ + public: + virtual const char *latin1() const = 0; + virtual unsigned short unicodeCharAt(int index) const = 0; + virtual bool isEmpty() const = 0; + virtual int length() const = 0; +}; + class ILinkedText { public: @@ -19,17 +28,17 @@ class ILinkedText class ILT_Text : public ILinkedText { public: - virtual QString text() const = 0; + virtual const IString *text() const = 0; }; class ILT_Ref : public ILinkedText { public: enum TargetKind { Member, Compound }; - virtual QString id() const = 0; + virtual const IString *id() const = 0; virtual TargetKind targetKind() const = 0; - virtual QString external() const = 0; - virtual QString text() const = 0; + virtual const IString *external() const = 0; + virtual const IString *text() const = 0; }; class ILinkedTextIterator @@ -47,10 +56,10 @@ class IParam { public: virtual ILinkedTextIterator *type() const = 0; - virtual QString declarationName() const = 0; - virtual QString definitionName() const = 0; - virtual QString attrib() const = 0; - virtual QString arraySpecifier() const = 0; + virtual const IString * declarationName() const = 0; + virtual const IString * definitionName() const = 0; + virtual const IString * attrib() const = 0; + virtual const IString * arraySpecifier() const = 0; virtual ILinkedTextIterator *defaultValue() const = 0; }; @@ -69,7 +78,7 @@ class IMemberReference { public: virtual IMember *member() const = 0; - virtual QString memberName() const = 0; + virtual const IString * memberName() const = 0; }; class IMemberReferenceIterator @@ -86,8 +95,8 @@ class IMemberReferenceIterator class IEnumValue { public: - virtual QString name() const = 0; - virtual QString initializer() const = 0; + virtual const IString * name() const = 0; + virtual const IString * initializer() const = 0; }; class IEnumValueIterator @@ -136,7 +145,7 @@ class IDoc Row, // 27 -> IDocRow Entry, // 28 -> IDocEntry Section, // 29 -> IDocSection - Root // 30 -> IDocRoot + Root, // 30 -> IDocRoot }; virtual Kind kind() const = 0; }; @@ -153,7 +162,8 @@ class IDocMarkup : public IDoc Subscript = 0x08, Superscript = 0x10, SmallFont = 0x20, - Center = 0x40 + Center = 0x40, + Preformatted = 0x80 }; }; @@ -167,7 +177,7 @@ class IDocPara : public IDoc class IDocText : public IDocMarkup { public: - virtual QString text() const = 0; + virtual const IString * text() const = 0; virtual int markup() const = 0; }; @@ -207,7 +217,7 @@ class IDocParameterList : public IDoc class IDocParameter : public IDoc { public: - virtual QString name() const = 0; + virtual const IString * name() const = 0; virtual IDocPara *description() const = 0; }; @@ -229,7 +239,7 @@ class IDocSimpleSect : public IDoc Examples }; virtual Types type() const = 0; - virtual QString typeString() const = 0; + virtual const IString * typeString() const = 0; virtual IDocTitle *title() const = 0; virtual IDocPara *description() const = 0; }; @@ -238,10 +248,10 @@ class IDocRef : public IDoc { public: enum TargetKind { Member, Compound }; - virtual QString refId() const = 0; + virtual const IString * refId() const = 0; virtual TargetKind targetKind() const = 0; - virtual QString external() const = 0; - virtual QString text() const = 0; + virtual const IString * external() const = 0; + virtual const IString * text() const = 0; }; class IDocVariableList : public IDoc @@ -253,7 +263,7 @@ class IDocVariableList : public IDoc class IDocVariableListEntry : public IDoc { public: - virtual QString term() const = 0; + virtual const IString * term() const = 0; virtual IDocPara *description() const = 0; }; @@ -268,21 +278,21 @@ class IDocLineBreak : public IDoc class IDocULink : public IDoc { public: - virtual QString url() const = 0; - virtual QString text() const = 0; + virtual const IString * url() const = 0; + virtual const IString * text() const = 0; }; class IDocEMail : public IDoc { public: - virtual QString address() const = 0; + virtual const IString * address() const = 0; }; class IDocLink : public IDoc { public: - virtual QString refId() const = 0; - virtual QString text() const = 0; + virtual const IString * refId() const = 0; + virtual const IString * text() const = 0; }; class IDocProgramListing : public IDoc @@ -295,7 +305,7 @@ class IDocCodeLine : public IDoc { public: virtual int lineNumber() const = 0; - virtual QString refId() const = 0; + virtual const IString * refId() const = 0; virtual IDocIterator *codeElements() const = 0; }; @@ -315,29 +325,29 @@ class IDocHighlight : public IDoc class IDocFormula : public IDoc { public: - virtual QString id() const = 0; - virtual QString text() const = 0; + virtual const IString * id() const = 0; + virtual const IString * text() const = 0; }; class IDocImage : public IDoc { public: - virtual QString name() const = 0; - virtual QString caption() const = 0; + virtual const IString * name() const = 0; + virtual const IString * caption() const = 0; }; class IDocDotFile : public IDoc { public: - virtual QString name() const = 0; - virtual QString caption() const = 0; + virtual const IString * name() const = 0; + virtual const IString * caption() const = 0; }; class IDocIndexEntry : public IDoc { public: - virtual QString primary() const = 0; - virtual QString secondary() const = 0; + virtual const IString * primary() const = 0; + virtual const IString * secondary() const = 0; }; class IDocTable : public IDoc @@ -345,7 +355,7 @@ class IDocTable : public IDoc public: virtual IDocIterator *rows() const = 0; virtual int numColumns() const = 0; - virtual QString caption() const = 0; + virtual const IString * caption() const = 0; }; class IDocRow : public IDoc @@ -363,7 +373,7 @@ class IDocEntry : public IDoc class IDocSection : public IDoc { public: - virtual QString id() const = 0; + virtual const IString * id() const = 0; virtual int level() const = 0; virtual IDocIterator *title() const = 0; }; @@ -388,7 +398,7 @@ class IDocIterator class IEdgeLabel { public: - virtual QString label() const = 0; + virtual const IString * label() const = 0; }; class IEdgeLabelIterator @@ -410,7 +420,7 @@ class IChildNode }; virtual INode * node() const = 0; virtual NodeRelation relation() const = 0; - virtual QString relationString() const = 0; + virtual const IString * relationString() const = 0; virtual IEdgeLabelIterator *edgeLabels() const = 0; }; @@ -428,9 +438,9 @@ class IChildNodeIterator class INode { public: - virtual QString id() const = 0; - virtual QString label() const = 0; - virtual QString linkId() const = 0; + virtual const IString * id() const = 0; + virtual const IString * label() const = 0; + virtual const IString * linkId() const = 0; virtual IChildNodeIterator *children() const = 0; }; @@ -461,13 +471,13 @@ class IMember virtual ICompound *compound() const = 0; virtual ISection *section() const = 0; virtual MemberKind kind() const = 0; - virtual QString kindString() const = 0; - virtual QString id() const = 0; - virtual QString protection() const = 0; - virtual QString virtualness() const = 0; + virtual const IString * kindString() const = 0; + virtual const IString * id() const = 0; + virtual const IString * protection() const = 0; + virtual const IString * virtualness() const = 0; virtual ILinkedTextIterator *type() const = 0; - virtual QString typeString() const = 0; - virtual QString name() const = 0; + virtual const IString * typeString() const = 0; + virtual const IString * name() const = 0; virtual bool isConst() const = 0; virtual bool isVolatile() const = 0; virtual IParamIterator *params() const = 0; @@ -477,7 +487,7 @@ class IMember virtual IMemberReferenceIterator *referencedBy() const = 0; virtual int bodyStart() const = 0; virtual int bodyEnd() const = 0; - virtual QString definitionFile() const = 0; + virtual const IString * definitionFile() const = 0; virtual int definitionLine() const = 0; virtual IMemberReference *reimplements() const = 0; virtual IMemberReferenceIterator *reimplementedBy() const = 0; @@ -512,7 +522,7 @@ class ISection Friend, Related, Defines, Prototypes, Typedefs, Enums, Functions, Variables }; - virtual QString kindString() const = 0; + virtual const IString * kindString() const = 0; virtual SectionKind kind() const = 0; virtual IMemberIterator *members() const = 0; virtual bool isStatic() const = 0; @@ -541,12 +551,12 @@ class ICompound Namespace, File, Group, Page }; /*! Returns the name of this compound */ - virtual QString name() const = 0; + virtual const IString * 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; + virtual const IString * id() const = 0; /*! Returns the kind of compound. See #CompoundKind for possible * values. @@ -556,7 +566,7 @@ class ICompound /*! Returns a string representation of the compound kind. * @see kind() */ - virtual QString kindString() const = 0; + virtual const IString * kindString() const = 0; /*! Returns an iterator for the different member sections in this * compound. @@ -576,14 +586,14 @@ class ICompound /*! Returns an interface to a member given its id. * @param id The member id. */ - virtual IMember *memberById(const QString &id) const = 0; + virtual IMember *memberById(const char * id) const = 0; /*! Returns a list of all members within the compound having a certain * 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; + virtual IMemberIterator *memberByName(const char * name) const = 0; /*! Decreases the reference counter for this compound. If it reaches * zero, the memory for the compound will be released. @@ -668,11 +678,13 @@ class INamespace : public ICompound class IFile : public ICompound { + public: + virtual IGraph *includeDependencyGraph() const = 0; + virtual IGraph *includedByDependencyGraph() const = 0; + // file: // includes() // includedBy() - // IDotGraph *includeDependencyGraph() - // IDotGraph *includedByDependencyGraph() // IDocProgramListing *source() // ICompound *innerNamespaces() // ICompoundIterator *innerClasses() @@ -704,26 +716,26 @@ class IDoxygen * compound id this function is much more efficient than iterating * over the compound list. Returns 0 if the id is not valid. */ - virtual ICompound *compoundById(const QString &id) const = 0; + virtual ICompound *compoundById(const char * id) const = 0; /*! Returns a compound given its name (including the scope). * Returns 0 if the name is not found in the project. */ - virtual ICompound *compoundByName(const QString &name) const = 0; + virtual ICompound *compoundByName(const char * name) const = 0; /*! Returns an interface to a compound containing a member given it the * member's id. Given the ICompound interface one can use the same id * to obtain the IMember interface. * @param id The member id. */ - virtual ICompound *memberById(const QString &id) const = 0; + virtual ICompound *memberById(const char * id) const = 0; /*! Returns a list of all compounds containing at least one members * with a certain name. Each compound can be asked to return the * list of members with that name. * @param name The name of the member. */ - virtual ICompoundIterator *memberByName(const QString &name) const = 0; + virtual ICompoundIterator *memberByName(const char * name) const = 0; /*! Releases the memory for the object hierarchy obtained by * createdObjecModelFromXML(). First release all iterators before calling diff --git a/addon/doxmlparser/src/doxmlparser.pro.in b/addon/doxmlparser/src/doxmlparser.pro.in index 1d05f5b..ddbe82a 100644 --- a/addon/doxmlparser/src/doxmlparser.pro.in +++ b/addon/doxmlparser/src/doxmlparser.pro.in @@ -4,7 +4,7 @@ HEADERS = basehandler.h mainhandler.h \ compoundhandler.h sectionhandler.h \ memberhandler.h paramhandler.h \ dochandler.h linkedtexthandler.h \ - debug.h graphhandler.h + debug.h graphhandler.h stringimpl.h SOURCES = mainhandler.cpp \ compoundhandler.cpp sectionhandler.cpp \ memberhandler.cpp paramhandler.cpp \ diff --git a/addon/doxmlparser/src/graphhandler.h b/addon/doxmlparser/src/graphhandler.h index ebcc352..891c3db 100644 --- a/addon/doxmlparser/src/graphhandler.h +++ b/addon/doxmlparser/src/graphhandler.h @@ -16,6 +16,7 @@ #ifndef _GRAPHHANDLER_H #define _GRAPHHANDLER_H +#include "stringimpl.h" #include "doxmlintf.h" #include "basehandler.h" #include "baseiterator.h" @@ -63,16 +64,16 @@ class NodeHandler : public INode, public BaseHandler<NodeHandler> void startChildNode(const QXmlAttributes &attrib); // INode - virtual QString id() const { return m_id; } - virtual QString label() const { return m_label; } - virtual QString linkId() const { return m_link; } + virtual const IString *id() const { return &m_id; } + virtual const IString *label() const { return &m_label; } + virtual const IString *linkId() const { return &m_link; } virtual IChildNodeIterator *children() const; private: IBaseHandler *m_parent; - QString m_id; - QString m_label; - QString m_link; + StringImpl m_id; + StringImpl m_label; + StringImpl m_link; QList<ChildNodeHandler> m_children; GraphHandler *m_graph; }; @@ -100,14 +101,14 @@ class ChildNodeHandler : public IChildNode, public BaseHandler<ChildNodeHandler> // IChildNode virtual INode *node() const; virtual NodeRelation relation() const { return m_relation; } - virtual QString relationString() const { return m_relationString; } + virtual const IString * relationString() const { return &m_relationString; } virtual IEdgeLabelIterator *edgeLabels() const; private: IBaseHandler *m_parent; QString m_id; NodeRelation m_relation; - QString m_relationString; + StringImpl m_relationString; QList<EdgeLabelHandler> m_edgeLabels; GraphHandler *m_graph; }; @@ -132,11 +133,11 @@ class EdgeLabelHandler : public IEdgeLabel, public BaseHandler<EdgeLabelHandler> void endEdgeLabel(); // IEdgeLabel - virtual QString label() const { return m_label; } + virtual const IString *label() const { return &m_label; } private: IBaseHandler *m_parent; - QString m_label; + StringImpl m_label; }; class EdgeLabelIterator : public BaseIterator<IEdgeLabelIterator,IEdgeLabel,EdgeLabelHandler> diff --git a/addon/doxmlparser/src/linkedtexthandler.cpp b/addon/doxmlparser/src/linkedtexthandler.cpp index 2eb170f..8633096 100644 --- a/addon/doxmlparser/src/linkedtexthandler.cpp +++ b/addon/doxmlparser/src/linkedtexthandler.cpp @@ -15,6 +15,7 @@ #include "linkedtexthandler.h" #include "debug.h" #include <doxmlintf.h> +#include "stringimpl.h" class LT_Text : public LinkedTextImpl, public ILT_Text { @@ -23,10 +24,10 @@ class LT_Text : public LinkedTextImpl, public ILT_Text virtual ~LT_Text() {} // ILT_Text - virtual QString text() const { return m_text; } - virtual Kind kind() const { return LinkedTextImpl::Kind_Text; } + virtual const IString *text() const { return &m_text; } + virtual Kind kind() const { return LinkedTextImpl::Kind_Text; } private: - QString m_text; + StringImpl m_text; }; class LT_Ref : public LinkedTextImpl, public ILT_Ref @@ -40,16 +41,16 @@ class LT_Ref : public LinkedTextImpl, public ILT_Ref void setTargetKind(TargetKind k) { m_targetKind=k; } // ILT_Ref - virtual QString text() const { return m_text; } - virtual QString id() const { return m_refId; } + virtual const IString *text() const { return &m_text; } + virtual const IString * id() const { return &m_refId; } virtual TargetKind targetKind() const { return m_targetKind; } - virtual QString external() const { return m_extId; } + virtual const IString *external() const { return &m_extId; } virtual Kind kind() const { return LinkedTextImpl::Kind_Ref; } private: - QString m_refId; - QString m_extId; - QString m_text; + StringImpl m_refId; + StringImpl m_extId; + StringImpl m_text; TargetKind m_targetKind; }; @@ -106,7 +107,7 @@ void LinkedTextHandler::endRef() { m_ref->setText(m_curString); m_children.append(m_ref); - debug(2,"LinkedTextHandler: add ref `%s'\n",m_ref->text().data()); + debug(2,"LinkedTextHandler: add ref `%s'\n",m_ref->text()->latin1()); m_ref=0; } @@ -120,10 +121,10 @@ QString LinkedTextHandler::toString(const QList<LinkedTextImpl> &list) switch(lt->kind()) { case ILinkedText::Kind_Text: - result+=dynamic_cast<ILT_Text*>(lt)->text(); + result+=dynamic_cast<ILT_Text*>(lt)->text()->latin1(); break; case ILinkedText::Kind_Ref: - result+=dynamic_cast<ILT_Ref *>(lt)->text(); + result+=dynamic_cast<ILT_Ref *>(lt)->text()->latin1(); break; } } diff --git a/addon/doxmlparser/src/mainhandler.cpp b/addon/doxmlparser/src/mainhandler.cpp index 99b1e2c..7a67c02 100644 --- a/addon/doxmlparser/src/mainhandler.cpp +++ b/addon/doxmlparser/src/mainhandler.cpp @@ -194,16 +194,17 @@ ICompoundIterator *MainHandler::compounds() const return new CompoundEntryIterator(this,m_compounds); } -ICompound *MainHandler::compoundById(const QString &id) const +ICompound *MainHandler::compoundById(const char *id) const { - if (id.isEmpty()) return 0; - CompoundHandler *ch = m_compoundsLoaded[id]; + QString ids = id; + if (ids.isEmpty()) return 0; + CompoundHandler *ch = m_compoundsLoaded[ids]; if (ch) // compound already in memory { ch->addref(); // returning alias -> increase reference counter return ch->toICompound(); } - CompoundEntry *ce = m_compoundDict.find(id); + CompoundEntry *ce = m_compoundDict.find(ids); if (ce==0) return 0; // id not found // create and load a new compound ch = new CompoundHandler(m_xmlDirName); @@ -224,28 +225,31 @@ ICompound *MainHandler::compoundById(const QString &id) const void MainHandler::unloadCompound(CompoundHandler *ch) { - m_compoundsLoaded.remove(ch->id()); + m_compoundsLoaded.remove(ch->id()->latin1()); } -ICompound *MainHandler::compoundByName(const QString &name) const +ICompound *MainHandler::compoundByName(const char *name) const { - if (name.isEmpty()) return 0; + QString nameStr = name; + if (nameStr.isEmpty()) return 0; CompoundEntry *ce = m_compoundNameDict[name]; if (ce==0) return 0; // name not found return compoundById(ce->id); } -ICompound *MainHandler::memberById(const QString &id) const +ICompound *MainHandler::memberById(const char *id) const { - if (id.isEmpty()) return 0; + QString ids = id; + if (ids.isEmpty()) return 0; MemberEntry *me = m_memberDict[id]; if (me==0) return 0; // id not found return compoundById(me->id); } -ICompoundIterator *MainHandler::memberByName(const QString &name) const +ICompoundIterator *MainHandler::memberByName(const char *name) const { - if (name.isEmpty()) return 0; + QString nameStr = name; + if (nameStr.isEmpty()) return 0; QList<CompoundEntry> *cel = m_memberNameDict[name]; if (cel==0) return 0; // name not found return new CompoundEntryIterator(this,*cel); @@ -267,7 +271,7 @@ void MainHandler::release() CompoundHandler *ch; for (chi.toFirst();(ch=chi.current());++chi) { - debug(1,"Compound %s not released\n",ch->name().data()); + debug(1,"Compound %s not released\n",ch->name()->latin1()); } graphhandler_exit(); dochandler_exit(); diff --git a/addon/doxmlparser/src/mainhandler.h b/addon/doxmlparser/src/mainhandler.h index da7fe75..a0cef10 100644 --- a/addon/doxmlparser/src/mainhandler.h +++ b/addon/doxmlparser/src/mainhandler.h @@ -55,10 +55,10 @@ class MainHandler : public IDoxygen, public BaseHandler<MainHandler> // IDoxygen ICompoundIterator *compounds() const; - ICompound *compoundById(const QString &id) const; - virtual ICompound *compoundByName(const QString &name) const; - virtual ICompound *memberById(const QString &id) const; - virtual ICompoundIterator *memberByName(const QString &name) const; + ICompound *compoundById(const char *id) const; + virtual ICompound *compoundByName(const char *name) const; + virtual ICompound *memberById(const char *id) const; + virtual ICompoundIterator *memberByName(const char *name) const; virtual void release(); void setDebugLevel(int level); diff --git a/addon/doxmlparser/src/memberhandler.h b/addon/doxmlparser/src/memberhandler.h index 2807ae0..f95fa58 100644 --- a/addon/doxmlparser/src/memberhandler.h +++ b/addon/doxmlparser/src/memberhandler.h @@ -35,11 +35,11 @@ struct MemberReference : public IMemberReference { virtual ~MemberReference() {} virtual IMember *member() const; - virtual QString memberName() const { return m_name; } + virtual const IString *memberName() const { return &m_name; } void initialize(MainHandler *m); - QString m_memId; - QString m_name; + QString m_memId; + StringImpl m_name; MainHandler *m_mainHandler; }; @@ -61,8 +61,8 @@ class EnumValueHandler : public IEnumValue, public BaseHandler<EnumValueHandler> virtual void endEnumValue(); // IEnumValue - virtual QString name() const { return m_name; } - virtual QString initializer() const { return m_initializer; } + virtual const IString *name() const { return &m_name; } + virtual const IString *initializer() const { return &m_initializer; } void setName(const QString &name) { m_name=name; } void setInitializer(const QString &init) { m_initializer=init; } @@ -71,8 +71,8 @@ class EnumValueHandler : public IEnumValue, public BaseHandler<EnumValueHandler> EnumValueHandler(IBaseHandler *parent); private: - QString m_name; - QString m_initializer; + StringImpl m_name; + StringImpl m_initializer; IBaseHandler *m_parent; }; @@ -115,24 +115,27 @@ class MemberHandler : public IMember, public BaseHandler<MemberHandler> virtual ISection *section() const; virtual MemberKind kind() const { return m_kind; } - virtual QString kindString() const - { return m_kindString; } - virtual QString id() const - { return m_id; } - virtual QString protection() const - { return m_protection; } - virtual QString virtualness() const - { return m_virtualness; } - virtual QString name() const - { return m_name; } + virtual const IString *kindString() const + { return &m_kindString; } + virtual const IString *id() const + { return &m_id; } + virtual const IString *protection() const + { return &m_protection; } + virtual const IString *virtualness() const + { return &m_virtualness; } + virtual const IString *name() const + { return &m_name; } virtual bool isConst() const { return m_isConst; } virtual bool isVolatile() const { return m_isVolatile; } virtual ILinkedTextIterator *type() const { return new LinkedTextIterator(m_type); } - virtual QString typeString() const - { return LinkedTextHandler::toString(m_type); } + virtual const IString *typeString() const + { MemberHandler *that = (MemberHandler *)this; + that->m_typeString = LinkedTextHandler::toString(m_type); + return &m_typeString; + } virtual IParamIterator *params() const { return new ParamIterator(m_params); } virtual IMemberReferenceIterator *references() const @@ -147,8 +150,8 @@ class MemberHandler : public IMember, public BaseHandler<MemberHandler> { return m_bodyStart; } virtual int bodyEnd() const { return m_bodyEnd; } - virtual QString definitionFile() const - { return m_defFile; } + virtual const IString *definitionFile() const + { return &m_defFile; } virtual int definitionLine() const { return m_defLine; } virtual IMemberReference *reimplements() const @@ -171,14 +174,15 @@ class MemberHandler : public IMember, public BaseHandler<MemberHandler> CompoundHandler *m_compound; SectionHandler *m_section; MemberKind m_kind; - QString m_kindString; - QString m_id; - QString m_protection; - QString m_virtualness; + StringImpl m_kindString; + StringImpl m_id; + StringImpl m_protection; + StringImpl m_virtualness; + StringImpl m_typeString; QList<LinkedTextImpl> m_type; QList<LinkedTextImpl> m_initializer; QList<LinkedTextImpl> m_exception; - QString m_name; + StringImpl m_name; DocHandler *m_brief; DocHandler *m_detailed; QList<ParamHandler> m_params; @@ -186,7 +190,7 @@ class MemberHandler : public IMember, public BaseHandler<MemberHandler> QList<MemberReference> m_referencedBy; MemberReference *m_reimplements; QList<MemberReference> m_reimplementedBy; - QString m_defFile; + StringImpl m_defFile; int m_defLine; int m_bodyStart; int m_bodyEnd; diff --git a/addon/doxmlparser/src/paramhandler.h b/addon/doxmlparser/src/paramhandler.h index 520034a..0ab52d9 100644 --- a/addon/doxmlparser/src/paramhandler.h +++ b/addon/doxmlparser/src/paramhandler.h @@ -21,6 +21,7 @@ #include <qxml.h> #include <doxmlintf.h> +#include "stringimpl.h" #include "basehandler.h" #include "baseiterator.h" #include "linkedtexthandler.h" @@ -43,20 +44,20 @@ class ParamHandler : public IParam, public BaseHandler<ParamHandler> // IParam virtual ILinkedTextIterator *type() const { return new LinkedTextIterator(m_type); } - virtual QString declarationName() const { return m_declName; } - virtual QString definitionName() const { return m_defName; } - virtual QString attrib() const { return m_attrib; } - virtual QString arraySpecifier() const { return m_array; } + virtual const IString * declarationName() const { return &m_declName; } + virtual const IString * definitionName() const { return &m_defName; } + virtual const IString * attrib() const { return &m_attrib; } + virtual const IString * arraySpecifier() const { return &m_array; } virtual ILinkedTextIterator *defaultValue() const { return new LinkedTextIterator(m_defVal); } private: IBaseHandler *m_parent; QList<LinkedTextImpl> m_type; - QString m_declName; - QString m_defName; - QString m_attrib; - QString m_array; + StringImpl m_declName; + StringImpl m_defName; + StringImpl m_attrib; + StringImpl m_array; QList<LinkedTextImpl> m_defVal; LinkedTextHandler *m_linkedTextHandler; }; diff --git a/addon/doxmlparser/src/sectionhandler.h b/addon/doxmlparser/src/sectionhandler.h index 71a5973..9ecc85e 100644 --- a/addon/doxmlparser/src/sectionhandler.h +++ b/addon/doxmlparser/src/sectionhandler.h @@ -46,8 +46,8 @@ class SectionHandler : public ISection, public BaseHandler<SectionHandler> virtual ~SectionHandler(); // ISection - virtual QString kindString() const - { return m_kindString; } + virtual const IString *kindString() const + { return &m_kindString; } virtual SectionKind kind() const { return m_kind; } virtual IMemberIterator *members() const @@ -78,7 +78,7 @@ class SectionHandler : public ISection, public BaseHandler<SectionHandler> private: IBaseHandler *m_parent; SectionKind m_kind; - QString m_kindString; + StringImpl m_kindString; QList<MemberHandler> m_members; }; diff --git a/addon/doxmlparser/src/stringimpl.h b/addon/doxmlparser/src/stringimpl.h new file mode 100644 index 0000000..017a0b6 --- /dev/null +++ b/addon/doxmlparser/src/stringimpl.h @@ -0,0 +1,26 @@ +#ifndef STRINGIMPL_H +#define STRINGIMPL_H + +#include <qstring.h> +#include "doxmlintf.h" + +class StringImpl : public QString, public IString +{ + public: + StringImpl() {} + StringImpl(const QString &str) : QString(str) {} + virtual ~StringImpl() {} + + // IString + const char *latin1() const + { return QString::latin1(); } + unsigned short unicodeCharAt(int index) const + { return QString::unicode()[index].unicode(); } + bool isEmpty() const + { return QString::isEmpty(); } + int length() const + { return QString::length(); } +}; + +#endif + |