classlist.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  *
4  *
5  * Copyright (C) 1997-2015 by Dimitri van Heesch.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation under the terms of the GNU General Public License is hereby
9  * granted. No representations are made about the suitability of this software
10  * for any purpose. It is provided "as is" without express or implied warranty.
11  * See the GNU General Public License for more details.
12  *
13  * Documents produced by Doxygen are derivative works derived from the
14  * input used in their production; they are not affected by this license.
15  *
16  */
17 
18 #include "classlist.h"
19 #include "config.h"
20 #include "util.h"
21 #include "outputlist.h"
22 #include "language.h"
23 #include "doxygen.h"
24 #include "vhdldocgen.h"
25 #include "defargs.h"
26 #include "arguments.h"
27 #include "groupdef.h"
28 
30 {
31 }
32 
34 {
35 }
36 
37 static int compItems(const ClassDef *c1,const ClassDef *c2)
38 {
39  static bool b = Config_getBool("SORT_BY_SCOPE_NAME");
40  if (b)
41  {
42  return qstricmp(c1->name(), c2->name());
43  }
44  else
45  {
46  return qstricmp(c1->className(), c2->className());
47  }
48 }
49 
50 int ClassList::compareValues(const ClassDef *item1, const ClassDef *item2) const
51 {
52  return compItems(item1,item2);
53 }
54 
55 int ClassSDict::compareValues(const ClassDef *item1, const ClassDef *item2) const
56 {
57  return compItems(item1,item2);
58 }
59 
61  QListIterator<ClassDef>(cllist)
62 {
63 }
64 
66 {
67  static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES");
68  static bool extractLocalClasses = Config_getBool("EXTRACT_LOCAL_CLASSES");
69  if (count()>0)
70  {
71  ClassSDict::Iterator sdi(*this);
72  ClassDef *cd=0;
73  for (sdi.toFirst();(cd=sdi.current());++sdi)
74  {
75  if (cd->name().find('@')==-1 &&
76  (filter==0 || *filter==cd->compoundType())
77  )
78  {
79  bool isLink = cd->isLinkable();
80  if (isLink ||
81  (!hideUndocClasses &&
82  (!cd->isLocal() || extractLocalClasses)
83  )
84  )
85  {
86  return TRUE;
87  }
88  }
89  }
90  }
91  return FALSE;
92 }
93 
95  const char *header,bool localNames)
96 {
97  static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
98  if (count()>0)
99  {
100  ClassSDict::Iterator sdi(*this);
101  ClassDef *cd=0;
102  bool found=FALSE;
103  for (sdi.toFirst();(cd=sdi.current());++sdi)
104  {
105  //printf(" ClassSDict::writeDeclaration for %s\n",cd->name().data());
106  if (cd->name().find('@')==-1 &&
107  !cd->isExtension() &&
108  (cd->protection()!=Private || extractPrivate) &&
109  (filter==0 || *filter==cd->compoundType())
110  )
111  {
112  cd->writeDeclarationLink(ol,found,header,localNames);
113  }
114  }
115  if (found) ol.endMemberList();
116  }
117 }
118 
120 {
121  static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
122 
123  static bool inlineGroupedClasses = Config_getBool("INLINE_GROUPED_CLASSES");
124  static bool inlineSimpleClasses = Config_getBool("INLINE_SIMPLE_STRUCTS");
125  if (!inlineGroupedClasses && !inlineSimpleClasses) return;
126 
127  if (count()>0)
128  {
129  bool found=FALSE;
130 
131  ClassSDict::Iterator sdi(*this);
132  ClassDef *cd=0;
133  for (sdi.toFirst();(cd=sdi.current());++sdi)
134  {
135  //printf("%s:writeDocumentation() %p linkable=%d embedded=%d container=%p partOfGroups=%d\n",
136  // cd->name().data(),cd->getOuterScope(),cd->isLinkableInProject(),cd->isEmbeddedInOuterScope(),
137  // container,cd->partOfGroups() ? cd->partOfGroups()->count() : 0);
138 
139  if (cd->name().find('@')==-1 &&
140  cd->isLinkableInProject() &&
141  cd->isEmbeddedInOuterScope() &&
142  (container==0 || cd->partOfGroups()==0) // if container==0 -> show as part of the group docs, otherwise only show if not part of a group
143  )
144  {
145  //printf(" showing class %s\n",cd->name().data());
146  if (!found)
147  {
148  ol.writeRuler();
149  ol.startGroupHeader();
152  ol.endGroupHeader();
153  found=TRUE;
154  }
155  cd->writeInlineDocumentation(ol);
156  }
157  }
158  }
159 }
160 
161 //-------------------------------------------
162 
164 {
165  int i=key.find('<');
166  if (i==-1) return;
167  ArgumentList argList;
168  stringToArgumentList(key.mid(i),&argList);
169  int c = argList.count();
170  if (c==0) return;
171  GenericsCollection *collection = m_dict.find(key.left(i));
172  if (collection==0) // new name
173  {
174  collection = new GenericsCollection;
175  m_dict.append(key.left(i),collection);
176  }
177  if (collection->find(c)==0) // should always be 0!
178  {
179  collection->insert(c,cd);
180  }
181 }
182 
184 {
185  int i=key.find('<');
186  if (i==-1)
187  {
188  GenericsCollection *collection = m_dict.find(key);
189  if (collection && collection->count()==1)
190  {
191  QIntDictIterator<ClassDef> it(*collection);
192  return it.current();
193  }
194  }
195  else
196  {
197  GenericsCollection *collection = m_dict.find(key.left(i));
198  if (collection)
199  {
200  ArgumentList argList;
201  stringToArgumentList(key.mid(i),&argList);
202  int c = argList.count();
203  return collection->find(c);
204  }
205  }
206  return 0;
207 }
208 
209 
210 
211 
void writeRuler()
Definition: outputlist.h:240
CompoundType compoundType() const
Definition: classdef.cpp:4394
uint count() const
Definition: qintdict.h:54
This class represents an function or template argument list.
Definition: arguments.h:82
void endGroupHeader(int extraLevels=0)
Definition: outputlist.h:178
bool isLinkableInProject() const
Definition: classdef.cpp:2707
bool isExtension() const
Definition: classdef.cpp:4709
int compareValues(const ClassDef *item1, const ClassDef *item2) const
Definition: classlist.cpp:50
const bool FALSE
Definition: qglobal.h:370
Definition: types.h:26
bool declVisible(const ClassDef::CompoundType *filter=0) const
Definition: classlist.cpp:65
QCString left(uint len) const
Definition: qcstring.cpp:213
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
void writeDeclarationLink(OutputList &ol, bool &found, const char *header, bool localNames)
Definition: classdef.cpp:1847
GroupList * partOfGroups() const
bool parseText(const QCString &textStr)
Definition: outputlist.cpp:175
Protection protection() const
Definition: classdef.cpp:4414
void writeInlineDocumentation(OutputList &ol)
Definition: classdef.cpp:1675
uint count() const
Definition: qlist.h:66
QCString className() const
Definition: classdef.cpp:3914
void insert(long k, const type *d)
Definition: qintdict.h:57
void insert(const QCString &key, ClassDef *cd)
Definition: classlist.cpp:163
const QCString & name() const
Definition: definition.h:114
int qstricmp(const char *str1, const char *str2)
Definition: qcstring.cpp:567
uint count() const
Definition: qlist.h:131
def key(type, name=None)
Definition: graph.py:13
virtual QCString trClassDocumentation()=0
void stringToArgumentList(const char *argsString, ArgumentList *al, QCString *extraTypeChars)
Definition: defargs.cpp:2922
bool isLocal() const
Definition: classdef.cpp:4384
A bunch of utility functions.
bool isEmbeddedInOuterScope() const
Definition: classdef.cpp:4630
bool isLinkable() const
Definition: classdef.cpp:2729
#define Config_getBool(val)
Definition: config.cpp:664
int compareValues(const ClassDef *item1, const ClassDef *item2) const
Definition: classlist.cpp:55
ClassListIterator(const ClassList &list)
Definition: classlist.cpp:60
void startGroupHeader(int extraLevels=0)
Definition: outputlist.h:176
QCString mid(uint index, uint len=0xffffffff) const
Definition: qcstring.cpp:246
void writeDeclaration(OutputList &ol, const ClassDef::CompoundType *filter=0, const char *header=0, bool localNames=FALSE)
Definition: classlist.cpp:94
static int compItems(const ClassDef *c1, const ClassDef *c2)
Definition: classlist.cpp:37
type * current() const
Definition: qintdict.h:94
CompoundType
Definition: classdef.h:63
ClassDef * find(const QCString &key)
Definition: classlist.cpp:183
static bool * b
Definition: config.cpp:1043
Translator * theTranslator
Definition: language.cpp:157
void writeDocumentation(OutputList &ol, Definition *container=0)
Definition: classlist.cpp:119
friend class Iterator
Definition: sortdict.h:289
const bool TRUE
Definition: qglobal.h:371
virtual QCString trTypeDocumentation()=0
type * find(long k) const
Definition: qintdict.h:63
void endMemberList()
Definition: outputlist.h:208
Definition: qlist.h:54