compoundhandler.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * $Id$
4  *
5  *
6  * Copyright (C) 1997-2015 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 #ifndef _COMPOUNDHANDLER_H
16 #define _COMPOUNDHANDLER_H
17 
18 #include <qstring.h>
19 #include <qlist.h>
20 #include <qxml.h>
21 #include <doxmlintf.h>
22 
23 #include "stringimpl.h"
24 #include "basehandler.h"
25 #include "baseiterator.h"
26 
27 class MainHandler;
28 class DocHandler;
30 class GraphHandler;
31 class MemberHandler;
32 class CompoundHandler;
33 class SectionHandler;
34 class ParamHandler;
36 class TitleHandler;
38 
39 class IncludeHandler : public IInclude, public BaseHandler<IncludeHandler>
40 {
41  public:
42  IncludeHandler(IBaseHandler *parent,const char *endtag);
43  virtual ~IncludeHandler();
44 
45  void startInclude(const QXmlAttributes &attrib);
46  void endInclude();
47 
48  // IInclude
49  virtual const IString * name() const
50  { return &m_name; }
51  virtual const IString * refId() const
52  { return &m_refId; }
53  virtual bool isLocal() const
54  { return &m_isLocal; }
55 
56  private:
58  StringImpl m_name; // element's content
59  StringImpl m_refId; // refid
60  bool m_isLocal; // local
61 };
62 
63 class IncludeIterator : public BaseIterator<IIncludeIterator,IInclude,IncludeHandler>
64 {
65  public:
68 };
69 
70 
72 {
73  public:
75  const QString &id,
76  Protection prot,
77  Kind kind
78  ) :
79  m_parent(parent), m_id(id), m_protection(prot), m_kind(kind) {}
80  virtual ~RelatedCompound() {}
81  void setName(const QString &str) { m_name = str; }
82 
83  virtual ICompound *compound() const;
84  virtual Protection protection() const { return m_protection; }
85  virtual Kind kind() const { return m_kind; }
86  virtual const IString *name() const { return &m_name; }
87 
88  private:
90  QString m_id; // refid
92  Kind m_kind; // virt
93  StringImpl m_name; // element's content
94 };
95 
96 class RelatedCompoundIterator : public BaseIterator<IRelatedCompoundIterator,IRelatedCompound,RelatedCompound>
97 {
98  public:
101 };
102 
103 
104 class CompoundHandler : public IClass,
105  public IStruct,
106  public IUnion,
107  public IException,
108  public IInterface,
109  public INamespace,
110  public IFile,
111  public IGroup,
112  public IPage,
113  public IDir,
114  public BaseHandler<CompoundHandler>
115 {
116  friend class RelatedCompound;
117 
118  public:
119  virtual void startSection(const QXmlAttributes& attrib);
120  virtual void startCompound(const QXmlAttributes& attrib);
121  virtual void startSuperClass(const QXmlAttributes& attrib);
122  virtual void endSuperClass();
123  virtual void startSubClass(const QXmlAttributes& attrib);
124  virtual void endSubClass();
125  virtual void endCompound();
126  virtual void endCompoundName();
127  virtual void startBriefDesc(const QXmlAttributes& attrib);
128  virtual void startDetailedDesc(const QXmlAttributes& attrib);
129  virtual void startLocation(const QXmlAttributes& attrib);
130  virtual void startProgramListing(const QXmlAttributes& attrib);
131  virtual void startInheritanceGraph(const QXmlAttributes& attrib);
132  virtual void startCollaborationGraph(const QXmlAttributes& attrib);
133  virtual void startIncludeDependencyGraph(const QXmlAttributes& attrib);
134  virtual void startIncludedByDependencyGraph(const QXmlAttributes& attrib);
135  virtual void startIncludes(const QXmlAttributes& attrib);
136  virtual void startIncludedBy(const QXmlAttributes& attrib);
137  virtual void startInnerDir(const QXmlAttributes& attrib);
138  virtual void startInnerClass(const QXmlAttributes& attrib);
139  virtual void startInnerNamespace(const QXmlAttributes& attrib);
140  virtual void startInnerFile(const QXmlAttributes& attrib);
141  virtual void startInnerGroup(const QXmlAttributes& attrib);
142  virtual void startInnerPage(const QXmlAttributes& attrib);
143  virtual void startTitle(const QXmlAttributes& attrib);
144  virtual void startTemplateParamList(const QXmlAttributes& attrib);
145  virtual void startListOfAllMembers(const QXmlAttributes& attrib);
146  virtual void addref() { m_refCount++; }
147 
148  CompoundHandler(const QString &dirName);
149  virtual ~CompoundHandler();
150  bool parseXML(const char *compId);
151  void initialize(MainHandler *mh);
152  void insertMember(MemberHandler *mh);
153  ICompound *toICompound() const;
154 
155  // ICompound implementation
156  const IString *name() const { return &m_name; }
157  const IString *id() const { return &m_id; }
158  CompoundKind kind() const { return m_kind; }
159  const IString *kindString() const { return &m_kindString; }
160  ISectionIterator *sections() const;
161  IDocRoot *briefDescription() const;
162  IDocRoot *detailedDescription() const;
163  IMember *memberById(const char *id) const;
164  IMemberIterator *memberByName(const char *name) const;
165  IParamIterator *templateParameters() const;
166  void release();
167 
168  // IClass implementation
169  IGraph *inheritanceGraph() const;
170  IGraph *collaborationGraph() const;
171  IRelatedCompoundIterator *baseCompounds() const;
172  IRelatedCompoundIterator *derivedCompounds() const;
173  ICompoundIterator *nestedCompounds() const;
174  ICompoundIterator *nestedGroup() const;
175  const IString *locationFile() const { return &m_defFile; }
176  int locationLine() const { return m_defLine; }
177  const IString *locationBodyFile() const { return &m_defBodyFile; }
178  int locationBodyStartLine() const { return m_defBodyStart; }
179  int locationBodyEndLine() const { return m_defBodyEnd; }
180  IMemberReferenceIterator *members() const;
181 
182  // IFile implementation
183  IGraph *includeDependencyGraph() const;
184  IGraph *includedByDependencyGraph() const;
185  IDocProgramListing *source() const;
186  IIncludeIterator *includes() const;
187  IIncludeIterator *includedBy() const;
188 
189  // IPage implementation
190  const IDocTitle *title() const;
191 
192  private:
193  // XML elements:
194  // -------------
195  StringImpl m_name; // compoundname
198  QList<RelatedCompound> m_superClasses; // derivedcompoundref
203  QList<QString> m_innerCompounds; // innerdir/innerfile/innerclass/innernamespace/innergroup
206  DocHandler* m_brief; // briefdescription
207  DocHandler* m_detailed; // detaileddescription
208  GraphHandler* m_inheritanceGraph; // inheritancegraph
209  GraphHandler* m_collaborationGraph; // collaborationgraph
211  // location
213  int m_defLine; // - line
214  StringImpl m_defBodyFile; // - bodyfile
215  int m_defBodyStart; // - bodystart
216  int m_defBodyEnd; // - bodyend
217  ListOfAllMembersHandler* m_members; // listofallmember
218 
219  // XML attributes:
220  // ---------------
223  StringImpl m_kindString; // kind as a string
225 
226  // local variables
227  QString m_xmlDir; // directory where the info is found
228  int m_refCount; // object reference counter
229  QDict<MemberHandler> m_memberDict; // id->member lookup
230  QDict<QList<MemberHandler> > m_memberNameDict; // name->memberlist lookup
231  MainHandler* m_mainHandler; // parent object
232 };
233 
234 void compoundhandler_init();
235 void compoundhandler_exit();
236 
237 #endif
StringImpl m_defBodyFile
QList< IncludeHandler > m_includedBy
const IString * locationFile() const
TitleHandler * m_titleHandler
The interface to a class in the object model.
Definition: doxmlintf.h:968
GraphHandler * m_inheritanceGraph
StringImpl m_name
MainHandler * m_mainHandler
StringImpl m_kindString
Read only interface to a string.
Definition: doxmlintf.h:42
virtual const IString * name() const
CompoundKind kind() const
virtual ~IncludeHandler()
CompoundKind m_kind
StringImpl m_protection
int locationBodyEndLine() const
virtual void addref()
The interface to a struct in the object model.
Definition: doxmlintf.h:992
Interface to a directory in the object model.
Definition: doxmlintf.h:1074
virtual const IString * name() const
QList< SectionHandler > m_sections
IncludeIterator(const QList< IncludeHandler > &list)
QList< QString > m_innerCompounds
const IString * kindString() const
void startInclude(const QXmlAttributes &attrib)
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
int locationLine() const
The interface to a namespace in the object model.
Definition: doxmlintf.h:1030
virtual Kind kind() const
RelatedCompound(CompoundHandler *parent, const QString &id, Protection prot, Kind kind)
The interface to a file in the object model.
Definition: doxmlintf.h:1038
void compoundhandler_exit()
const IString * name() const
virtual Protection protection() const
DocHandler * m_detailed
RelatedCompoundIterator(const QList< RelatedCompound > &list)
StringImpl m_name
int locationBodyStartLine() const
Node representing a documentation block.
Definition: dochandler.h:1315
GraphHandler * m_includeDependencyGraph
void setName(const QString &str)
QDict< QList< MemberHandler > > m_memberNameDict
virtual const IString * refId() const
QList< IncludeHandler > m_includes
QDict< MemberHandler > m_memberDict
const IString * id() const
GraphHandler * m_includedByDependencyGraph
The interface to a compound in the object model.
Definition: doxmlintf.h:868
DocHandler * m_brief
The interface to a page in the object model.
Definition: doxmlintf.h:1067
StringImpl m_refId
string release
Definition: conf.py:24
GraphHandler * m_collaborationGraph
void startTitle(OutputList &ol, const char *fileName, Definition *def)
Definition: index.cpp:228
The interface to a union in the object model.
Definition: doxmlintf.h:1006
The interface to a Java/IDL interface in the object model.
Definition: doxmlintf.h:1014
IBaseHandler * m_parent
CompoundHandler * m_parent
virtual bool isLocal() const
TemplateParamListHandler * m_templateParamList
QList< RelatedCompound > m_subClasses
The QXmlAttributes class provides XML attributes.
Definition: qxml.h:128
ListOfAllMembersHandler * m_members
Protection m_protection
QList< RelatedCompound > m_superClasses
Include relation.
Definition: doxmlintf.h:698
StringImpl m_defFile
virtual ~RelatedCompound()
void compoundhandler_init()
The interface to a group in the object model.
Definition: doxmlintf.h:1055
Node representing a program listing.
Definition: dochandler.h:871
The interface to a Java/IDL exception in the object model.
Definition: doxmlintf.h:1024
def parent(G, child, parent_type)
Definition: graph.py:67
const IString * locationBodyFile() const
static QCString str
The interface to the object model provided by the XML parser library.
ProgramListingHandler * m_programListing
IncludeHandler(IBaseHandler *parent, const char *endtag)