1 /******************************************************************************
5 * Copyright (C) 1997-2014 by Dimitri van Heesch.
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.
13 * Documents produced by Doxygen are derivative works derived from the
14 * input used in their production; they are not affected by this license.
18 #include "classlist.h"
21 #include "outputlist.h"
24 #include "vhdldocgen.h"
26 #include "arguments.h"
29 ClassList::ClassList() : QList<ClassDef>()
33 ClassList::~ClassList()
37 static int compItems(const ClassDef *c1,const ClassDef *c2)
39 static bool b = Config_getBool("SORT_BY_SCOPE_NAME");
42 return qstricmp(c1->name(), c2->name());
46 return qstricmp(c1->className(), c2->className());
50 int ClassList::compareValues(const ClassDef *item1, const ClassDef *item2) const
52 return compItems(item1,item2);
55 int ClassSDict::compareValues(const ClassDef *item1, const ClassDef *item2) const
57 return compItems(item1,item2);
60 ClassListIterator::ClassListIterator(const ClassList &cllist) :
61 QListIterator<ClassDef>(cllist)
65 bool ClassSDict::declVisible(const ClassDef::CompoundType *filter) const
67 static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES");
68 static bool extractLocalClasses = Config_getBool("EXTRACT_LOCAL_CLASSES");
71 ClassSDict::Iterator sdi(*this);
73 for (sdi.toFirst();(cd=sdi.current());++sdi)
75 if (cd->name().find('@')==-1 &&
76 (filter==0 || *filter==cd->compoundType())
79 bool isLink = cd->isLinkable();
82 (!cd->isLocal() || extractLocalClasses)
94 void ClassSDict::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter,
95 const char *header,bool localNames)
97 static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
100 ClassSDict::Iterator sdi(*this);
103 for (sdi.toFirst();(cd=sdi.current());++sdi)
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())
112 cd->writeDeclarationLink(ol,found,header,localNames);
115 if (found) ol.endMemberList();
119 void ClassSDict::writeDocumentation(OutputList &ol,Definition * container)
121 static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
123 static bool inlineGroupedClasses = Config_getBool("INLINE_GROUPED_CLASSES");
124 static bool inlineSimpleClasses = Config_getBool("INLINE_SIMPLE_STRUCTS");
125 if (!inlineGroupedClasses && !inlineSimpleClasses) return;
131 ClassSDict::Iterator sdi(*this);
133 for (sdi.toFirst();(cd=sdi.current());++sdi)
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);
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
145 //printf(" showing class %s\n",cd->name().data());
149 ol.startGroupHeader();
150 ol.parseText(fortranOpt?theTranslator->trTypeDocumentation():
151 theTranslator->trClassDocumentation());
155 cd->writeInlineDocumentation(ol);
161 //-------------------------------------------
163 void GenericsSDict::insert(const QCString &key,ClassDef *cd)
167 ArgumentList argList;
168 stringToArgumentList(key.mid(i),&argList);
169 int c = argList.count();
171 GenericsCollection *collection = m_dict.find(key.left(i));
172 if (collection==0) // new name
174 collection = new GenericsCollection;
175 m_dict.append(key.left(i),collection);
177 if (collection->find(c)==0) // should always be 0!
179 collection->insert(c,cd);
183 ClassDef *GenericsSDict::find(const QCString &key)
188 GenericsCollection *collection = m_dict.find(key);
189 if (collection && collection->count()==1)
191 QIntDictIterator<ClassDef> it(*collection);
197 GenericsCollection *collection = m_dict.find(key.left(i));
200 ArgumentList argList;
201 stringToArgumentList(key.mid(i),&argList);
202 int c = argList.count();
203 return collection->find(c);