graphhandler.cpp
Go to the documentation of this file.
1 #include "graphhandler.h"
2 
4 {
5  public:
7  {
8  m_map.insert("public-inheritance", IChildNode::PublicInheritance);
9  m_map.insert("protected-inheritance", IChildNode::ProtectedInheritance);
10  m_map.insert("private-inheritance", IChildNode::PrivateInheritance);
11  m_map.insert("usage", IChildNode::Usage);
12  m_map.insert("template-instance", IChildNode::TemplateInstance);
13  }
15  {
16  return m_map[nrStr];
17  }
18  private:
20 };
21 
23 
25 {
26  s_edgeRelationMapper = new EdgeRelationMapper;
27 }
28 
30 {
31  delete s_edgeRelationMapper;
32 }
33 
34 //------------------------------------------------------------------------
35 
37  : m_parent(parent)
38 {
42  m_nodeDict = new QDict<NodeHandler>(1009);
43 }
44 
46 {
47  delete m_nodeDict;
48 }
49 
51 {
52  debug(2,"startGraph\n");
53  m_parent->setDelegate(this);
54 }
55 
57 {
58  debug(2,"endGraph\n");
60 }
61 
63 {
64  NodeHandler *n = new NodeHandler(this);
65  n->startNode(attrib);
66  m_nodes.append(n);
67  m_nodeDict->insert(attrib.value("id").utf8(),n);
68 }
69 
71 {
72  return new NodeIterator(*this);
73 }
74 
76 {
77  return m_nodeDict->find(id.utf8());
78 }
79 
80 //------------------------------------------------------------------------
81 
83  : m_parent(gh), m_graph(gh)
84 {
85  addEndHandler("node",this,&NodeHandler::endNode);
87  addEndHandler("link",this,&NodeHandler::endLink);
89  addEndHandler("label",this,&NodeHandler::endLabel);
92 }
93 
95 {
96 }
97 
99 {
100  debug(2,"startNode\n");
101  m_parent->setDelegate(this);
102  m_id = attrib.value("id");
103 }
104 
106 {
107  debug(2,"endNode\n");
108  m_parent->setDelegate(0);
109 }
110 
112 {
113  m_link = attrib.value("refid");
114 }
115 
117 {
118 }
119 
121 {
122  m_curString="";
123 }
124 
126 {
128 }
129 
131 {
132  ChildNodeHandler *cnh = new ChildNodeHandler(this,m_graph);
133  cnh->startChildNode(attrib);
134  m_children.append(cnh);
135 }
136 
138 {
139  return new ChildNodeIterator(*this);
140 }
141 
142 //------------------------------------------------------------------------
143 
145  : m_parent(parent), m_graph(gh)
146 {
150 }
151 
153 {
154 }
155 
157 {
158  debug(2,"startChildNode\n");
159  m_id = attrib.value("refid");
160  m_relationString = attrib.value("relation");
161  m_relation = s_edgeRelationMapper->stringToNodeRelation(m_relationString);
162  m_parent->setDelegate(this);
163 }
164 
166 {
167  debug(2,"endChildNode\n");
168  m_parent->setDelegate(0);
169 }
170 
171 
173 {
174  EdgeLabelHandler *elh = new EdgeLabelHandler(this);
175  elh->startEdgeLabel(attrib);
176  m_edgeLabels.append(elh);
177 }
178 
180 {
181  return new EdgeLabelIterator(*this);
182 }
183 
185 {
186  return m_graph->getNodeById(m_id);
187 }
188 
189 //-----------------------------------------------------------------------
190 
192  : m_parent(parent)
193 {
195 }
196 
198 {
199 }
200 
202 {
203  m_parent->setDelegate(this);
204  m_curString="";
205 }
206 
208 {
210  m_parent->setDelegate(0);
211 }
212 
213 
214 
215 
216 
friend class ChildNodeIterator
Definition: graphhandler.h:53
void startLabel(const QXmlAttributes &attrib)
virtual ~EdgeLabelHandler()
NodeHandler * getNodeById(const QString &id) const
GraphHandler(IBaseHandler *parent, const char *endTag)
IBaseHandler * m_parent
Definition: graphhandler.h:139
void append(const type *d)
Definition: qlist.h:73
virtual IEdgeLabelIterator * edgeLabels() const
GraphHandler * m_graph
Definition: graphhandler.h:113
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
QList< EdgeLabelHandler > m_edgeLabels
Definition: graphhandler.h:112
StringImpl m_label
Definition: graphhandler.h:75
IChildNode::NodeRelation stringToNodeRelation(const QString &nrStr)
QString value(int index) const
Definition: qxml.cpp:664
void startChildNode(const QXmlAttributes &attrib)
void startGraph(const QXmlAttributes &attrib)
virtual IChildNodeIterator * children() const
void startEdgeLabel(const QXmlAttributes &attrib)
void graphhandler_init()
void startNode(const QXmlAttributes &attrib)
GraphHandler * m_graph
Definition: graphhandler.h:78
virtual ~ChildNodeHandler()
void startEdgeLabel(const QXmlAttributes &attrib)
virtual INode * node() const
QList< ChildNodeHandler > m_children
Definition: graphhandler.h:77
Iterator insert(const Key &key, const T &value)
Definition: qmap.h:545
StringImpl m_link
Definition: graphhandler.h:76
std::void_t< T > n
virtual void setDelegate(QXmlDefaultHandler *delegate)=0
NodeRelation m_relation
Definition: graphhandler.h:110
void startLink(const QXmlAttributes &attrib)
QList< NodeHandler > m_nodes
Definition: graphhandler.h:45
void startNode(const QXmlAttributes &attrib)
virtual ~GraphHandler()
NodeHandler(GraphHandler *gh)
IBaseHandler * m_parent
Definition: graphhandler.h:73
void startChildNode(const QXmlAttributes &attrib)
QMap< QString, IChildNode::NodeRelation > m_map
ChildNodeHandler(IBaseHandler *parent, GraphHandler *gh)
QDict< NodeHandler > * m_nodeDict
Definition: graphhandler.h:46
The QXmlAttributes class provides XML attributes.
Definition: qxml.h:128
IBaseHandler * m_parent
Definition: graphhandler.h:108
StringImpl m_label
Definition: graphhandler.h:140
void addStartHandler(const char *key)
Definition: basehandler.h:91
StringImpl m_id
Definition: graphhandler.h:74
virtual INodeIterator * nodes() const
IBaseHandler * m_parent
Definition: graphhandler.h:44
friend class NodeIterator
Definition: graphhandler.h:30
virtual ~NodeHandler()
void graphhandler_exit()
EdgeLabelHandler(IBaseHandler *parent)
QCString utf8() const
Definition: qstring.cpp:14507
void setAutoDelete(bool enable)
Definition: qlist.h:99
def parent(G, child, parent_type)
Definition: graph.py:67
const bool TRUE
Definition: qglobal.h:371
StringImpl m_relationString
Definition: graphhandler.h:111
void addEndHandler(const char *key)
Definition: basehandler.h:101
friend class EdgeLabelIterator
Definition: graphhandler.h:92
static EdgeRelationMapper * s_edgeRelationMapper