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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
/******************************************************************************
*
* $Id$
*
* Copyright (C) 1997-1999 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* All output generated with Doxygen is not covered by this license.
*
*/
#include "entry.h"
static int newCount=0;
Entry::Entry()
{
num=newCount++;
//printf("New Entry %d\n",num);
parent=0;
sublist = new QList<Entry>;
sublist->setAutoDelete(TRUE);
extends = new QList<BaseInfo>;
extends->setAutoDelete(TRUE);
groups = new QList<QString>;
groups->setAutoDelete(TRUE);
argList = new ArgumentList;
argList->setAutoDelete(TRUE);
//printf("Entry::Entry() tArgList=0\n");
tArgList = 0;
reset();
}
Entry::Entry(const Entry &e)
{
num=newCount++;
//printf("Copy New Entry %d\n",num);
section = e.section;
protection = e.protection;
sig = e.sig;
slot = e.slot;
stat = e.stat;
virt = e.virt;
parent = e.parent;
type = e.type.copy();
name = e.name.copy();
args = e.args.copy();
exception = e.exception.copy();
program = e.program.copy();
includeFile = e.includeFile.copy();
includeName = e.includeFile.copy();
doc = e.doc.copy();
relates = e.relates.copy();
brief = e.brief.copy();
inside = e.inside.copy();
fileName = e.fileName.copy();
startLine = e.startLine;
sublist = new QList<Entry>;
sublist->setAutoDelete(TRUE);
extends = new QList<BaseInfo>;
extends->setAutoDelete(TRUE);
groups = new QList<QString>;
groups->setAutoDelete(TRUE);
argList = new ArgumentList;
argList->setAutoDelete(TRUE);
//printf("Entry::Entry(copy) tArgList=0\n");
tArgList = 0;
// deep copy of the child entry list
QListIterator<Entry> eli(*e.sublist);
Entry *cur;
for (;(cur=eli.current());++eli)
{
sublist->append(new Entry(*cur));
}
// deep copy base class list
QListIterator<BaseInfo> bli(*e.extends);
BaseInfo *bi;
for (;(bi=bli.current());++bli)
{
extends->append(new BaseInfo(*bi));
}
// deep copy group list
QListIterator<QString> sli(*e.groups);
QString *s;
for (;(s=sli.current());++sli)
{
groups->append(new QString(*s));
}
// deep copy argument list
QListIterator<Argument> ali(*e.argList);
Argument *a;
for (;(a=ali.current());++ali)
{
argList->append(new Argument(*a));
}
argList->constSpecifier = e.argList->constSpecifier;
argList->volatileSpecifier = e.argList->volatileSpecifier;
argList->pureSpecifier = e.argList->pureSpecifier;
// deep copy template argument list
if (e.tArgList)
{
tArgList = new ArgumentList;
tArgList->setAutoDelete(TRUE);
//printf("Entry::Entry(copy) new tArgList=%p\n",tArgList);
QListIterator<Argument> tali(*e.tArgList);
for (;(a=tali.current());++tali)
{
tArgList->append(new Argument(*a));
//printf("appending argument %s %s\n",a->type.data(),a->name.data());
}
}
}
Entry::~Entry()
{
//printf("Deleting entry %d name %s type %x chilren %d\n",
// num,name.data(),section,sublist->count());
delete sublist;
delete extends;
delete groups;
delete argList;
//printf("Entry::~Entry() tArgList=%p\n",tArgList);
delete tArgList;
}
void Entry::addSubEntry(Entry *current)
{
//printf("Entry %d with name %s type 0x%x added\n",
// current->num,current->name.data(),current->section);
//printf("Entry::addSubEntry(%s) %p\n",current->name.data(),current->tArgList);
current->parent=this;
sublist->append(current);
//if (current->tArgList)
//{
// Argument * a=current->tArgList->first();
// while (a)
// {
// printf("type=%s name=%s\n",a->type.data(),a->name.data());
// a=current->tArgList->next();
// }
//}
}
void Entry::reset()
{
name.resize(0);
type.resize(0);
args.resize(0);
exception.resize(0);
program.resize(0);
includeFile.resize(0);
includeName.resize(0);
doc.resize(0);
relates.resize(0);
brief.resize(0);
inside.resize(0);
fileName.resize(0);
section = EMPTY_SEC;
sig = FALSE;
virt = Normal;
slot = FALSE;
stat = FALSE;
proto = FALSE;
protection = Public;
sublist->clear();
extends->clear();
groups->clear();
argList->clear();
if (tArgList) { delete tArgList; tArgList=0; }
}
int Entry::getSize()
{
int size=sizeof(Entry);
size+=type.length()+1;
size+=name.length()+1;
size+=args.length()+1;
size+=exception.length()+1;
size+=program.length()+1;
size+=includeFile.length()+1;
size+=includeName.length()+1;
size+=doc.length()+1;
size+=relates.length()+1;
size+=brief.length()+1;
size+=inside.length()+1;
size+=fileName.length()+1;
BaseInfo *bi=extends->first();
while (bi)
{
size+=sizeof(QLNode);
size+=bi->name.length()+1+sizeof(bi->prot)+sizeof(bi->virt);
bi=extends->next();
}
QString *s=groups->first();
while (s)
{
size+=sizeof(QLNode);
size+=s->length()+1;
s=groups->next();
}
Entry *e=sublist->first();
while (e)
{
size+=e->getSize();
e=sublist->next();
}
Argument *a=argList->first();
while (e)
{
size+=sizeof(Argument);
size+=a->type.length()+1
+a->name.length()+1
+a->defval.length()+1;
a=argList->next();
}
if (tArgList)
{
a=tArgList->first();
while (e)
{
size+=sizeof(Argument);
size+=a->type.length()+1
+a->name.length()+1
+a->defval.length()+1;
a=tArgList->next();
}
}
return size;
}
|