1 /******************************************************************************
3 * $Id: classlist.cpp,v 1.14 2001/03/19 19:27:39 root Exp $
5 * Copyright (C) 1997-2012 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"
28 ClassList::ClassList() : QList<ClassDef>()
32 ClassList::~ClassList()
36 static int compItems(void *item1,void *item2)
38 ClassDef *c1=(ClassDef *)item1;
39 ClassDef *c2=(ClassDef *)item2;
40 static bool b = Config_getBool("SORT_BY_SCOPE_NAME");
41 //printf("compItems: %d %s<->%s\n",b,c1->name().data(),c2->name().data());
44 return stricmp(c1->name(),
49 return stricmp(c1->className(),
54 int ClassList::compareItems(GCI item1, GCI item2)
56 return compItems(item1,item2);
59 int ClassSDict::compareItems(GCI item1, GCI item2)
61 return compItems(item1,item2);
64 ClassListIterator::ClassListIterator(const ClassList &cllist) :
65 QListIterator<ClassDef>(cllist)
69 bool ClassSDict::declVisible(const ClassDef::CompoundType *filter) const
71 static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES");
72 static bool extractLocalClasses = Config_getBool("EXTRACT_LOCAL_CLASSES");
75 ClassSDict::Iterator sdi(*this);
77 for (sdi.toFirst();(cd=sdi.current());++sdi)
79 if (cd->name().find('@')==-1 &&
80 (filter==0 || *filter==cd->compoundType())
83 bool isLink = cd->isLinkable();
86 (!cd->isLocal() || extractLocalClasses)
98 void ClassSDict::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter,
99 const char *header,bool localNames)
101 static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
104 ClassSDict::Iterator sdi(*this);
107 for (sdi.toFirst();(cd=sdi.current());++sdi)
109 //printf(" ClassSDict::writeDeclaration for %s\n",cd->name().data());
110 if (cd->name().find('@')==-1 &&
111 !cd->isExtension() &&
112 (cd->protection()!=Private || extractPrivate) &&
113 (filter==0 || *filter==cd->compoundType())
116 cd->writeDeclarationLink(ol,found,header,localNames);
119 if (found) ol.endMemberList();
123 void ClassSDict::writeDocumentation(OutputList &ol,Definition * container)
125 static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
127 static bool inlineGroupedClasses = Config_getBool("INLINE_GROUPED_CLASSES");
128 static bool inlineSimpleClasses = Config_getBool("INLINE_SIMPLE_STRUCTS");
129 if (!inlineGroupedClasses && !inlineSimpleClasses) return;
135 ClassSDict::Iterator sdi(*this);
137 for (sdi.toFirst();(cd=sdi.current());++sdi)
139 //printf("%s:writeDocumentation() %p embedded=%d container=%p\n",
140 // cd->name().data(),cd->getOuterScope(),cd->isEmbeddedInOuterScope(),
143 if (cd->name().find('@')==-1 &&
144 cd->isLinkableInProject() &&
145 cd->isEmbeddedInOuterScope() &&
146 (container==0 || cd->partOfGroups()==0) // if container==0 -> show as part of the group docs, otherwise only show if not part of a group
148 //(container==0 || // no container -> used for groups
149 // cd->getOuterScope()==container || // correct container -> used for namespaces and classes
150 // (container->definitionType()==Definition::TypeFile && cd->getOuterScope()==Doxygen::globalScope && cd->partOfGroups()==0) // non grouped class with file scope -> used for files
157 ol.startGroupHeader();
158 ol.parseText(fortranOpt?theTranslator->trTypeDocumentation():
159 theTranslator->trClassDocumentation());
163 cd->writeInlineDocumentation(ol);
169 //-------------------------------------------
171 void GenericsSDict::insert(const QCString &key,ClassDef *cd)
175 ArgumentList argList;
176 stringToArgumentList(key.mid(i),&argList);
177 int c = argList.count();
179 GenericsCollection *collection = m_dict.find(key.left(i));
180 if (collection==0) // new name
182 collection = new GenericsCollection;
183 m_dict.append(key.left(i),collection);
185 if (collection->find(c)==0) // should always be 0!
187 collection->insert(c,cd);
191 ClassDef *GenericsSDict::find(const QCString &key)
196 GenericsCollection *collection = m_dict.find(key);
197 if (collection && collection->count()==1)
199 QIntDictIterator<ClassDef> it(*collection);
205 GenericsCollection *collection = m_dict.find(key.left(i));
208 ArgumentList argList;
209 stringToArgumentList(key.mid(i),&argList);
210 int c = argList.count();
211 return collection->find(c);