-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathclasslist.cpp
190 lines (146 loc) · 5.27 KB
/
classlist.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/************************************************************************
*
* Copyright (c) 2014-2024 Barbara Geller & Ansel Sermersheim
* Copyright (c) 1997-2014 Dimitri van Heesch
*
* DoxyPress is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* DoxyPress is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Documents produced by DoxyPress are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*************************************************************************/
#include <classlist.h>
#include <arguments.h>
#include <config.h>
#include <default_args.h>
#include <groupdef.h>
#include <language.h>
#include <outputlist.h>
#include <util.h>
static int compItems(const QSharedPointer<ClassDef> &c1, const QSharedPointer<ClassDef> &c2)
{
static const bool sortByScopeName = Config::getBool("sort-by-scope-name");
if (sortByScopeName) {
return c1->name().compare(c2->name(), Qt::CaseInsensitive);
} else {
int compareResult = c1->className().compare(c2->className(), Qt::CaseInsensitive);
if (compareResult == 0) {
return c1->name().compare(c2->name(), Qt::CaseInsensitive);
} else {
return compareResult;
}
}
}
int ClassSDict::compareMapValues(const QSharedPointer<ClassDef> &item1, const QSharedPointer<ClassDef> &item2) const
{
return compItems(item1, item2);
}
bool ClassSDict::declVisible(const enum CompoundType *filter) const
{
static const bool hideUndocClasses = Config::getBool("hide-undoc-classes");
static const bool extractLocalClasses = Config::getBool("extract-local-classes");
if (count() > 0) {
for (auto cd : *this) {
if (! cd->isAnonymous() && (filter == nullptr || *filter == cd->compoundType()) ) {
bool isLink = cd->isLinkable();
if (isLink || (! hideUndocClasses && (! cd->isLocal() || extractLocalClasses) ) ) {
return true;
}
}
}
}
return false;
}
void ClassSDict::writeDeclaration(OutputList &ol, const enum CompoundType *filter, const QString &header, bool localNames)
{
static const bool extractPrivate = Config::getBool("extract-private");
if (count() > 0) {
bool found = false;
for (auto cd : *this) {
if (! cd->isAnonymous() && ! cd->isExtension() && (cd->protection() != Private || extractPrivate) &&
(filter == nullptr || *filter == cd->compoundType()) ) {
cd->writeDeclarationLink(ol, found, header, localNames);
}
}
if (found) {
ol.endMemberList();
}
}
}
void ClassSDict::writeDocumentation(OutputList &ol, QSharedPointer<Definition> container)
{
static const bool optimizeFortran = Config::getBool("optimize-fortran");
static const bool inlineGroupedClasses = Config::getBool("inline-grouped-classes");
static const bool inlineSimpleClasses = Config::getBool("inline-simple-struct");
if (! inlineGroupedClasses && ! inlineSimpleClasses) {
return;
}
if (count() > 0) {
bool found = false;
for (auto cd : *this) {
if (! cd->isAnonymous() && cd->isLinkableInProject() && cd->isEmbeddedInOuterScope() &&
(container == nullptr || cd->partOfGroups() == nullptr) ) {
if (! found) {
ol.writeRuler();
ol.startGroupHeader();
ol.parseText(optimizeFortran ? theTranslator->trTypeDocumentation()
: theTranslator->trClassDocumentation());
ol.endGroupHeader();
found = true;
}
cd->writeInlineDocumentation(ol);
}
}
}
}
void GenericsSDict::insert(const QString &key, QSharedPointer<ClassDef> cd)
{
int i = key.indexOf('<');
if (i == -1) {
return;
}
ArgumentList argList;
QString dummy;
argList = stringToArgumentList(SrcLangExt_CSharp, dummy, key.mid(i));
int c = argList.count();
if (c == 0) {
return;
}
QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key.left(i));
if (collection == nullptr) {
// new hash
collection = QMakeShared<QHash<long, QSharedPointer<ClassDef>>>();
// add new hash to m_dict
m_dict.insert(key.left(i), collection);
}
if (! collection->contains(c)) {
// add the collection
collection->insert(c, cd);
}
}
QSharedPointer<ClassDef> GenericsSDict::find(const QString &key)
{
int i = key.indexOf('<');
if (i == -1) {
QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key);
if (collection && collection->count() == 1) {
return collection->begin().value();
}
} else {
QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key.left(i));
if (collection) {
ArgumentList argList;
QString dummy;
argList = stringToArgumentList(SrcLangExt_CSharp, dummy, key.mid(i));
int c = argList.count();
return collection->value(c);
}
}
return QSharedPointer<ClassDef>();
}