|
1 /****************************************************************************** |
|
2 * |
|
3 * |
|
4 * |
|
5 * Copyright (C) 1997-2008 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 |
|
26 ClassList::ClassList() : QList<ClassDef>() |
|
27 { |
|
28 } |
|
29 |
|
30 ClassList::~ClassList() |
|
31 { |
|
32 } |
|
33 |
|
34 static int compItems(void *item1,void *item2) |
|
35 { |
|
36 ClassDef *c1=(ClassDef *)item1; |
|
37 ClassDef *c2=(ClassDef *)item2; |
|
38 static bool b = Config_getBool("SORT_BY_SCOPE_NAME"); |
|
39 //printf("compItems: %d %s<->%s\n",b,c1->qualifiedName().data(),c2->qualifiedName().data()); |
|
40 if (b) |
|
41 { |
|
42 return stricmp(c1->name(), |
|
43 c2->name()); |
|
44 } |
|
45 else |
|
46 { |
|
47 return stricmp(c1->className(), |
|
48 c2->className()); |
|
49 } |
|
50 } |
|
51 |
|
52 int ClassList::compareItems(GCI item1, GCI item2) |
|
53 { |
|
54 return compItems(item1,item2); |
|
55 } |
|
56 |
|
57 int ClassSDict::compareItems(GCI item1, GCI item2) |
|
58 { |
|
59 return compItems(item1,item2); |
|
60 } |
|
61 |
|
62 ClassListIterator::ClassListIterator(const ClassList &cllist) : |
|
63 QListIterator<ClassDef>(cllist) |
|
64 { |
|
65 } |
|
66 |
|
67 void ClassSDict::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter, |
|
68 const char *header,bool localNames) |
|
69 { |
|
70 static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); |
|
71 static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); |
|
72 if (count()>0) |
|
73 { |
|
74 ClassSDict::Iterator sdi(*this); |
|
75 ClassDef *cd=0; |
|
76 bool found=FALSE; |
|
77 for (sdi.toFirst();(cd=sdi.current());++sdi) |
|
78 { |
|
79 if (cd->name().find('@')==-1 && |
|
80 (filter==0 || *filter==cd->compoundType()) |
|
81 ) |
|
82 { |
|
83 bool isLink = cd->isLinkable(); |
|
84 if (isLink || |
|
85 (!Config_getBool("HIDE_UNDOC_CLASSES") && |
|
86 (!cd->isLocal() || Config_getBool("EXTRACT_LOCAL_CLASSES")) |
|
87 ) |
|
88 ) |
|
89 { |
|
90 if (!found) |
|
91 { |
|
92 ol.startMemberHeader(); |
|
93 if (header) |
|
94 { |
|
95 ol.parseText(header); |
|
96 } |
|
97 else if (vhdlOpt) |
|
98 { |
|
99 ol.parseText(VhdlDocGen::trVhdlType(VhdlDocGen::ARCHITECTURE,FALSE)); |
|
100 } |
|
101 else |
|
102 { |
|
103 ol.parseText(fortranOpt ? theTranslator->trDataTypes() : |
|
104 theTranslator->trCompounds()); |
|
105 } |
|
106 ol.endMemberHeader(); |
|
107 ol.startMemberList(); |
|
108 found=TRUE; |
|
109 } |
|
110 if (!Config_getString("GENERATE_TAGFILE").isEmpty() && |
|
111 !cd->isReference()) // skip classes found in tag files |
|
112 { |
|
113 Doxygen::tagFile << " <class kind=\"" << cd->compoundTypeString() |
|
114 << "\">" << convertToXML(cd->name()) << "</class>" << endl; |
|
115 } |
|
116 ol.startMemberItem(FALSE); |
|
117 QCString tmp = cd->compoundTypeString(); |
|
118 QCString cname; |
|
119 if (localNames) |
|
120 { |
|
121 cname = cd->localName(); |
|
122 } |
|
123 else |
|
124 { |
|
125 cname = cd->displayName(); |
|
126 } |
|
127 |
|
128 if (!vhdlOpt) // for VHDL we swap the name and the type |
|
129 { |
|
130 ol.writeString(tmp); |
|
131 ol.writeString(" "); |
|
132 ol.insertMemberAlign(); |
|
133 } |
|
134 if (isLink) |
|
135 { |
|
136 ol.writeObjectLink(cd->getReference(), |
|
137 cd->getOutputFileBase(), |
|
138 0, |
|
139 cname |
|
140 ); |
|
141 } |
|
142 else |
|
143 { |
|
144 ol.startBold(); |
|
145 ol.docify(cname); |
|
146 ol.endBold(); |
|
147 } |
|
148 if (vhdlOpt) // now write the type |
|
149 { |
|
150 ol.insertMemberAlign(); |
|
151 VhdlDocGen::writeClassType(cd,ol,cname); |
|
152 } |
|
153 ol.endMemberItem(); |
|
154 if (!cd->briefDescription().isEmpty()) |
|
155 { |
|
156 ol.startMemberDescription(); |
|
157 ol.parseDoc(cd->briefFile(),cd->briefLine(),cd,0, |
|
158 cd->briefDescription(),FALSE,FALSE,0,TRUE,FALSE); |
|
159 if (//(!cd->briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) || |
|
160 //!cd->documentation().isEmpty()) |
|
161 cd->isLinkableInProject() |
|
162 ) |
|
163 { |
|
164 ol.pushGeneratorState(); |
|
165 ol.disableAllBut(OutputGenerator::Html); |
|
166 //ol.endEmphasis(); |
|
167 ol.docify(" "); |
|
168 ol.startTextLink(cd->getOutputFileBase(),"_details"); |
|
169 ol.parseText(theTranslator->trMore()); |
|
170 ol.endTextLink(); |
|
171 //ol.startEmphasis(); |
|
172 ol.popGeneratorState(); |
|
173 } |
|
174 ol.endMemberDescription(); |
|
175 } |
|
176 } |
|
177 } |
|
178 } |
|
179 if (found) ol.endMemberList(); |
|
180 } |
|
181 } |
|
182 |