diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2002-03-24 20:06:51 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2002-03-24 20:06:51 (GMT) |
commit | a633d7976dbe31f1499efa59ae27ce75ff7015d7 (patch) | |
tree | 797740a23dd652f609fa100db4f0c862df4692ed /addon/doxmlparser/src | |
parent | 40c0613db241b9015265b2b9f3673e0c7869d3c2 (diff) | |
download | Doxygen-a633d7976dbe31f1499efa59ae27ce75ff7015d7.zip Doxygen-a633d7976dbe31f1499efa59ae27ce75ff7015d7.tar.gz Doxygen-a633d7976dbe31f1499efa59ae27ce75ff7015d7.tar.bz2 |
Release-1.2.14-20020324
Diffstat (limited to 'addon/doxmlparser/src')
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.cpp | 12 | ||||
-rw-r--r-- | addon/doxmlparser/src/compoundhandler.h | 2 | ||||
-rw-r--r-- | addon/doxmlparser/src/doxmlintf.h | 7 | ||||
-rw-r--r-- | addon/doxmlparser/src/graphhandler.cpp | 110 | ||||
-rw-r--r-- | addon/doxmlparser/src/graphhandler.h | 43 | ||||
-rw-r--r-- | addon/doxmlparser/src/mainhandler.cpp | 3 |
6 files changed, 172 insertions, 5 deletions
diff --git a/addon/doxmlparser/src/compoundhandler.cpp b/addon/doxmlparser/src/compoundhandler.cpp index caca36b..2873da5 100644 --- a/addon/doxmlparser/src/compoundhandler.cpp +++ b/addon/doxmlparser/src/compoundhandler.cpp @@ -98,7 +98,7 @@ 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_mainHandler(0), m_inheritanceGraph(0), m_collaborationGraph(0) { m_superClasses.setAutoDelete(TRUE); m_subClasses.setAutoDelete(TRUE); @@ -311,3 +311,13 @@ IMember *CompoundHandler::memberById(const QString &id) const return m_memberDict[id]; } +IGraph *CompoundHandler::inheritanceGraph() const +{ + return m_inheritanceGraph; +} + +IGraph *CompoundHandler::collaborationGraph() const +{ + return m_collaborationGraph; +} + diff --git a/addon/doxmlparser/src/compoundhandler.h b/addon/doxmlparser/src/compoundhandler.h index 1639487..c90b466 100644 --- a/addon/doxmlparser/src/compoundhandler.h +++ b/addon/doxmlparser/src/compoundhandler.h @@ -60,6 +60,8 @@ class CompoundHandler : public ICompound, public BaseHandler<CompoundHandler> ISectionIterator *sections() const; IDocRoot *briefDescription() const; IDocRoot *detailedDescription() const; + IGraph *inheritanceGraph() const; + IGraph *collaborationGraph() const; IMember *memberById(const QString &id) const; IMemberIterator *memberByName(const QString &name) const; void release(); diff --git a/addon/doxmlparser/src/doxmlintf.h b/addon/doxmlparser/src/doxmlintf.h index 89e567d..880df30 100644 --- a/addon/doxmlparser/src/doxmlintf.h +++ b/addon/doxmlparser/src/doxmlintf.h @@ -391,7 +391,7 @@ class IDocIterator class IEdgeLabel { public: - virtual QString label() = 0; + virtual QString label() const = 0; }; class IEdgeLabelIterator @@ -409,10 +409,11 @@ class IChildNode { public: enum NodeRelation { PublicInheritance, ProtectedInheritance, - PrivateInheritance, Usage, TemplateInstace + PrivateInheritance, Usage, TemplateInstance }; virtual QString id() const = 0; virtual NodeRelation relation() const = 0; + virtual QString relationString() const = 0; virtual IEdgeLabelIterator *edgeLabels() const = 0; }; @@ -551,6 +552,8 @@ class ICompound virtual ISectionIterator *sections() const = 0; virtual IDocRoot *briefDescription() const = 0; virtual IDocRoot *detailedDescription() const = 0; + virtual IGraph *inheritanceGraph() const = 0; + virtual IGraph *collaborationGraph() const = 0; /*! Returns an interface to a member given its id. * @param id The member id. diff --git a/addon/doxmlparser/src/graphhandler.cpp b/addon/doxmlparser/src/graphhandler.cpp index 9c822de..0e47f10 100644 --- a/addon/doxmlparser/src/graphhandler.cpp +++ b/addon/doxmlparser/src/graphhandler.cpp @@ -1,5 +1,38 @@ #include "graphhandler.h" +class EdgeRelationMapper +{ + public: + EdgeRelationMapper() + { + m_map.insert("public-inheritance", IChildNode::PublicInheritance); + m_map.insert("protected-inheritance", IChildNode::ProtectedInheritance); + m_map.insert("private-inheritance", IChildNode::PrivateInheritance); + m_map.insert("usage", IChildNode::Usage); + m_map.insert("template-instance", IChildNode::TemplateInstance); + } + IChildNode::NodeRelation stringToNodeRelation(const QString &nrStr) + { + return m_map[nrStr]; + } + private: + QMap<QString,IChildNode::NodeRelation> m_map; +}; + +static EdgeRelationMapper *s_edgeRelationMapper; + +void graphhandler_init() +{ + s_edgeRelationMapper = new EdgeRelationMapper; +} + +void graphhandler_exit() +{ + delete s_edgeRelationMapper; +} + +//------------------------------------------------------------------------ + GraphHandler::GraphHandler(IBaseHandler *parent,const char *endTag) : m_parent(parent) { @@ -44,6 +77,8 @@ NodeHandler::NodeHandler(IBaseHandler *parent) addEndHandler("link",this,&NodeHandler::endLink); addStartHandler("label",this,&NodeHandler::startLabel); addEndHandler("label",this,&NodeHandler::endLabel); + addStartHandler("childnode",this,&NodeHandler::startChildNode); + m_children.setAutoDelete(TRUE); } NodeHandler::~NodeHandler() @@ -80,6 +115,81 @@ void NodeHandler::endLabel() m_label = m_curString; } +void NodeHandler::startChildNode(const QXmlAttributes &attrib) +{ + ChildNodeHandler *cnh = new ChildNodeHandler(this); + cnh->startChildNode(attrib); + m_children.append(cnh); +} + +IChildNodeIterator *NodeHandler::children() const +{ + return new ChildNodeIterator(*this); +} + +//------------------------------------------------------------------------ + +ChildNodeHandler::ChildNodeHandler(IBaseHandler *parent) + : m_parent(parent) +{ + addStartHandler("edgelabel",this,&ChildNodeHandler::startEdgeLabel); + m_edgeLabels.setAutoDelete(TRUE); +} + +ChildNodeHandler::~ChildNodeHandler() +{ +} + +void ChildNodeHandler::startChildNode(const QXmlAttributes &attrib) +{ + m_id = attrib.value("id"); + m_relationString = attrib.value("relation"); + m_relation = s_edgeRelationMapper->stringToNodeRelation(m_relationString); + m_parent->setDelegate(this); +} + +void ChildNodeHandler::endChildNode() +{ + m_parent->setDelegate(0); +} + + +void ChildNodeHandler::startEdgeLabel(const QXmlAttributes &attrib) +{ + EdgeLabelHandler *elh = new EdgeLabelHandler(this); + elh->startEdgeLabel(attrib); + m_edgeLabels.append(elh); +} + +IEdgeLabelIterator *ChildNodeHandler::edgeLabels() const +{ + return new EdgeLabelIterator(*this); +} + + +//----------------------------------------------------------------------- + +EdgeLabelHandler::EdgeLabelHandler(IBaseHandler *parent) + : m_parent(parent) +{ +} + +EdgeLabelHandler::~EdgeLabelHandler() +{ +} + +void EdgeLabelHandler::startEdgeLabel(const QXmlAttributes &) +{ + m_parent->setDelegate(this); + m_curString=""; +} + +void EdgeLabelHandler::endEdgeLabel() +{ + m_label=m_curString; + m_parent->setDelegate(0); +} + diff --git a/addon/doxmlparser/src/graphhandler.h b/addon/doxmlparser/src/graphhandler.h index 47222d1..d9e0ae4 100644 --- a/addon/doxmlparser/src/graphhandler.h +++ b/addon/doxmlparser/src/graphhandler.h @@ -22,6 +22,7 @@ class NodeHandler; class ChildNodeHandler; +class EdgeLabelHandler; class GraphHandler : public IGraph, public BaseHandler<GraphHandler> { @@ -57,12 +58,13 @@ class NodeHandler : public INode, public BaseHandler<NodeHandler> void endLabel(); void startLink(const QXmlAttributes &attrib); void endLink(); + 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 IChildNodeIterator *children() const { return 0; } // TODO: implement + virtual IChildNodeIterator *children() const; private: IBaseHandler *m_parent; @@ -83,19 +85,27 @@ class NodeIterator : public BaseIterator<INodeIterator,INode,NodeHandler> class ChildNodeHandler : public IChildNode, public BaseHandler<ChildNodeHandler> { + friend class EdgeLabelIterator; public: ChildNodeHandler(IBaseHandler *parent); virtual ~ChildNodeHandler(); void startChildNode(const QXmlAttributes &attrib); void endChildNode(); + void startEdgeLabel(const QXmlAttributes &attrib); // IChildNode virtual QString id() const { return m_id; } + virtual NodeRelation relation() const { return m_relation; } + virtual QString relationString() const { return m_relationString; } + virtual IEdgeLabelIterator *edgeLabels() const; private: IBaseHandler *m_parent; - QString m_id; + QString m_id; + NodeRelation m_relation; + QString m_relationString; + QList<EdgeLabelHandler> m_edgeLabels; }; class ChildNodeIterator : public BaseIterator<IChildNodeIterator,IChildNode,ChildNodeHandler> @@ -105,6 +115,35 @@ class ChildNodeIterator : public BaseIterator<IChildNodeIterator,IChildNode,Chil BaseIterator<IChildNodeIterator,IChildNode,ChildNodeHandler>(handler.m_children) {} }; +//---------------------------------------------------------------------- + +class EdgeLabelHandler : public IEdgeLabel, public BaseHandler<EdgeLabelHandler> +{ + friend class EdgeLabelIterator; + public: + EdgeLabelHandler(IBaseHandler *parent); + virtual ~EdgeLabelHandler(); + + void startEdgeLabel(const QXmlAttributes &attrib); + void endEdgeLabel(); + + // IEdgeLabel + virtual QString label() const { return m_label; } + + private: + IBaseHandler *m_parent; + QString m_label; +}; + +class EdgeLabelIterator : public BaseIterator<IEdgeLabelIterator,IEdgeLabel,EdgeLabelHandler> +{ + public: + EdgeLabelIterator(const ChildNodeHandler &handler) : + BaseIterator<IEdgeLabelIterator,IEdgeLabel,EdgeLabelHandler>(handler.m_edgeLabels) {} +}; + +void graphhandler_init(); +void graphhandler_exit(); #endif diff --git a/addon/doxmlparser/src/mainhandler.cpp b/addon/doxmlparser/src/mainhandler.cpp index 98249ee..aa54cda 100644 --- a/addon/doxmlparser/src/mainhandler.cpp +++ b/addon/doxmlparser/src/mainhandler.cpp @@ -17,6 +17,7 @@ #include "mainhandler.h" #include "compoundhandler.h" #include "sectionhandler.h" +#include "graphhandler.h" #include "debug.h" class ErrorHandler : public QXmlErrorHandler @@ -256,6 +257,7 @@ IDoxygen *createObjectModel() sectionhandler_init(); memberhandler_init(); dochandler_init(); + graphhandler_init(); return new MainHandler; } @@ -267,6 +269,7 @@ void MainHandler::release() { debug(1,"Compound %s not released\n",ch->name().data()); } + graphhandler_exit(); dochandler_exit(); memberhandler_exit(); sectionhandler_exit(); |