Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/util/doxygen/addon/doxmlparser/src/graphhandler.h

Source at commit 1322 created 9 years 5 months ago.
By meklort, Add doxygen to utils folder
1/******************************************************************************
2 *
3 * $Id:$
4 *
5 *
6 * Copyright (C) 1997-2006 by Dimitri van Heesch.
7 *
8 * Permission to use, copy, modify, and distribute this software and its
9 * documentation under the terms of the GNU General Public License is hereby
10 * granted. No representations are made about the suitability of this software
11 * for any purpose. It is provided "as is" without express or implied warranty.
12 * See the GNU General Public License for more details.
13 *
14 */
15
16#ifndef _GRAPHHANDLER_H
17#define _GRAPHHANDLER_H
18
19#include "stringimpl.h"
20#include "doxmlintf.h"
21#include "basehandler.h"
22#include "baseiterator.h"
23
24class NodeHandler;
25class ChildNodeHandler;
26class EdgeLabelHandler;
27
28class GraphHandler : public IGraph, public BaseHandler<GraphHandler>
29{
30 friend class NodeIterator;
31 public:
32 GraphHandler(IBaseHandler *parent,const char *endTag);
33 virtual ~GraphHandler();
34
35 void startGraph(const QXmlAttributes &attrib);
36 void endGraph();
37 void startNode(const QXmlAttributes &attrib);
38 NodeHandler *getNodeById(const QString &id) const;
39
40 // IGraph
41 virtual INodeIterator *nodes() const;
42
43 private:
44 IBaseHandler *m_parent;
45 QList<NodeHandler> m_nodes;
46 QDict<NodeHandler> *m_nodeDict;
47};
48
49//----------------------------------------------------------------------
50
51class NodeHandler : public INode, public BaseHandler<NodeHandler>
52{
53 friend class ChildNodeIterator;
54 public:
55 NodeHandler(GraphHandler *gh);
56 virtual ~NodeHandler();
57
58 void startNode(const QXmlAttributes &attrib);
59 void endNode();
60 void startLabel(const QXmlAttributes &attrib);
61 void endLabel();
62 void startLink(const QXmlAttributes &attrib);
63 void endLink();
64 void startChildNode(const QXmlAttributes &attrib);
65
66 // INode
67 virtual const IString *id() const { return &m_id; }
68 virtual const IString *label() const { return &m_label; }
69 virtual const IString *linkId() const { return &m_link; }
70 virtual IChildNodeIterator *children() const;
71
72 private:
73 IBaseHandler *m_parent;
74 StringImpl m_id;
75 StringImpl m_label;
76 StringImpl m_link;
77 QList<ChildNodeHandler> m_children;
78 GraphHandler *m_graph;
79};
80
81class NodeIterator : public BaseIterator<INodeIterator,INode,NodeHandler>
82{
83 public:
84 NodeIterator(const GraphHandler &handler) :
85 BaseIterator<INodeIterator,INode,NodeHandler>(handler.m_nodes) {}
86};
87
88//----------------------------------------------------------------------
89
90class ChildNodeHandler : public IChildNode, public BaseHandler<ChildNodeHandler>
91{
92 friend class EdgeLabelIterator;
93 public:
94 ChildNodeHandler(IBaseHandler *parent,GraphHandler *gh);
95 virtual ~ChildNodeHandler();
96
97 void startChildNode(const QXmlAttributes &attrib);
98 void endChildNode();
99 void startEdgeLabel(const QXmlAttributes &attrib);
100
101 // IChildNode
102 virtual INode *node() const;
103 virtual NodeRelation relation() const { return m_relation; }
104 virtual const IString * relationString() const { return &m_relationString; }
105 virtual IEdgeLabelIterator *edgeLabels() const;
106
107 private:
108 IBaseHandler *m_parent;
109 QString m_id;
110 NodeRelation m_relation;
111 StringImpl m_relationString;
112 QList<EdgeLabelHandler> m_edgeLabels;
113 GraphHandler *m_graph;
114};
115
116class ChildNodeIterator : public BaseIterator<IChildNodeIterator,IChildNode,ChildNodeHandler>
117{
118 public:
119 ChildNodeIterator(const NodeHandler &handler) :
120 BaseIterator<IChildNodeIterator,IChildNode,ChildNodeHandler>(handler.m_children) {}
121};
122
123//----------------------------------------------------------------------
124
125class EdgeLabelHandler : public IEdgeLabel, public BaseHandler<EdgeLabelHandler>
126{
127 friend class EdgeLabelIterator;
128 public:
129 EdgeLabelHandler(IBaseHandler *parent);
130 virtual ~EdgeLabelHandler();
131
132 void startEdgeLabel(const QXmlAttributes &attrib);
133 void endEdgeLabel();
134
135 // IEdgeLabel
136 virtual const IString *label() const { return &m_label; }
137
138 private:
139 IBaseHandler *m_parent;
140 StringImpl m_label;
141};
142
143class EdgeLabelIterator : public BaseIterator<IEdgeLabelIterator,IEdgeLabel,EdgeLabelHandler>
144{
145 public:
146 EdgeLabelIterator(const ChildNodeHandler &handler) :
147 BaseIterator<IEdgeLabelIterator,IEdgeLabel,EdgeLabelHandler>(handler.m_edgeLabels) {}
148};
149
150void graphhandler_init();
151void graphhandler_exit();
152
153#endif
154
155

Archive Download this file

Revision: 1322