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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
|
/******************************************************************************
*
*
*
* Copyright (C) 1997-2001 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.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#include <stdio.h>
#include <qfile.h>
#include <qregexp.h>
#include "classdef.h"
#include "classlist.h"
#include "entry.h"
#include "doc.h"
#include "doxygen.h"
#include "membername.h"
#include "message.h"
#include "config.h"
#include "util.h"
#include "diagram.h"
#include "language.h"
#include "htmlhelp.h"
#include "example.h"
#include "outputlist.h"
#include "dot.h"
#include "defargs.h"
#include "debug.h"
static QCString stripExtension(const char *fName)
{
QCString result=fName;
if (result.right(5)==".html") result=result.left(result.length()-5);
return result;
}
// constructs a new class definition
ClassDef::ClassDef(
const char *defFileName,int defLine,
const char *nm,CompoundType ct,
const char *lref,const char *fName)
: Definition(defFileName,defLine,removeRedundantWhiteSpace(nm))
{
m_compType=ct;
QCString compoundName=compoundTypeString();
if (fName)
{
m_fileName=stripExtension(fName);
}
else
{
m_fileName=compoundName+m_name;
}
if (lref)
{
m_exampleSDict = 0;
}
else
{
m_exampleSDict = new ExampleSDict(17);
}
m_memListFileName=convertNameToFile(compoundName+m_name+"-members");
m_inherits = new BaseClassList;
m_inherits->setAutoDelete(TRUE);
m_inheritedBy = new BaseClassList;
m_inheritedBy->setAutoDelete(TRUE);
m_allMemberNameInfoSDict = new MemberNameInfoSDict(257);
m_allMemberNameInfoSDict->setAutoDelete(TRUE);
visited=FALSE;
setReference(lref);
m_incInfo=0;
m_tempArgs=0;
m_prot=Public;
m_nspace=0;
m_fileDef=0;
m_usesImplClassDict=0;
m_usesIntfClassDict=0;
m_memberGroupList = new MemberGroupList;
m_memberGroupList->setAutoDelete(TRUE);
m_memberGroupDict = new MemberGroupDict(17);
m_innerClasses = new ClassSDict(17);
//int i=name().findRev("::"); // TODO: broken if A<N::C> is the class name
//if (i==-1)
//{
// m_scopelessName=name();
//}
//else
//{
// m_scopelessName=name().right(name().length()-i-2);
//}
m_subGrouping=TRUE;
//m_isTemplBaseClass=-1;
m_templateInstances = 0;
m_templateMaster =0;
m_templBaseClassNames = 0;
m_artificial = FALSE;
m_isAbstract = FALSE;
m_isStatic = FALSE;
}
// destroy the class definition
ClassDef::~ClassDef()
{
delete m_inherits;
delete m_inheritedBy;
delete m_allMemberNameInfoSDict;
delete m_exampleSDict;
delete m_usesImplClassDict;
delete m_usesIntfClassDict;
delete m_incInfo;
delete m_memberGroupList;
delete m_memberGroupDict;
delete m_innerClasses;
delete m_templateInstances;
delete m_templBaseClassNames;
}
QCString ClassDef::displayName() const
{
QCString n;
if (Config_getBool("HIDE_SCOPE_NAMES"))
{
n=localName();
}
else
{
n=qualifiedNameWithTemplateParameters();
}
return n;
}
// inserts a base class in the inheritance list
void ClassDef::insertBaseClass(ClassDef *cd,const char *n,Protection p,
Specifier s,const char *t)
{
//printf("*** insert base class %s into %s\n",cd->name().data(),name().data());
//inherits->inSort(new BaseClassDef(cd,p,s,t));
m_inherits->append(new BaseClassDef(cd,n,p,s,t));
}
// inserts a sub class in the inherited list
void ClassDef::insertSubClass(ClassDef *cd,Protection p,
Specifier s,const char *t)
{
//printf("*** insert sub class %s into %s\n",cd->name().data(),name().data());
m_inheritedBy->inSort(new BaseClassDef(cd,0,p,s,t));
}
void ClassDef::addMembersToMemberGroup()
{
::addMembersToMemberGroup(&pubTypes,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&pubMembers,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&pubAttribs,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&pubSlots,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&signals,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&dcopMethods,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&pubStaticMembers,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&pubStaticAttribs,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&proTypes,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&proMembers,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&proAttribs,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&proSlots,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&proStaticMembers,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&proStaticAttribs,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&priTypes,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&priMembers,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&priAttribs,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&priSlots,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&priStaticMembers,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&priStaticAttribs,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&friends,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&related,m_memberGroupDict,m_memberGroupList);
::addMembersToMemberGroup(&properties,m_memberGroupDict,m_memberGroupList);
}
// adds new member definition to the class
void ClassDef::insertMember(MemberDef *md)
{
//printf("adding %s::%s\n",name().data(),md->name().data());
if (!isReference())
{
/********************************************/
/* insert member in the declaration section */
/********************************************/
if (md->isRelated() &&
(Config_getBool("EXTRACT_PRIVATE") || md->protection()!=Private))
{
related.append(md);
md->setSectionList(&related);
}
else if (md->isFriend())
{
friends.append(md);
md->setSectionList(&friends);
}
else
{
switch (md->memberType())
{
case MemberDef::Signal: // Qt specific
signals.append(md);
md->setSectionList(&signals);
break;
case MemberDef::DCOP: // KDE2 specific
dcopMethods.append(md);
md->setSectionList(&dcopMethods);
break;
case MemberDef::Property:
properties.append(md);
md->setSectionList(&properties);
break;
case MemberDef::Slot: // Qt specific
switch (md->protection())
{
case Protected:
proSlots.append(md);
md->setSectionList(&proSlots);
break;
case Public:
pubSlots.append(md);
md->setSectionList(&pubSlots);
break;
case Private:
priSlots.append(md);
md->setSectionList(&priSlots);
break;
}
break;
default: // any of the other members
if (md->isStatic())
{
if (md->isVariable())
{
switch (md->protection())
{
case Protected:
proStaticAttribs.append(md);
md->setSectionList(&proStaticAttribs);
break;
case Public:
pubStaticAttribs.append(md);
md->setSectionList(&pubStaticAttribs);
break;
case Private:
priStaticAttribs.append(md);
md->setSectionList(&priStaticAttribs);
break;
}
}
else // function
{
switch (md->protection())
{
case Protected:
proStaticMembers.append(md);
md->setSectionList(&proStaticMembers);
break;
case Public:
pubStaticMembers.append(md);
md->setSectionList(&pubStaticMembers);
break;
case Private:
priStaticMembers.append(md);
md->setSectionList(&priStaticMembers);
break;
}
}
}
else // not static
{
if (md->isVariable())
{
switch (md->protection())
{
case Protected:
proAttribs.append(md);
md->setSectionList(&proAttribs);
break;
case Public:
pubAttribs.append(md);
md->setSectionList(&pubAttribs);
break;
case Private:
priAttribs.append(md);
md->setSectionList(&priAttribs);
break;
}
}
else if (md->isTypedef() || md->isEnumerate() || md->isEnumValue())
{
switch (md->protection())
{
case Protected:
proTypes.append(md);
md->setSectionList(&proTypes);
break;
case Public:
pubTypes.append(md);
md->setSectionList(&pubTypes);
break;
case Private:
priTypes.append(md);
md->setSectionList(&priTypes);
break;
}
}
else // member function
{
switch (md->protection())
{
case Protected:
proMembers.append(md);
md->setSectionList(&proMembers);
break;
case Public:
pubMembers.append(md);
md->setSectionList(&pubMembers);
break;
case Private:
priMembers.append(md);
md->setSectionList(&priMembers);
break;
}
}
}
break;
}
}
/*******************************************************/
/* insert member in the detailed documentation section */
/*******************************************************/
if ((md->isRelated() &&
(Config_getBool("EXTRACT_PRIVATE") || md->protection()!=Private)
) || md->isFriend()
)
{
if (Config_getBool("SORT_MEMBER_DOCS"))
relatedMembers.inSort(md);
else
relatedMembers.append(md);
}
else
{
switch (md->memberType())
{
case MemberDef::Property:
if (Config_getBool("SORT_MEMBER_DOCS"))
propertyMembers.inSort(md);
else
propertyMembers.append(md);
break;
case MemberDef::Signal: // fall through
case MemberDef::DCOP:
if (Config_getBool("SORT_MEMBER_DOCS"))
functionMembers.inSort(md);
else
functionMembers.append(md);
break;
case MemberDef::Slot:
switch (md->protection())
{
case Protected:
if (Config_getBool("SORT_MEMBER_DOCS"))
functionMembers.inSort(md);
else
functionMembers.append(md);
break;
case Public:
if (Config_getBool("SORT_MEMBER_DOCS"))
functionMembers.inSort(md);
else
functionMembers.append(md);
break;
case Private:
if (Config_getBool("EXTRACT_PRIVATE"))
{
if (Config_getBool("SORT_MEMBER_DOCS"))
functionMembers.inSort(md);
else
functionMembers.append(md);
}
break;
}
break;
default: // any of the other members
if (md->protection()!=Private || Config_getBool("EXTRACT_PRIVATE"))
{
switch (md->memberType())
{
case MemberDef::Typedef:
if (Config_getBool("SORT_MEMBER_DOCS"))
typedefMembers.inSort(md);
else
typedefMembers.append(md);
break;
case MemberDef::Enumeration:
if (Config_getBool("SORT_MEMBER_DOCS"))
enumMembers.inSort(md);
else
enumMembers.append(md);
break;
case MemberDef::EnumValue:
if (Config_getBool("SORT_MEMBER_DOCS"))
enumValMembers.inSort(md);
else
enumValMembers.append(md);
break;
case MemberDef::Function:
if (md->name()==localName() || // constructor
(md->name().find('~')!=-1 && // hack to detect destructor
md->name().find("operator")==-1
)
)
{
constructors.append(md);
}
else
{
if (Config_getBool("SORT_MEMBER_DOCS"))
functionMembers.inSort(md);
else
functionMembers.append(md);
}
break;
case MemberDef::Variable:
if (Config_getBool("SORT_MEMBER_DOCS"))
variableMembers.inSort(md);
else
variableMembers.append(md);
break;
default:
err("Unexpected member type %d found!\n",md->memberType());
}
}
break;
}
}
/*************************************************/
/* insert member in the appropriate member group */
/*************************************************/
// Note: this must be done AFTER inserting the member in the
// regular groups
//addMemberToGroup(md,groupId);
}
if (md->virtualness()==Pure)
{
m_isAbstract=TRUE;
}
MemberInfo *mi = new MemberInfo((MemberDef *)md,
md->protection(),md->virtualness(),FALSE);
MemberNameInfo *mni=0;
if ((mni=m_allMemberNameInfoSDict->find(md->name())))
{
mni->append(mi);
}
else
{
mni = new MemberNameInfo(md->name());
mni->append(mi);
m_allMemberNameInfoSDict->inSort(mni->memberName(),mni);
}
}
//void ClassDef::computeMemberGroups()
//{
// MemberNameInfoListIterator mnili(*m_allMemberNameInfoList);
// MemberNameInfo *mni;
// for (;(mni=mnili.current());++mnili)
// {
// MemberNameInfoIterator mnii(*mni);
// MemberInfo *mi;
// for (mnii.toFirst();(mi=mnii.current());++mnii)
// {
// MemberDef *md=mi->memberDef;
// MemberGroup *mg = md->getMemberGroup();
// if (mg && m_memberGroupDict->find(mg->groupId())==0)
// {
// m_memberGroupDict->insert(mg->groupId(),mg);
// m_memberGroupList->append(mg);
// }
// }
// }
//}
// compute the anchors for all members
void ClassDef::computeAnchors()
{
setAnchors('a',&pubMembers);
setAnchors('b',&proMembers);
setAnchors('c',&priMembers);
setAnchors('d',&pubStaticMembers);
setAnchors('e',&proStaticMembers);
setAnchors('f',&priStaticMembers);
setAnchors('g',&pubSlots);
setAnchors('h',&proSlots);
setAnchors('i',&priSlots);
setAnchors('j',&signals);
setAnchors('k',&related);
setAnchors('l',&friends);
setAnchors('m',&pubAttribs);
setAnchors('n',&proAttribs);
setAnchors('o',&priAttribs);
setAnchors('p',&pubStaticAttribs);
setAnchors('q',&proStaticAttribs);
setAnchors('r',&priStaticAttribs);
setAnchors('s',&pubTypes);
setAnchors('t',&proTypes);
setAnchors('u',&priTypes);
setAnchors('v',&dcopMethods);
setAnchors('w',&properties);
}
void ClassDef::distributeMemberGroupDocumentation()
{
MemberGroupListIterator mgli(*m_memberGroupList);
MemberGroup *mg;
for (;(mg=mgli.current());++mgli)
{
mg->distributeMemberGroupDocumentation();
}
}
// add a file name to the used files set
void ClassDef::insertUsedFile(const char *f)
{
if (m_files.find(f)==-1) m_files.append(f);
if (m_templateInstances)
{
QDictIterator<ClassDef> qdi(*m_templateInstances);
ClassDef *cd;
for (qdi.toFirst();(cd=qdi.current());++qdi)
{
cd->insertUsedFile(f);
}
}
}
static void writeInheritanceSpecifier(OutputList &ol,BaseClassDef *bcd)
{
if (bcd->prot!=Public || bcd->virt!=Normal)
{
ol.startTypewriter();
ol.docify(" [");
QStrList sl;
if (bcd->prot==Protected) sl.append("protected");
else if (bcd->prot==Private) sl.append("private");
if (bcd->virt==Virtual) sl.append("virtual");
const char *s=sl.first();
while (s)
{
ol.docify(s);
s=sl.next();
if (s) ol.docify(", ");
}
ol.docify("]");
ol.endTypewriter();
}
}
void ClassDef::setIncludeFile(FileDef *fd,const char *includeName,bool local)
{
//printf("ClassDef::setInclude(%p,%s,%d)\n",fd,includeName,local);
if (!m_incInfo) m_incInfo=new IncludeInfo;
if ((includeName && m_incInfo->includeName.isEmpty()) ||
(fd!=0 && m_incInfo->fileDef==0)
)
{
//printf("Setting file info\n");
m_incInfo->fileDef = fd;
m_incInfo->includeName = includeName;
m_incInfo->local = local;
}
}
// TODO: fix this: a nested template class can have multiple outer templates
ArgumentList *ClassDef::outerTemplateArguments() const
{
int ti;
ClassDef *pcd=0;
int pi=0;
if (m_tempArgs) return m_tempArgs;
// find the outer most class scope
while ((ti=name().find("::",pi))!=-1 &&
(pcd=getClass(name().left(ti)))==0
) pi=ti+2;
if (pcd)
{
return pcd->templateArguments();
}
return 0;
}
static void searchTemplateSpecs(/*in*/ Definition *d,
/*out*/ QList<ArgumentList> &result,
/*out*/ QCString &name)
{
if (d->definitionType()==Definition::TypeClass)
{
if (d->getOuterScope())
{
searchTemplateSpecs(d->getOuterScope(),result,name);
}
ClassDef *cd=(ClassDef *)d;
if (!name.isEmpty()) name+="::";
name+=d->localName();
bool isSpecialization = d->localName().find('<')!=-1;
if (cd->templateArguments())
{
result.append(cd->templateArguments());
if (!isSpecialization)
{
name+=tempArgListToString(cd->templateArguments());
}
}
}
else
{
name+=d->qualifiedName();
}
}
static void writeTemplateSpec(OutputList &ol,Definition *d,
const QCString &type)
{
QList<ArgumentList> specs;
QCString name;
searchTemplateSpecs(d,specs,name);
if (specs.count()>0) // class has template scope specifiers
{
ol.startSubsubsection();
QListIterator<ArgumentList> spi(specs);
ArgumentList *al;
for (spi.toFirst();(al=spi.current());++spi)
{
ol.docify("template<");
Argument *a=al->first();
while (a)
{
ol.docify(a->type);
if (!a->name.isEmpty())
{
ol.docify(" ");
ol.docify(a->name);
}
if (a->defval.length()!=0)
{
ol.docify(" = ");
ol.docify(a->defval);
}
a=al->next();
if (a) ol.docify(", ");
}
ol.docify(">");
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Html);
ol.lineBreak();
ol.popGeneratorState();
}
ol.docify(type.lower()+" "+name);
ol.endSubsubsection();
ol.writeString("\n");
}
}
// write all documentation for this class
void ClassDef::writeDocumentation(OutputList &ol)
{
// write title
QCString pageTitle=name().copy();
QCString pageType;
ArgumentList *outerTempArgList = outerTemplateArguments();
QCString cType=compoundTypeString();
toupper(cType.at(0));
pageType+=" ";
pageType+=cType;
pageTitle+=pageType+" Reference";
if (outerTempArgList) pageTitle.prepend(" Template");
startFile(ol,getOutputFileBase(),name(),pageTitle);
startTitle(ol,getOutputFileBase());
parseText(ol,theTranslator->trCompoundReference(name(),m_compType,outerTempArgList!=0));
endTitle(ol,getOutputFileBase(),name());
ol.startTextBlock();
//printf("Class %s brief=`%s' doc=`%s'\n",name().data(),briefDescription().data(),documentation().data());
bool exampleFlag=hasExamples();
// write brief description
OutputList briefOutput(&ol);
if (!briefDescription().isEmpty())
{
parseDoc(briefOutput,m_defFileName,m_defLine,name(),0,briefDescription());
ol+=briefOutput;
ol.writeString(" \n");
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Html);
ol.startTextLink(0,"_details");
if (Config_getBool("REPEAT_BRIEF") ||
!documentation().isEmpty() ||
exampleFlag
)
{
parseText(ol,theTranslator->trMore());
}
ol.endTextLink();
ol.popGeneratorState();
ol.disable(OutputGenerator::Man);
ol.newParagraph();
ol.enable(OutputGenerator::Man);
}
ol.writeSynopsis();
if (m_incInfo)
{
QCString nm=m_incInfo->includeName.isEmpty() ?
(m_incInfo->fileDef ?
m_incInfo->fileDef->docName().data() : ""
) :
m_incInfo->includeName.data();
if (!nm.isEmpty())
{
ol.startTypewriter();
ol.docify("#include ");
if (m_incInfo->local)
ol.docify("\"");
else
ol.docify("<");
ol.pushGeneratorState();
ol.disable(OutputGenerator::Html);
ol.docify(nm);
ol.disableAllBut(OutputGenerator::Html);
ol.enable(OutputGenerator::Html);
if (m_incInfo->fileDef)
{
ol.writeObjectLink(0,m_incInfo->fileDef->includeName(),0,nm);
}
else
{
ol.docify(nm);
}
ol.popGeneratorState();
if (m_incInfo->local)
ol.docify("\"");
else
ol.docify(">");
ol.endTypewriter();
ol.newParagraph();
}
}
if (!Config_getString("GENERATE_TAGFILE").isEmpty())
{
Doxygen::tagFile << " <compound kind=\"" << compoundTypeString();
Doxygen::tagFile << "\">" << endl;
Doxygen::tagFile << " <name>" << convertToXML(name()) << "</name>" << endl;
Doxygen::tagFile << " <filename>" << convertToXML(getOutputFileBase()) << ".html</filename>" << endl;
if (m_tempArgs)
{
ArgumentListIterator ali(*m_tempArgs);
Argument *a;
for (;(a=ali.current());++ali)
{
Doxygen::tagFile << " <templarg>" << convertToXML(a->name) << "</templarg>" << endl;
}
}
}
if (Config_getBool("CLASS_DIAGRAMS")) ol.disableAllBut(OutputGenerator::Man);
// write super classes
int count;
if ((count=m_inherits->count())>0)
{
//parseText(ol,theTranslator->trInherits()+" ");
QCString inheritLine = theTranslator->trInheritsList(m_inherits->count());
QRegExp marker("@[0-9]+");
int index=0,newIndex,matchLen;
// now replace all markers in inheritLine with links to the classes
while ((newIndex=marker.match(inheritLine,index,&matchLen))!=-1)
{
parseText(ol,inheritLine.mid(index,newIndex-index));
bool ok;
uint entryIndex = inheritLine.mid(newIndex+1,matchLen-1).toUInt(&ok);
BaseClassDef *bcd=m_inherits->at(entryIndex);
if (ok && bcd)
{
ClassDef *cd=bcd->classDef;
if (cd->isLinkable())
{
if (!Config_getString("GENERATE_TAGFILE").isEmpty())
{
Doxygen::tagFile << " <base";
if (bcd->prot==Protected)
{
Doxygen::tagFile << " protection=\"protected\"";
}
else if (bcd->prot==Private)
{
Doxygen::tagFile << " protection=\"private\"";
}
if (bcd->virt==Virtual)
{
Doxygen::tagFile << " virtualness=\"virtual\"";
}
Doxygen::tagFile << ">" << convertToXML(cd->name()) << "</base>" << endl;
}
ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->name()+bcd->templSpecifiers);
}
else
{
ol.docify(cd->name());
}
}
else
{
err("Error: invalid marker %d in inherits list!\n",entryIndex);
}
index=newIndex+matchLen;
}
parseText(ol,inheritLine.right(inheritLine.length()-index));
ol.newParagraph();
}
// write subclasses
if ((count=m_inheritedBy->count())>0)
{
QCString inheritLine = theTranslator->trInheritedByList(m_inheritedBy->count());
QRegExp marker("@[0-9]+");
int index=0,newIndex,matchLen;
// now replace all markers in inheritLine with links to the classes
while ((newIndex=marker.match(inheritLine,index,&matchLen))!=-1)
{
parseText(ol,inheritLine.mid(index,newIndex-index));
bool ok;
uint entryIndex = inheritLine.mid(newIndex+1,matchLen-1).toUInt(&ok);
BaseClassDef *bcd=m_inheritedBy->at(entryIndex);
if (ok && bcd)
{
ClassDef *cd=bcd->classDef;
if (cd->isLinkable())
{
ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->name());
}
else
{
ol.docify(cd->name());
}
writeInheritanceSpecifier(ol,bcd);
}
index=newIndex+matchLen;
}
parseText(ol,inheritLine.right(inheritLine.length()-index));
ol.newParagraph();
}
if (Config_getBool("CLASS_DIAGRAMS")) ol.enableAll();
count=0;
BaseClassDef *ibcd;
ibcd=m_inheritedBy->first();
while (ibcd)
{
ClassDef *icd=ibcd->classDef;
if ( icd->isVisibleInHierarchy()) count++;
ibcd=m_inheritedBy->next();
}
ibcd=m_inherits->first();
while (ibcd)
{
ClassDef *icd=ibcd->classDef;
if ( icd->isVisibleInHierarchy()) count++;
ibcd=m_inherits->next();
}
if (Config_getBool("HAVE_DOT") && Config_getBool("CLASS_GRAPH"))
// write class diagram using dot
{
DotClassGraph inheritanceGraph(this,DotClassGraph::Inheritance);
if (!inheritanceGraph.isTrivial())
{
ol.pushGeneratorState();
ol.disable(OutputGenerator::Man);
ol.startDotGraph();
parseText(ol,theTranslator->trClassDiagram(name()));
ol.endDotGraph(inheritanceGraph);
if (Config_getBool("GENERATE_LEGEND"))
{
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Html);
ol.writeString("<center><font size=\"2\">[");
ol.startHtmlLink("graph_legend.html");
ol.docify(theTranslator->trLegend());
ol.endHtmlLink();
ol.writeString("]</font></center>");
ol.popGeneratorState();
}
ol.popGeneratorState();
}
}
else if (Config_getBool("CLASS_DIAGRAMS") && count>0)
// write class diagram using build-in generator
{
ClassDiagram diagram(this); // create a diagram of this class.
ol.startClassDiagram();
ol.disable(OutputGenerator::Man);
parseText(ol,theTranslator->trClassDiagram(name()));
ol.enable(OutputGenerator::Man);
ol.endClassDiagram(diagram,getOutputFileBase(),name());
}
if (Config_getBool("HAVE_DOT") && Config_getBool("COLLABORATION_GRAPH"))
{
DotClassGraph usageImplGraph(this,DotClassGraph::Implementation);
if (!usageImplGraph.isTrivial())
{
ol.pushGeneratorState();
ol.disable(OutputGenerator::Man);
ol.startDotGraph();
parseText(ol,theTranslator->trCollaborationDiagram(name()));
ol.endDotGraph(usageImplGraph);
if (Config_getBool("GENERATE_LEGEND"))
{
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Html);
ol.writeString("<center><font size=\"2\">[");
ol.startHtmlLink("graph_legend.html");
ol.docify(theTranslator->trLegend());
ol.endHtmlLink();
ol.writeString("]</font></center>");
ol.popGeneratorState();
}
ol.popGeneratorState();
}
}
// write link to list of all members (HTML only)
if (m_allMemberNameInfoSDict->count()>0 &&
!Config_getBool("OPTIMIZE_OUTPUT_FOR_C"))
{
ol.disableAllBut(OutputGenerator::Html);
ol.startTextLink(m_memListFileName,0);
parseText(ol,theTranslator->trListOfAllMembers());
ol.endTextLink();
ol.enableAll();
}
ol.endTextBlock();
// write member groups
ol.startMemberSections();
// write user defined member groups
MemberGroupListIterator mgli(*m_memberGroupList);
MemberGroup *mg;
for (;(mg=mgli.current());++mgli)
{
if (!mg->allMembersInSameSection() || !m_subGrouping) // group is in its own section
{
mg->writeDeclarations(ol,this,0,0,0);
}
else // add this group to the corresponding member section
{
mg->addToDeclarationSection();
}
}
// public types
pubTypes.writeDeclarations(ol,this,0,0,0,theTranslator->trPublicTypes(),0);
// public methods
pubSlots.writeDeclarations(ol,this,0,0,0,theTranslator->trPublicSlots(),0);
signals.writeDeclarations(ol,this,0,0,0,theTranslator->trSignals(),0);
dcopMethods.writeDeclarations(ol,this,0,0,0,theTranslator->trDCOPMethods(),0);
properties.writeDeclarations(ol,this,0,0,0,theTranslator->trProperties(),0);
pubMembers.writeDeclarations(ol,this,0,0,0,theTranslator->trPublicMembers(),0);
pubStaticMembers.writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPublicMembers(),0);
// public attribs
pubAttribs.writeDeclarations(ol,this,0,0,0,theTranslator->trPublicAttribs(),0);
pubStaticAttribs.writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPublicAttribs(),0);
// protected types
proTypes.writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedTypes(),0);
// protected methods
proSlots.writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedSlots(),0);
proMembers.writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedMembers(),0);
proStaticMembers.writeDeclarations(ol,this,0,0,0,theTranslator->trStaticProtectedMembers(),0);
// protected attribs
proAttribs.writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedAttribs(),0);
proStaticAttribs.writeDeclarations(ol,this,0,0,0,theTranslator->trStaticProtectedAttribs(),0);
if (Config_getBool("EXTRACT_PRIVATE"))
{
// private types
priTypes.writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateTypes(),0);
// private members
priSlots.writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateSlots(),0);
priMembers.writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateMembers(),0);
priStaticMembers.writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPrivateMembers(),0);
// private attribs
priAttribs.writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateAttribs(),0);
priStaticAttribs.writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPrivateAttribs(),0);
}
// friends
friends.writeDeclarations(ol,this,0,0,0,theTranslator->trFriends(),0);
// related functions
related.writeDeclarations(ol,this,0,0,0,
theTranslator->trRelatedFunctions(),
theTranslator->trRelatedSubscript()
);
ol.endMemberSections();
// write detailed description
if ((!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) ||
!documentation().isEmpty() ||
/*(Config_getBool("SOURCE_BROWSER") && startBodyLine!=-1 && bodyDef) ||*/
exampleFlag)
{
ol.writeRuler();
ol.pushGeneratorState();
ol.disable(OutputGenerator::Latex);
ol.disable(OutputGenerator::RTF);
ol.writeAnchor(0,"_details");
ol.popGeneratorState();
ol.startGroupHeader();
parseText(ol,theTranslator->trDetailedDescription());
ol.endGroupHeader();
ol.startTextBlock();
writeTemplateSpec(ol,this,pageType);
// repeat brief description
if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF"))
{
ol+=briefOutput;
}
if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF") &&
!documentation().isEmpty())
{
ol.newParagraph();
}
// write documentation
if (!documentation().isEmpty())
{
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::RTF);
ol.newParagraph();
ol.popGeneratorState();
parseDoc(ol,m_defFileName,m_defLine,name(),0,documentation()+"\n");
}
// write examples
if (exampleFlag)
{
ol.startDescList(BaseOutputDocInterface::Examples);
parseText(ol,theTranslator->trExamples()+": ");
ol.endDescTitle();
ol.writeDescItem();
ol.newParagraph();
writeExample(ol,m_exampleSDict);
//ol.endDescItem();
ol.endDescList();
}
ol.newParagraph();
writeSourceDef(ol,name());
ol.endTextBlock();
}
else
{
writeTemplateSpec(ol,this,pageType);
}
typedefMembers.writeDocumentation(ol,name(),this,
theTranslator->trMemberTypedefDocumentation());
enumMembers.writeDocumentation(ol,name(),this,
theTranslator->trMemberEnumerationDocumentation());
constructors.writeDocumentation(ol,name(),this,
theTranslator->trConstructorDocumentation());
functionMembers.writeDocumentation(ol,name(),this,
theTranslator->trMemberFunctionDocumentation());
relatedMembers.writeDocumentation(ol,name(),this,
theTranslator->trRelatedFunctionDocumentation());
variableMembers.writeDocumentation(ol,name(),this,
theTranslator->trMemberDataDocumentation());
propertyMembers.writeDocumentation(ol,name(),this,
theTranslator->trPropertyDocumentation());
ol.startTextBlock();
// write the list of used files (not for man pages)
ol.pushGeneratorState();
if (Config_getBool("SHOW_USED_FILES"))
{
ol.disable(OutputGenerator::Man);
ol.writeRuler();
parseText(ol,theTranslator->trGeneratedFromFiles(m_compType,m_files.count()==1));
bool first=TRUE;
const char *file = m_files.first();
while (file)
{
bool ambig;
FileDef *fd=findFileDef(Doxygen::inputNameDict,file,ambig);
if (fd)
{
if (first)
{
first=FALSE;
ol.startItemList();
}
ol.writeListItem();
QCString path=fd->getPath().copy();
if (Config_getBool("FULL_PATH_NAMES"))
{
ol.docify(stripFromPath(path));
}
if (fd->generateSourceFile())
{
ol.writeObjectLink(0,fd->getSourceFileBase(),0,fd->name());
}
else if (fd->isLinkable())
{
ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,
fd->name());
}
else
{
ol.docify(fd->name());
}
}
file=m_files.next();
}
if (!first) ol.endItemList();
}
// write Author section (Man only)
ol.enable(OutputGenerator::Man);
ol.disableAllBut(OutputGenerator::Man);
ol.writeString("\n");
ol.startGroupHeader();
parseText(ol,theTranslator->trAuthor(TRUE,TRUE));
ol.endGroupHeader();
parseText(ol,theTranslator->trGeneratedAutomatically(Config_getString("PROJECT_NAME")));
ol.popGeneratorState();
ol.endTextBlock();
if (!Config_getString("GENERATE_TAGFILE").isEmpty())
{
writeDocAnchorsToTagFile();
Doxygen::tagFile << " </compound>" << endl;
}
endFile(ol);
}
void ClassDef::writeDocumentationForInnerClasses(OutputList &ol)
{
// write inner classes after the parent, so the tag files contain
// the definition in proper order!
if (m_innerClasses)
{
ClassSDict::Iterator cli(*m_innerClasses);
ClassDef *innerCd;
for (cli.toFirst();(innerCd=cli.current());++cli)
{
if (innerCd->isLinkableInProject() && innerCd->templateMaster()==0)
{
msg("Generating docs for nested compound %s...\n",innerCd->name().data());
innerCd->writeDocumentation(ol);
innerCd->writeMemberList(ol);
}
}
}
}
// write the list of all (inherited) members for this class
void ClassDef::writeMemberList(OutputList &ol)
{
if (m_allMemberNameInfoSDict->count()==0 ||
Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) return;
// only for HTML
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Html);
startFile(ol,m_memListFileName,m_memListFileName,
theTranslator->trMemberList());
startTitle(ol,0);
parseText(ol,name()+" "+theTranslator->trMemberList());
endTitle(ol,0,0);
parseText(ol,theTranslator->trThisIsTheListOfAllMembers());
ol.writeObjectLink(getReference(),getOutputFileBase(),0,name());
parseText(ol,theTranslator->trIncludingInheritedMembers());
//ol.startItemList();
ol.writeString("<table>\n");
//MemberNameInfo *mni=m_allMemberNameInfoList->first();
MemberNameInfoSDict::Iterator mnii(*m_allMemberNameInfoSDict);
MemberNameInfo *mni;
for (mnii.toFirst();(mni=mnii.current());++mnii)
{
MemberInfo *mi=mni->first();
while (mi)
{
MemberDef *md=mi->memberDef;
ClassDef *cd=md->getClassDef();
Protection prot = mi->prot;
//printf("%s: Member %s of class %s md->protection()=%d mi->prot=%d prot=%d inherited=%d\n",
// name().data(),md->name().data(),cd->name().data(),md->protection(),mi->prot,prot,mi->inherited);
Specifier virt=md->virtualness();
MemberDef *rmd=md->reimplements();
while (rmd && virt==Normal)
{
virt = rmd->virtualness()==Normal ? Normal : Virtual;
rmd = rmd->reimplements();
}
if (cd && !md->name().isEmpty() && md->name()[0]!='@')
{
bool memberWritten=FALSE;
if (cd->isLinkable() && md->isLinkable())
// create a link to the documentation
{
QCString name=mi->ambiguityResolutionScope+md->name();
//ol.writeListItem();
ol.writeString(" <tr bgcolor=\"#f0f0f0\"><td>");
Definition *bd = md->getGroupDef();
if (bd==0) bd=cd;
ol.writeObjectLink(bd->getReference(),bd->getOutputFileBase(),
md->anchor(),name);
if ( md->isFunction() || md->isSignal() || md->isSlot() ||
(md->isFriend() && md->argsString()))
ol.docify(md->argsString());
else if (md->isEnumerate())
parseText(ol," "+theTranslator->trEnumName());
else if (md->isEnumValue())
parseText(ol," "+theTranslator->trEnumValue());
else if (md->isTypedef())
ol.docify(" typedef");
else if (md->isFriend() && !strcmp(md->typeString(),"friend class"))
ol.docify(" class");
//ol.writeString("\n");
ol.writeString("</td>");
memberWritten=TRUE;
}
else if (!Config_getBool("HIDE_UNDOC_MEMBERS")) // no documentation,
// generate link to the class instead.
{
//ol.writeListItem();
ol.writeString(" <tr bgcolor=\"#f0f0f0\"><td>");
ol.startBold();
ol.docify(md->name());
ol.endBold();
if ( md->isFunction() || md->isSignal() || md->isSlot() )
ol.docify(md->argsString());
else if (md->isEnumerate())
parseText(ol," "+theTranslator->trEnumName());
else if (md->isEnumValue())
parseText(ol," "+theTranslator->trEnumValue());
else if (md->isTypedef())
ol.docify(" typedef");
ol.writeString(" (");
parseText(ol,theTranslator->trDefinedIn()+" ");
if (cd->isLinkable())
{
ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->name());
}
else
{
ol.startBold();
ol.docify(cd->name());
ol.endBold();
}
ol.writeString(")");
ol.writeString("</td>");
memberWritten=TRUE;
}
if (memberWritten)
{
ol.writeString("<td>");
ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),
0,cd->name());
ol.writeString("</td>");
ol.writeString("<td>");
}
if ((prot!=Public || virt!=Normal ||
md->isFriend() || md->isRelated() || md->isExplicit() ||
md->isMutable() || (md->isInline() && Config_getBool("INLINE_INFO")) ||
md->isSignal() || md->isSlot() ||
md->isStatic()
)
&& memberWritten)
{
ol.startTypewriter();
ol.docify(" [");
QStrList sl;
if (md->isFriend()) sl.append("friend");
else if (md->isRelated()) sl.append("related");
else
{
if (Config_getBool("INLINE_INFO") && md->isInline())
sl.append("inline");
if (md->isExplicit()) sl.append("explicit");
if (md->isMutable()) sl.append("mutable");
if (prot==Protected) sl.append("protected");
else if (prot==Private) sl.append("private");
if (virt==Virtual) sl.append("virtual");
else if (virt==Pure) sl.append("pure virtual");
if (md->isStatic()) sl.append("static");
if (md->isSignal()) sl.append("signal");
if (md->isSlot()) sl.append("slot");
}
const char *s=sl.first();
while (s)
{
ol.docify(s);
s=sl.next();
if (s) ol.docify(", ");
}
ol.docify("]");
ol.endTypewriter();
}
if (memberWritten)
{
ol.writeString("</td>");
ol.writeString("</tr>\n");
}
}
mi=mni->next();
}
}
//ol.endItemList();
ol.writeString("</table>");
endFile(ol);
ol.popGeneratorState();
}
// add a reference to an example
bool ClassDef::addExample(const char *anchor,const char *nameStr,
const char *file)
{
if (m_exampleSDict && !m_exampleSDict->find(nameStr))
{
Example *e=new Example;
e->anchor=anchor;
e->name=nameStr;
e->file=file;
m_exampleSDict->inSort(nameStr,e);
return TRUE;
}
return FALSE;
}
// returns TRUE if this class is used in an example
bool ClassDef::hasExamples()
{
if (m_exampleSDict==0)
return FALSE;
else
return m_exampleSDict->count()>0;
}
void ClassDef::setTemplateArguments(ArgumentList *al)
{
if (al==0) return;
if (!m_tempArgs) delete m_tempArgs; // delete old list if needed
m_tempArgs=new ArgumentList;
m_tempArgs->setAutoDelete(TRUE);
ArgumentListIterator ali(*al);
Argument *a;
for (;(a=ali.current());++ali)
{
m_tempArgs->append(new Argument(*a));
}
}
/*! Returns \c TRUE iff this class or a class inheriting from this class
* is \e not defined in an external tag file.
*/
bool ClassDef::hasNonReferenceSuperClass()
{
bool found=!isReference();
if (found) return TRUE; // we're done if this class is not a reference
BaseClassListIterator bcli(*m_inheritedBy);
for ( ; bcli.current() && !found ; ++bcli ) // for each super class
{
ClassDef *bcd=bcli.current()->classDef;
// recurse into the super class branch
found = found || bcd->hasNonReferenceSuperClass();
if (!found)
{
// look for template instances that might have non-reference super classes
QDict<ClassDef> *cil = bcd->getTemplateInstances();
if (cil)
{
QDictIterator<ClassDef> tidi(*cil);
for ( ; tidi.current() && !found ; ++tidi) // for each template instance
{
// recurse into the template instance branch
found = found || tidi.current()->hasNonReferenceSuperClass();
}
}
}
}
return found;
}
/*! called from MemberDef::writeDeclaration() to (recusively) write the
* definition of an annonymous struct, union or class.
*/
void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup)
{
//ol.insertMemberAlign();
//printf("ClassName=`%s' inGroup=%d\n",name().data(),inGroup);
//if (inGroup && md && md->getClassDef()==this) return;
ol.docify(compoundTypeString());
int ri=name().findRev("::");
if (ri==-1) ri=name().length();
QCString cn=name().right(name().length()-ri-2);
if (!cn.isEmpty() && cn.at(0)!='@' && md)
{
ol.docify(" ");
if (isLinkable())
{
ol.writeObjectLink(0,0,md->anchor(),cn);
}
else
{
ol.startBold();
ol.docify(cn);
ol.endBold();
}
}
ol.docify(" {");
ol.endMemberItem(FALSE);
// write user defined member groups
MemberGroupListIterator mgli(*m_memberGroupList);
MemberGroup *mg;
for (;(mg=mgli.current());++mgli)
{
mg->setInGroup(inGroup);
mg->writePlainDeclarations(ol,this,0,0,0);
}
pubTypes.setInGroup(inGroup);
pubTypes.writePlainDeclarations(ol,this,0,0,0);
pubMembers.setInGroup(inGroup);
pubMembers.writePlainDeclarations(ol,this,0,0,0);
pubAttribs.setInGroup(inGroup);
pubAttribs.writePlainDeclarations(ol,this,0,0,0);
pubSlots.setInGroup(inGroup);
pubSlots.writePlainDeclarations(ol,this,0,0,0);
signals.setInGroup(inGroup);
signals.writePlainDeclarations(ol,this,0,0,0);
dcopMethods.setInGroup(inGroup);
dcopMethods.writePlainDeclarations(ol,this,0,0,0);
properties.setInGroup(inGroup);
properties.writePlainDeclarations(ol,this,0,0,0);
pubStaticMembers.setInGroup(inGroup);
pubStaticMembers.writePlainDeclarations(ol,this,0,0,0);
pubStaticAttribs.setInGroup(inGroup);
pubStaticAttribs.writePlainDeclarations(ol,this,0,0,0);
proTypes.setInGroup(inGroup);
proTypes.writePlainDeclarations(ol,this,0,0,0);
proMembers.setInGroup(inGroup);
proMembers.writePlainDeclarations(ol,this,0,0,0);
proAttribs.setInGroup(inGroup);
proAttribs.writePlainDeclarations(ol,this,0,0,0);
proSlots.setInGroup(inGroup);
proSlots.writePlainDeclarations(ol,this,0,0,0);
proStaticMembers.setInGroup(inGroup);
proStaticMembers.writePlainDeclarations(ol,this,0,0,0);
proStaticAttribs.setInGroup(inGroup);
proStaticAttribs.writePlainDeclarations(ol,this,0,0,0);
if (Config_getBool("EXTRACT_PRIVATE"))
{
priTypes.setInGroup(inGroup);
priTypes.writePlainDeclarations(ol,this,0,0,0);
priMembers.setInGroup(inGroup);
priMembers.writePlainDeclarations(ol,this,0,0,0);
priAttribs.setInGroup(inGroup);
priAttribs.writePlainDeclarations(ol,this,0,0,0);
priSlots.setInGroup(inGroup);
priSlots.writePlainDeclarations(ol,this,0,0,0);
priStaticMembers.setInGroup(inGroup);
priStaticMembers.writePlainDeclarations(ol,this,0,0,0);
priStaticAttribs.setInGroup(inGroup);
priStaticAttribs.writePlainDeclarations(ol,this,0,0,0);
}
friends.setInGroup(inGroup);
friends.writePlainDeclarations(ol,this,0,0,0);
related.setInGroup(inGroup);
related.writePlainDeclarations(ol,this,0,0,0);
}
/*! a link to this class is possible within this project */
bool ClassDef::isLinkableInProject() const
{
if (m_templateMaster)
{
return m_templateMaster->isLinkableInProject();
}
else
{
return !name().isEmpty() && /* no name */
//m_isTemplBaseClass==-1 && /* template base class */
!m_artificial &&
name().find('@')==-1 && /* anonymous compound */
(m_prot!=Private || Config_getBool("EXTRACT_PRIVATE")) && /* private */
hasDocumentation() && /* documented */
!isReference() && /* not an external reference */
(!m_isStatic || Config_getBool("EXTRACT_STATIC"));
}
}
bool ClassDef::isLinkable() const
{
if (m_templateMaster)
{
return m_templateMaster->isLinkable();
}
else
{
return isLinkableInProject() || isReference();
}
}
/*! the class is visible in a class diagram, or class hierarchy */
bool ClassDef::isVisibleInHierarchy()
{
return // show all classes or a subclass is visible
(Config_getBool("ALLEXTERNALS") || hasNonReferenceSuperClass()) &&
// and not an annonymous compound
name().find('@')==-1 &&
// not an artifically introduced class
!m_artificial &&
// and not privately inherited
(m_prot!=Private || Config_getBool("EXTRACT_PRIVATE")) &&
// documented or shown anyway or documentation is external
(hasDocumentation() ||
!Config_getBool("HIDE_UNDOC_CLASSES") ||
isReference()
) &&
// is not part of an unnamed namespace or shown anyway
(!m_isStatic || Config_getBool("EXTRACT_STATIC"));
}
bool ClassDef::hasDocumentation() const
{
return Definition::hasDocumentation();
}
//----------------------------------------------------------------------
// recursive function:
// returns TRUE iff class definition `bcd' represents an (in)direct base
// class of class definition `cd'.
bool ClassDef::isBaseClass(ClassDef *bcd)
{
bool found=FALSE;
//printf("isBaseClass(cd=%s) looking for %s\n",cd->name().data(),bcd->name().data());
BaseClassListIterator bcli(*baseClasses());
for ( ; bcli.current() && !found ; ++bcli)
{
ClassDef *ccd=bcli.current()->classDef;
if (ccd->templateMaster()) ccd=ccd->templateMaster();
//printf("isBaseClass() baseclass %s\n",ccd->name().data());
if (ccd==bcd)
found=TRUE;
else
found=ccd->isBaseClass(bcd);
}
return found;
}
//----------------------------------------------------------------------------
/*!
* recusively merges the `all members' lists of a class base
* with that of this class. Must only be called for classes without
* subclasses!
*/
void ClassDef::mergeMembers()
{
BaseClassListIterator bcli(*baseClasses());
BaseClassDef *bcd;
for ( ; (bcd=bcli.current()) ; ++bcli )
{
ClassDef *bClass=bcd->classDef;
// merge the members in the base class of this inheritance branch first
bClass->mergeMembers();
MemberNameInfoSDict *srcMnd = bClass->memberNameInfoSDict();
MemberNameInfoSDict *dstMnd = memberNameInfoSDict();
//MemberNameInfoList *dstMnl = memberNameInfoList();
MemberNameInfoSDict::Iterator srcMnili(*srcMnd);
MemberNameInfo *srcMni;
for ( ; (srcMni=srcMnili.current()) ; ++srcMnili)
{
//printf("Base member name %s\n",srcMni->memberName());
MemberNameInfo *dstMni;
if ((dstMni=dstMnd->find(srcMni->memberName())))
// a member with that name is already in the class.
// the member may hide or reimplement the one in the sub class
// or there may be another path to the base class that is already
// visited via another branch in the class hierarchy.
{
MemberNameInfoIterator srcMnii(*srcMni);
MemberInfo *srcMi;
for ( ; (srcMi=srcMnii.current()) ; ++srcMnii )
{
MemberDef *srcMd = srcMi->memberDef;
bool found=FALSE;
bool ambigue=FALSE;
bool hidden=FALSE;
MemberNameInfoIterator dstMnii(*dstMni);
MemberInfo *dstMi;
ClassDef *srcCd = srcMd->getClassDef();
for ( ; (dstMi=dstMnii.current()) && !found; ++dstMnii )
{
MemberDef *dstMd = dstMi->memberDef;
if (srcMd!=dstMd) // different members
{
ClassDef *dstCd = dstMd->getClassDef();
//printf("Is %s a base class of %s?\n",srcCd->name(),dstCd->name());
if (srcCd==dstCd || dstCd->isBaseClass(srcCd))
// member is in the same or a base class
{
found=matchArguments(srcMd->argumentList(),
dstMd->argumentList()
);
//ambigue = ambigue || !found;
hidden = hidden || !found;
}
else // member is in a non base class => multiple inheritance
// using the same base class.
{
//printf("$$ Existing member %s %s add scope %s\n",
// dstMi->ambiguityResolutionScope.data(),
// dstMd->name().data(),
// dstMi->scopePath.left(dstMi->scopePath.find("::")+2).data());
QCString scope=dstMi->scopePath.left(dstMi->scopePath.find("::")+2);
if (scope!=dstMi->ambiguityResolutionScope.left(scope.length()))
dstMi->ambiguityResolutionScope.prepend(scope);
ambigue=TRUE;
}
}
else // same members
{
// do not add if base class is virtual or
// if scope paths are equal
if ((srcMi->virt==Virtual && dstMi->virt==Virtual) ||
bClass->name()+"::"+srcMi->scopePath == dstMi->scopePath
)
{
found=TRUE;
}
else // member can be reached via multiple paths in the
// inheritance tree
{
//printf("$$ Existing member %s %s add scope %s\n",
// dstMi->ambiguityResolutionScope.data(),
// dstMd->name().data(),
// dstMi->scopePath.left(dstMi->scopePath.find("::")+2).data());
QCString scope=dstMi->scopePath.left(dstMi->scopePath.find("::")+2);
if (scope!=dstMi->ambiguityResolutionScope.left(scope.length()))
dstMi->ambiguityResolutionScope.prepend(scope);
ambigue=TRUE;
}
}
}
//printf("member %s::%s hidden %d ambigue %d srcMi->ambigClass=%p\n",
// srcCd->name().data(),srcMd->name().data(),hidden,ambigue,srcMi->ambigClass);
// TODO: fix the case where a member is hidden by inheritance
// of a member with the same name but with another prototype,
// while there is more than one path to the member in the
// base class due to multiple inheritance. In this case
// it seems that the member is not reachable by prefixing a
// scope name either (according to my compiler). Currently,
// this case is shown anyway.
if (!found && srcMd->protection()!=Private)
{
Specifier virt=srcMi->virt;
if (srcMi->virt==Normal && bcd->virt!=Normal) virt=bcd->virt;
MemberInfo *newMi = new MemberInfo(srcMd,bcd->prot,virt,TRUE);
newMi->scopePath=bClass->name()+"::"+srcMi->scopePath;
if (ambigue)
{
//printf("$$ New member %s %s add scope %s::\n",
// srcMi->ambiguityResolutionScope.data(),
// srcMd->name().data(),
// bClass->name().data());
QCString scope=bClass->name()+"::";
if (scope!=srcMi->ambiguityResolutionScope.left(scope.length()))
newMi->ambiguityResolutionScope=
scope+srcMi->ambiguityResolutionScope.copy();
}
if (hidden)
{
if (srcMi->ambigClass==0)
{
newMi->ambigClass=bClass;
newMi->ambiguityResolutionScope=bClass->name()+"::";
}
else
{
newMi->ambigClass=srcMi->ambigClass;
newMi->ambiguityResolutionScope=srcMi->ambigClass->name()+"::";
}
}
//printf("Adding!\n");
dstMni->append(newMi);
}
}
}
else // base class has a member that is not in the sub class => copy
{
// create a deep copy of the list (only the MemberInfo's will be
// copied, not the actual MemberDef's)
MemberNameInfo *newMni = new MemberNameInfo(srcMni->memberName());
// copy the member(s) from the base to the sub class
MemberNameInfoIterator mnii(*srcMni);
MemberInfo *mi;
for (;(mi=mnii.current());++mnii)
{
Protection prot = mi->prot;
if (bcd->prot==Protected)
{
if (prot==Public) prot=Protected;
}
else if (bcd->prot==Private)
{
prot=Private;
}
//printf("%s::%s: prot=%d bcd->prot=%d result=%d\n",
// name().data(),mi->memberDef->name().data(),mi->prot,
// bcd->prot,prot);
if (mi->prot!=Private)
{
Specifier virt=mi->virt;
if (mi->virt==Normal && bcd->virt!=Normal) virt=bcd->virt;
//printf("Adding!\n");
MemberInfo *newMi=new MemberInfo(mi->memberDef,prot,virt,TRUE);
newMi->scopePath=bClass->name()+"::"+mi->scopePath;
newMi->ambigClass=mi->ambigClass;
newMi->ambiguityResolutionScope=mi->ambiguityResolutionScope.copy();
newMni->append(newMi);
}
}
// add it to the dictionary
//dstMnl->append(newMni);
dstMnd->append(newMni->memberName(),newMni);
}
}
}
}
//----------------------------------------------------------------------------
void ClassDef::addUsedClass(ClassDef *cd,const char *accessName)
{
if (m_usesImplClassDict==0) m_usesImplClassDict = new UsesClassDict(17);
UsesClassDef *ucd=m_usesImplClassDict->find(cd->name());
if (ucd==0 /*|| ucd->templSpecifiers!=templSpec*/)
{
ucd = new UsesClassDef(cd);
m_usesImplClassDict->insert(cd->name(),ucd);
//ucd->templSpecifiers = templSpec;
//printf("Adding used class %s to class %s\n",
// cd->name().data(),name().data());
}
ucd->addAccessor(accessName);
}
#if 0
/*! Builds up a dictionary of all classes that are used by the state of this
* class (the "implementation").
* Must be called before mergeMembers() is called!
*/
void ClassDef::determineImplUsageRelation()
{
MemberNameInfoSDict::Iterator mnili(*m_allMemberNameInfoSDict);
MemberNameInfo *mni;
for (;(mni=mnili.current());++mnili)
{
MemberNameInfoIterator mnii(*mni);
MemberInfo *mi;
for (mnii.toFirst();(mi=mnii.current());++mnii)
{
MemberDef *md=mi->memberDef;
if (md->isVariable()) // for each member variable in this class
{
QCString type=removeRedundantWhiteSpace(md->typeString());
//printf("in class %s found var type=`%s' name=`%s'\n",
// name().data(),type.data(),md->name().data());
int pos=0;
QCString usedClassName;
QCString templSpec;
bool found=FALSE;
while (extractClassNameFromType(type,pos,usedClassName,templSpec) && !found)
{
//printf("usedClassName=`%s' templSpec=%s\n",usedClassName.data(),templSpec.data());
// check if usedClassName is a template argument of its class
ClassDef *cd=md->getClassDef();
if (cd && cd->templateArguments())
{
ArgumentListIterator ali(*cd->templateArguments());
Argument *arg;
int count=0;
for (ali.toFirst();(arg=ali.current());++ali,++count)
{
if (arg->name==usedClassName) // type is a template argument
{
found=TRUE;
if (m_usesImplClassDict==0) m_usesImplClassDict = new UsesClassDict(257);
cd = new ClassDef(cd->getDefFileName(),cd->getDefLine(),
usedClassName,ClassDef::Class);
cd->setIsTemplateBaseClass(count);
UsesClassDef *ucd = new UsesClassDef(cd);
m_usesImplClassDict->insert(cd->name(),ucd);
ucd->templSpecifiers = templSpec;
ucd->addAccessor(md->name());
Doxygen::hiddenClasses.append(cd);
//printf("Adding used template argument %s to class %s\n",
// cd->name().data(),name().data());
//printf("Adding accessor %s to class %s\n",
// md->name().data(),ucd->classDef->name().data());
}
}
}
if (!found)
{
cd=0;
if (getNamespaceDef()!=0)
{
cd=getResolvedClass(getNamespaceDef()->name()+"::"+usedClassName,0,&templSpec);
}
if (cd==0) cd=getResolvedClass(name()+"::"+usedClassName,0,&templSpec);
if (cd==0) cd=getResolvedClass(usedClassName,0,&templSpec); // TODO: also try inbetween scopes!
//printf("Search for class %s result=%p\n",usedClassName.data(),cd);
if (cd) // class exists
{
found=TRUE;
if (m_usesImplClassDict==0) m_usesImplClassDict = new UsesClassDict(257);
UsesClassDef *ucd=m_usesImplClassDict->find(cd->name());
if (ucd==0 || ucd->templSpecifiers!=templSpec)
{
ucd = new UsesClassDef(cd);
m_usesImplClassDict->insert(cd->name(),ucd);
ucd->templSpecifiers = templSpec;
//printf("Adding used class %s to class %s\n",
// cd->name().data(),name().data());
}
ucd->addAccessor(md->name());
//printf("Adding accessor %s to class %s\n",
// md->name().data(),ucd->classDef->name().data());
}
}
}
}
}
}
#ifdef DUMP
if (m_usesClassDict)
{
msg("Class %s uses the following classes:\n",name().data());
UsesClassDictIterator ucdi(*m_usesClassDict);
UsesClassDef *ucd;
for (;(ucd=ucdi.current());++ucdi)
{
msg(" %s via ",ucd->classDef->name().data());
QDictIterator<void> dvi(*ucd->accessors);
const char *s;
for (;(s=dvi.currentKey());++dvi)
{
msg("%s ",s);
}
msg("\n");
}
}
#endif
}
//----------------------------------------------------------------------------
// I have disabled this code because the graphs it renders quickly become
// too large to be of practical use.
void ClassDef::addUsedInterfaceClasses(MemberDef *md,const char *typeStr)
{
QCString type = typeStr;
static const QRegExp re("[a-z_A-Z][a-z_A-Z0-9:]*");
int p=0,i,l;
while ((i=re.match(type,p,&l))!=-1) // for each class name in the type
{
ClassDef *cd=getClass(name()+"::"+type.mid(i,l));
if (cd==0) cd=getClass(type.mid(i,l)); // TODO: also try inbetween scopes!
if (cd && cd!=this && !isBaseClass(cd))
{
if (m_usesIntfClassDict==0)
{
m_usesIntfClassDict = new UsesClassDict(257);
}
UsesClassDef *ucd=m_usesIntfClassDict->find(cd->name());
if (ucd==0)
{
ucd = new UsesClassDef(cd);
m_usesIntfClassDict->insert(cd->name(),ucd);
//printf("in class `%s' adding used intf class `%s'\n",
// name().data(),cd->name().data());
}
ucd->addAccessor(md->name());
//printf("in class `%s' adding accessor `%s' to class `%s'\n",
// name().data(),md->name().data(),ucd->classDef->name().data());
}
p=i+l;
}
}
void ClassDef::determineIntfUsageRelation()
{
MemberNameInfoSDict::Iterator mnili(*m_allMemberNameInfoList);
MemberNameInfo *mni;
for (;(mni=mnili.current());++mnili)
{
MemberNameInfoIterator mnii(*mni);
MemberInfo *mi;
for (mnii.toFirst();(mi=mnii.current());++mnii)
{
MemberDef *md=mi->memberDef;
// compute the protection level for this member
Protection protect=md->protection();
if (mi->prot==Protected) // inherited protection
{
if (protect==Public) protect=Protected;
else if (protect==Protected) protect=Private;
}
if (!md->name().isEmpty() && md->name()[0]!='@' &&
(mi->prot!=Private && protect!=Private)
)
{
// add classes found in the return type
addUsedInterfaceClasses(md,md->typeString());
ArgumentList *al = md->argumentList();
if (al) // member has arguments
{
// add classes found in the types of the argument list
ArgumentListIterator ali(*al);
Argument *a;
for (;(a=ali.current());++ali)
{
if (!a->type.isEmpty() && a->type.at(0)!='@')
{
addUsedInterfaceClasses(md,a->type);
}
}
}
}
}
}
}
#endif
PackageDef *ClassDef::packageDef() const
{
return m_fileDef ? m_fileDef->packageDef() : 0;
}
QCString ClassDef::compoundTypeString() const
{
switch (m_compType)
{
case Class: return "class";
case Struct: return "struct";
case Union: return "union";
case Interface: return "interface";
case Exception: return "exception";
}
return "unknown";
}
QCString ClassDef::getOutputFileBase() const
{
if (m_templateMaster)
{
return m_templateMaster->getOutputFileBase();
}
else if (isReference())
{
return m_fileName;
}
else
{
return convertNameToFile(m_fileName);
}
}
QCString ClassDef::getInstanceOutputFileBase() const
{
if (isReference())
{
return m_fileName;
}
else
{
return convertNameToFile(m_fileName);
}
}
QCString ClassDef::getFileBase() const
{
if (m_templateMaster)
{
return m_templateMaster->getFileBase();
}
else
{
return m_fileName;
}
}
QCString ClassDef::getSourceFileBase() const
{
if (m_templateMaster)
{
return m_templateMaster->getSourceFileBase();
}
else
{
return convertNameToFile(m_fileName+"-source");
}
}
void ClassDef::setGroupDefForAllMembers(GroupDef *gd,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs)
{
gd->addClass(this);
//printf("ClassDef::setGroupDefForAllMembers(%s)\n",gd->name().data());
MemberNameInfoSDict::Iterator mnili(*m_allMemberNameInfoSDict);
MemberNameInfo *mni;
for (;(mni=mnili.current());++mnili)
{
MemberNameInfoIterator mnii(*mni);
MemberInfo *mi;
for (mnii.toFirst();(mi=mnii.current());++mnii)
{
MemberDef *md=mi->memberDef;
md->setGroupDef(gd,pri,fileName,startLine,hasDocs);
gd->insertMember(md,TRUE);
ClassDef *innerClass = md->getClassDefOfAnonymousType();
if (innerClass) innerClass->setGroupDefForAllMembers(gd,pri,fileName,startLine,hasDocs);
}
}
}
void ClassDef::addInnerCompound(Definition *d)
{
m_innerClasses->inSort(d->localName(),(ClassDef *)d);
}
Definition *ClassDef::findInnerCompound(const char *name)
{
if (name==0) return 0;
return m_innerClasses->find(name);
}
//void ClassDef::initTemplateMapping()
//{
// m_templateMapping->clear();
// ArgumentList *al = templateArguments();
// if (al)
// {
// ArgumentListIterator ali(*al);
// Argument *arg;
// for (ali.toFirst();(arg=ali.current());++ali)
// {
// setTemplateArgumentMapping(arg->name,arg->defval);
// }
// }
//}
//void ClassDef::setTemplateArgumentMapping(const char *formal,const char *actual)
//{
// //printf("ClassDef::setTemplateArgumentMapping(%s,%s)\n",formal,actual);
// if (m_templateMapping && formal)
// {
// if (m_templateMapping->find(formal))
// {
// m_templateMapping->remove(formal);
// }
// m_templateMapping->insert(formal,new QCString(actual));
// }
//}
//
//QCString ClassDef::getTemplateArgumentMapping(const char *formal) const
//{
// if (m_templateMapping && formal)
// {
// QCString *s = m_templateMapping->find(formal);
// if (s)
// {
// return *s;
// }
// }
// return "";
//}
ClassDef *ClassDef::insertTemplateInstance(const QCString &fileName,
int startLine, const QCString &templSpec,bool &freshInstance)
{
freshInstance = FALSE;
if (m_templateInstances==0)
{
m_templateInstances = new QDict<ClassDef>(17);
}
ClassDef *templateClass=m_templateInstances->find(templSpec);
if (templateClass==0)
{
Debug::print(Debug::Classes,0," New template instance class %s%s\n",name().data(),templSpec.data());
templateClass = new ClassDef(
fileName,startLine,name()+templSpec,ClassDef::Class);
//templateClass->setBriefDescription(briefDescription());
//templateClass->setDocumentation(documentation());
templateClass->setTemplateMaster(this);
templateClass->setOuterScope(getOuterScope());
m_templateInstances->insert(templSpec,templateClass);
freshInstance=TRUE;
}
return templateClass;
}
void ClassDef::setTemplateBaseClassNames(QDict<int> *templateNames)
{
if (templateNames==0) return;
if (m_templBaseClassNames==0)
{
m_templBaseClassNames = new QDict<int>(17);
m_templBaseClassNames->setAutoDelete(TRUE);
}
// make a deep copy of the dictionary.
QDictIterator<int> qdi(*templateNames);
for (;qdi.current();++qdi)
{
if (m_templBaseClassNames->find(qdi.currentKey())==0)
{
m_templBaseClassNames->insert(qdi.currentKey(),new int(*qdi.current()));
}
}
}
QDict<int> *ClassDef::getTemplateBaseClassNames() const
{
return m_templBaseClassNames;
}
void ClassDef::addMembersToTemplateInstance(ClassDef *cd,const char *templSpec)
{
//printf("%s::addMembersToTemplateInstance(%s,%s)\n",name().data(),cd->name().data(),templSpec);
MemberNameInfoSDict::Iterator mnili(*cd->m_allMemberNameInfoSDict);
MemberNameInfo *mni;
for (;(mni=mnili.current());++mnili)
{
MemberNameInfoIterator mnii(*mni);
MemberInfo *mi;
for (mnii.toFirst();(mi=mnii.current());++mnii)
{
ArgumentList *actualArguments = new ArgumentList;
stringToArgumentList(templSpec,actualArguments);
MemberDef *md = mi->memberDef;
MemberDef *imd = md->createTemplateInstanceMember(
cd->templateArguments(),actualArguments);
delete actualArguments;
//printf("%s->setMemberClass(%p)\n",imd->name().data(),this);
imd->setMemberClass(this);
imd->setTemplateMaster(md);
//imd->setDocumentation(md->documentation());
//imd->setBriefDescription(md->briefDescription());
imd->setMemberSpecifiers(md->getMemberSpecifiers());
insertMember(imd);
//printf("Adding member=%s %s%s to class %s templSpec %s\n",
// imd->typeString(),imd->name().data(),imd->argsString(),
// imd->getClassDef()->name().data(),templSpec);
// insert imd in the list of all members
//printf("Adding member=%s class=%s\n",imd->name().data(),name().data());
MemberName *mn = Doxygen::memberNameSDict[imd->name()];
if (mn==0)
{
mn = new MemberName(imd->name());
Doxygen::memberNameSDict.append(imd->name(),mn);
}
mn->append(imd);
}
}
}
QCString ClassDef::getReference() const
{
if (m_templateMaster)
{
return m_templateMaster->getReference();
}
else
{
return Definition::getReference();
}
}
bool ClassDef::isReference() const
{
if (m_templateMaster)
{
return m_templateMaster->isReference();
}
else
{
return Definition::isReference();
}
}
void ClassDef::getTemplateParameterLists(QList<ArgumentList> &lists) const
{
Definition *d=getOuterScope();
if (d)
{
if (d->definitionType()==Definition::TypeClass)
{
ClassDef *cd=(ClassDef *)d;
cd->getTemplateParameterLists(lists);
}
}
if (templateArguments())
{
lists.append(templateArguments());
}
}
QCString ClassDef::qualifiedNameWithTemplateParameters(
QList<ArgumentList> *actualParams) const
{
//printf("qualifiedNameWithTemplateParameters() localName=%s\n",localName().data());
QCString scName;
Definition *d=getOuterScope();
if (d)
{
if (d->definitionType()==Definition::TypeClass)
{
ClassDef *cd=(ClassDef *)d;
scName = cd->qualifiedNameWithTemplateParameters(actualParams);
}
else
{
scName = d->qualifiedName();
}
}
if (!scName.isEmpty()) scName+="::";
scName+=localName();
ArgumentList *al=0;
bool isSpecialization = localName().find('<')!=-1;
if (templateArguments())
{
if (actualParams && (al=actualParams->current()))
{
if (!isSpecialization)
{
scName+=tempArgListToString(al);
}
actualParams->next();
}
else
{
if (!isSpecialization)
{
scName+=tempArgListToString(templateArguments());
}
}
}
//printf("qualifiedNameWithTemplateParameters: scope=%s qualifiedName=%s\n",name().data(),scName.data());
return scName;
}
QCString ClassDef::className() const
{
QCString className=m_localName;
Definition *p=getOuterScope();
while (p && p->definitionType()==TypeClass)
{
className.prepend(p->localName()+"::");
p=p->getOuterScope();
}
return className;
};
void ClassDef::addListReferences()
{
addRefItem(todoId(),testId(),bugId(),
theTranslator->trClass(TRUE,TRUE),
getOutputFileBase(),name()
);
MemberGroupListIterator mgli(*m_memberGroupList);
MemberGroup *mg;
for (;(mg=mgli.current());++mgli)
{
mg->addListReferences(this);
}
constructors.addListReferences(this);
typedefMembers.addListReferences(this);
enumMembers.addListReferences(this);
enumValMembers.addListReferences(this);
functionMembers.addListReferences(this);
relatedMembers.addListReferences(this);
variableMembers.addListReferences(this);
propertyMembers.addListReferences(this);
}
MemberDef *ClassDef::getMemberByName(const QCString &name)
{
MemberDef *xmd = 0;
MemberNameInfo *mni = m_allMemberNameInfoSDict->find(name);
if (mni)
{
const int maxInheritanceDepth = 100000;
int mdist=maxInheritanceDepth;
MemberNameInfoIterator mnii(*mni);
MemberInfo *mi;
for (mnii.toFirst();(mi=mnii.current());++mnii)
{
ClassDef *mcd=mi->memberDef->getClassDef();
int m=minClassDistance(this,mcd);
if (m<mdist && mcd->isLinkable())
{
mdist=m;
xmd=mi->memberDef;
}
}
}
return xmd;
}
|