sectionhandler.cpp
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 
16 #include "mainhandler.h"
17 #include "compoundhandler.h"
18 #include "sectionhandler.h"
19 #include "memberhandler.h"
20 #include "dochandler.h"
21 #include "debug.h"
22 
24 {
25  public:
27  {
28  m_map.setAutoDelete(TRUE);
29  m_map.insert("user-defined",new int(ISection::UserDefined));
30  m_map.insert("public-type",new int(ISection::PubTypes));
31  m_map.insert("public-func",new int(ISection::PubFuncs));
32  m_map.insert("public-attrib",new int(ISection::PubAttribs));
33  m_map.insert("public-slot",new int(ISection::PubSlots));
34  m_map.insert("signal",new int(ISection::Signals));
35  m_map.insert("dcop-func",new int(ISection::DCOPFuncs));
36  m_map.insert("property",new int(ISection::Properties));
37  m_map.insert("event",new int(ISection::Events));
38  m_map.insert("public-static-func",new int(ISection::PubStatFuncs));
39  m_map.insert("public-static-attrib",new int(ISection::PubStatAttribs));
40  m_map.insert("protected-type",new int(ISection::ProTypes));
41  m_map.insert("protected-func",new int(ISection::ProFuncs));
42  m_map.insert("protected-attrib",new int(ISection::ProAttribs));
43  m_map.insert("protected-slot",new int(ISection::ProSlots));
44  m_map.insert("protected-static-func",new int(ISection::ProStatFuncs));
45  m_map.insert("protected-static-attrib",new int(ISection::ProStatAttribs));
46  m_map.insert("package-type",new int(ISection::PacTypes));
47  m_map.insert("package-func",new int(ISection::PacFuncs));
48  m_map.insert("package-attrib",new int(ISection::PacAttribs));
49  m_map.insert("package-static-func",new int(ISection::PacStatFuncs));
50  m_map.insert("package-static-attrib",new int(ISection::PacStatAttribs));
51  m_map.insert("private-type",new int(ISection::PriTypes));
52  m_map.insert("private-func",new int(ISection::PriFuncs));
53  m_map.insert("private-attrib",new int(ISection::PriAttribs));
54  m_map.insert("private-slot",new int(ISection::PriSlots));
55  m_map.insert("private-static-func",new int(ISection::PriStatFuncs));
56  m_map.insert("private-static-attrib",new int(ISection::PriStatAttribs));
57  m_map.insert("friend",new int(ISection::Friend));
58  m_map.insert("related",new int(ISection::Related));
59  m_map.insert("define",new int(ISection::Defines));
60  m_map.insert("prototype",new int(ISection::Prototypes));
61  m_map.insert("typedef",new int(ISection::Typedefs));
62  m_map.insert("enum",new int(ISection::Enums));
63  m_map.insert("func",new int(ISection::Functions));
64  m_map.insert("var",new int(ISection::Variables));
65  }
67  {
68  int *val = m_map.find(s.utf8());
69  if (val==0)
70  {
71  debug(1,"Warning: `%s' is an invalid section type\n",s.data());
72  return ISection::Invalid;
73  }
74  else return (ISection::SectionKind)*val;
75  }
76  private:
77  QDict<int> m_map;
78 };
79 
81 
83 {
84  s_typeMap = new SectionTypeMap;
85 }
86 
88 {
89  delete s_typeMap;
90 }
91 
93 {
94  //printf("SectionHandler::SectionHandler()\n");
96  addEndHandler("sectiondef",this,&SectionHandler::endSection);
101 }
102 
104 {
105  debug(2,"SectionHandler::~SectionHandler()\n");
106 }
107 
109 {
110  m_parent->setDelegate(this);
111  m_kindString = attrib.value("kind");
112  m_kind = s_typeMap->map(m_kindString);
113  debug(2,"section kind=`%s'\n",m_kindString.data());
114 }
115 
117 {
118  DocHandler *docHandler = new DocHandler(this);
119  docHandler->startDoc(attrib);
120  m_description = docHandler;
121 }
122 
124 {
125  m_parent->setDelegate(0);
126 }
127 
129 {
130  MemberHandler *memHandler = new MemberHandler(this);
131  memHandler->startMember(attrib);
132  m_members.append(memHandler);
133 }
134 
136 {
137  m_header="";
138  m_curString="";
139 }
140 
142 {
144  debug(2,"member header=`%s'\n",m_header.data());
145 }
146 
148 {
150  MemberHandler *mh;
151  for (;(mh=mli.current());++mli)
152  {
153  mh->setCompoundHandler(ch);
154  ch->insertMember(mh);
155  mh->setSectionHandler(this);
156  }
157 }
158 
160 {
161  return m_description;
162 }
163 
165 {
166  return new MemberIterator(m_members);
167 }
168 
Private member typedefs.
Definition: doxmlintf.h:776
void insertMember(MemberHandler *mh)
SectionHandler(IBaseHandler *parent)
Protected static member functions.
Definition: doxmlintf.h:769
void append(const type *d)
Definition: qlist.h:73
virtual void endSection()
Friends.
Definition: doxmlintf.h:782
virtual void endHeader()
Private Qt slots.
Definition: doxmlintf.h:779
Qt Signals.
Definition: doxmlintf.h:759
Public member functions.
Definition: doxmlintf.h:756
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
StringImpl m_kindString
virtual void startMember(const QXmlAttributes &attrib)
Public member attributes.
Definition: doxmlintf.h:757
QString value(int index) const
Definition: qxml.cpp:664
virtual void startMember(const QXmlAttributes &attrib)
virtual ~SectionHandler()
static SectionTypeMap * s_typeMap
C# events.
Definition: doxmlintf.h:762
const char * data() const
Definition: qstring.h:542
Package member functions.
Definition: doxmlintf.h:772
Public static member functions.
Definition: doxmlintf.h:763
QList< MemberHandler > m_members
IDL properties.
Definition: doxmlintf.h:761
virtual void startDoc(const QXmlAttributes &attrib)
SectionKind m_kind
Private static member functions.
Definition: doxmlintf.h:780
void setSectionHandler(SectionHandler *s)
virtual void setDelegate(QXmlDefaultHandler *delegate)=0
Protected static member attributes.
Definition: doxmlintf.h:770
Private member attributes.
Definition: doxmlintf.h:778
Global typedefs.
Definition: doxmlintf.h:786
Node representing a documentation block.
Definition: dochandler.h:1315
Public member typedefs.
Definition: doxmlintf.h:755
Private member functions.
Definition: doxmlintf.h:777
type * current() const
Definition: qlist.h:146
Package static member attributes.
Definition: doxmlintf.h:775
Protected slots.
Definition: doxmlintf.h:768
Protected member typedefs.
Definition: doxmlintf.h:765
Enumerations.
Definition: doxmlintf.h:787
virtual void startHeader(const QXmlAttributes &attrib)
virtual void startSection(const QXmlAttributes &attrib)
Global function prototypes.
Definition: doxmlintf.h:785
QString stripWhiteSpace() const
Definition: qstring.cpp:13438
ISection::SectionKind map(const QString &s)
StringImpl m_header
void sectionhandler_init()
virtual IMemberIterator * members() const
virtual void startDescription(const QXmlAttributes &attrib)
Global variables.
Definition: doxmlintf.h:789
Package member typedefs.
Definition: doxmlintf.h:771
void sectionhandler_exit()
A user defined member group.
Definition: doxmlintf.h:754
Private static member attributes.
Definition: doxmlintf.h:781
Preprocessor defines.
Definition: doxmlintf.h:784
IBaseHandler * m_parent
The QXmlAttributes class provides XML attributes.
Definition: qxml.h:128
Protected member attributes.
Definition: doxmlintf.h:767
Package static member functions.
Definition: doxmlintf.h:774
void addStartHandler(const char *key)
Definition: basehandler.h:91
void setCompoundHandler(CompoundHandler *c)
Global functions.
Definition: doxmlintf.h:788
Function marked as related.
Definition: doxmlintf.h:783
QCString utf8() const
Definition: qstring.cpp:14507
Public Qt Slots.
Definition: doxmlintf.h:758
DocHandler * m_description
void setAutoDelete(bool enable)
Definition: qlist.h:99
void initialize(CompoundHandler *c)
static QCString * s
Definition: config.cpp:1042
Package member attributes.
Definition: doxmlintf.h:773
def parent(G, child, parent_type)
Definition: graph.py:67
const bool TRUE
Definition: qglobal.h:371
QDict< int > m_map
IDocRoot * description() const
Public static attributes.
Definition: doxmlintf.h:764
KDE-DCOP interface functions.
Definition: doxmlintf.h:760
void addEndHandler(const char *key)
Definition: basehandler.h:101
Protected member functions.
Definition: doxmlintf.h:766