diff options
Diffstat (limited to 'addon/doxmlparser/src/graphhandler.cpp')
-rw-r--r-- | addon/doxmlparser/src/graphhandler.cpp | 110 |
1 files changed, 110 insertions, 0 deletions
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); +} + |