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
|
/******************************************************************************
*
*
*
* Copyright (C) 1997-2003 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 <ctype.h>
#include "qtbc.h"
#include "groupdef.h"
#include "classdef.h"
#include "filedef.h"
#include "classlist.h"
#include "outputlist.h"
#include "namespacedef.h"
#include "language.h"
#include "util.h"
#include "memberlist.h"
#include "message.h"
#include "membergroup.h"
#include "doxygen.h"
#include "pagedef.h"
#include "docparser.h"
#include "searchindex.h"
GroupDef::GroupDef(const char *df,int dl,const char *na,const char *t,
const char *refFileName) : Definition(df,dl,na)
{
fileList = new FileList;
classSDict = new ClassSDict(257);
groupList = new GroupList;
namespaceList = new NamespaceList;
pageDict = new PageSDict(257);
exampleDict = new PageSDict(257);
allMemberList = new MemberList;
allMemberNameInfoSDict = new MemberNameInfoSDict(17);
if (refFileName)
{
fileName=stripExtension(refFileName);
}
else
{
fileName = (QCString)"group_"+na;
}
setGroupTitle( t );
memberGroupSDict = new MemberGroupSDict;
memberGroupSDict->setAutoDelete(TRUE);
decDefineMembers.setInGroup(TRUE);
decProtoMembers.setInGroup(TRUE);
decTypedefMembers.setInGroup(TRUE);
decEnumMembers.setInGroup(TRUE);
decEnumValMembers.setInGroup(TRUE);
decFuncMembers.setInGroup(TRUE);
decVarMembers.setInGroup(TRUE);
docDefineMembers.setInGroup(TRUE);
docProtoMembers.setInGroup(TRUE);
docTypedefMembers.setInGroup(TRUE);
docEnumMembers.setInGroup(TRUE);
docFuncMembers.setInGroup(TRUE);
docVarMembers.setInGroup(TRUE);
visited = 0;
}
GroupDef::~GroupDef()
{
delete fileList;
delete classSDict;
delete groupList;
delete namespaceList;
delete pageDict;
delete exampleDict;
delete allMemberList;
delete allMemberNameInfoSDict;
delete memberGroupSDict;
}
void GroupDef::setGroupTitle( const char *t )
{
if ( t && strlen(t) )
{
title = t;
titleSet = TRUE;
}
else
{
title = name();
title.at(0)=toupper(title.at(0));
titleSet = FALSE;
}
}
void GroupDef::distributeMemberGroupDocumentation()
{
MemberGroupSDict::Iterator mgli(*memberGroupSDict);
MemberGroup *mg;
for (;(mg=mgli.current());++mgli)
{
mg->distributeMemberGroupDocumentation();
}
}
void GroupDef::findSectionsInDocumentation()
{
docFindSections(documentation(),this,0,docFile());
MemberGroupSDict::Iterator mgli(*memberGroupSDict);
MemberGroup *mg;
for (;(mg=mgli.current());++mgli)
{
mg->findSectionsInDocumentation();
}
decDefineMembers.findSectionsInDocumentation();
decProtoMembers.findSectionsInDocumentation();
decTypedefMembers.findSectionsInDocumentation();
decEnumMembers.findSectionsInDocumentation();
decFuncMembers.findSectionsInDocumentation();
decVarMembers.findSectionsInDocumentation();
}
void GroupDef::addFile(const FileDef *def)
{
if (Config_getBool("SORT_MEMBER_DOCS"))
fileList->inSort(def);
else
fileList->append(def);
}
void GroupDef::addClass(const ClassDef *cd)
{
if (Config_getBool("SORT_MEMBER_DOCS"))
classSDict->inSort(cd->name(),cd);
else
classSDict->append(cd->name(),cd);
}
void GroupDef::addNamespace(const NamespaceDef *def)
{
if (Config_getBool("SORT_MEMBER_DOCS"))
namespaceList->inSort(def);
else
namespaceList->append(def);
}
void GroupDef::addPage(PageDef *def)
{
//printf("Making page %s part of a group\n",def->name.data());
pageDict->append(def->name(),def);
def->makePartOfGroup(this);
}
void GroupDef::addExample(const PageDef *def)
{
exampleDict->append(def->name(),def);
}
void GroupDef::addMembersToMemberGroup()
{
::addMembersToMemberGroup(&decDefineMembers,memberGroupSDict,this);
::addMembersToMemberGroup(&decProtoMembers,memberGroupSDict,this);
::addMembersToMemberGroup(&decTypedefMembers,memberGroupSDict,this);
::addMembersToMemberGroup(&decEnumMembers,memberGroupSDict,this);
::addMembersToMemberGroup(&decEnumValMembers,memberGroupSDict,this);
::addMembersToMemberGroup(&decFuncMembers,memberGroupSDict,this);
::addMembersToMemberGroup(&decVarMembers,memberGroupSDict,this);
//printf("GroupDef::addMembersToMemberGroup() memberGroupList=%d\n",memberGroupList->count());
MemberGroupSDict::Iterator mgli(*memberGroupSDict);
MemberGroup *mg;
for (;(mg=mgli.current());++mgli)
{
mg->setInGroup(TRUE);
}
}
bool GroupDef::insertMember(MemberDef *md,bool docOnly)
{
//printf("GroupDef(%s)::insertMember(%s)\n", title.data(), md->name().data());
MemberNameInfo *mni=0;
if ((mni=(*allMemberNameInfoSDict)[md->name()]))
{ // member with this name already found
MemberNameInfoIterator srcMnii(*mni);
MemberInfo *srcMi;
for ( ; (srcMi=srcMnii.current()) ; ++srcMnii )
{
MemberDef *srcMd = srcMi->memberDef;
bool sameScope = srcMd->getOuterScope()==md->getOuterScope() || // same class or namespace
// both inside a file => definition and declaration do not have to be in the same file
(srcMd->getOuterScope()->definitionType()==Definition::TypeFile &&
md->getOuterScope()->definitionType()==Definition::TypeFile);
if (matchArguments(srcMd->argumentList(),md->argumentList()) &&
sameScope
)
{
return FALSE; // member already added
}
}
mni->append(new MemberInfo(md,md->protection(),md->virtualness(),FALSE));
}
else
{
mni = new MemberNameInfo(md->name());
mni->append(new MemberInfo(md,md->protection(),md->virtualness(),FALSE));
allMemberNameInfoSDict->append(mni->memberName(),mni);
}
//printf("Added member!\n");
allMemberList->append(md);
switch(md->memberType())
{
case MemberDef::Variable:
if (!docOnly) decVarMembers.append(md);
if (Config_getBool("SORT_MEMBER_DOCS"))
docVarMembers.inSort(md);
else
docVarMembers.append(md);
break;
case MemberDef::Function:
if (!docOnly) decFuncMembers.append(md);
if (Config_getBool("SORT_MEMBER_DOCS"))
docFuncMembers.inSort(md);
else
docFuncMembers.append(md);
break;
case MemberDef::Typedef:
if (!docOnly) decTypedefMembers.append(md);
if (Config_getBool("SORT_MEMBER_DOCS"))
docTypedefMembers.inSort(md);
else
docTypedefMembers.append(md);
break;
case MemberDef::Enumeration:
if (!docOnly) decEnumMembers.append(md);
if (Config_getBool("SORT_MEMBER_DOCS"))
docEnumMembers.inSort(md);
else
docEnumMembers.append(md);
break;
case MemberDef::EnumValue:
break;
case MemberDef::Prototype:
if (!docOnly) decProtoMembers.append(md);
if (Config_getBool("SORT_MEMBER_DOCS"))
docProtoMembers.inSort(md);
else
docProtoMembers.append(md);
break;
case MemberDef::Define:
if (!docOnly) decDefineMembers.append(md);
if (Config_getBool("SORT_MEMBER_DOCS"))
docDefineMembers.inSort(md);
else
docDefineMembers.append(md);
break;
default:
err("GroupDef::insertMembers(): "
"member `%s' with class scope `%s' inserted in group scope `%s'!\n",
md->name().data(),
md->getClassDef() ? md->getClassDef()->name().data() : "",
name().data());
}
return TRUE;
}
void GroupDef::removeMember(MemberDef *md)
{
// fprintf(stderr, "GroupDef(%s)::removeMember( %s )\n", title.data(), md->name().data());
MemberNameInfo *mni = allMemberNameInfoSDict->find(md->name());
if (mni)
{
MemberNameInfoIterator mnii(*mni);
while( mnii.current() )
{
if( mnii.current()->memberDef == md )
{
mni->remove(mnii.current());
break;
}
++mnii;
}
if( mni->isEmpty() )
{
allMemberNameInfoSDict->remove(md->name());
delete mni;
}
allMemberList->remove(md);
switch(md->memberType())
{
case MemberDef::Variable:
decVarMembers.remove(md);
docVarMembers.remove(md);
break;
case MemberDef::Function:
decFuncMembers.remove(md);
docFuncMembers.remove(md);
break;
case MemberDef::Typedef:
decTypedefMembers.remove(md);
docTypedefMembers.remove(md);
break;
case MemberDef::Enumeration:
decEnumMembers.remove(md);
docEnumMembers.remove(md);
break;
case MemberDef::EnumValue:
break;
case MemberDef::Prototype:
decProtoMembers.remove(md);
docProtoMembers.remove(md);
break;
case MemberDef::Define:
decDefineMembers.remove(md);
docDefineMembers.remove(md);
break;
default:
err("GroupDef::removeMember(): unexpected member remove in file!\n");
}
}
}
bool GroupDef::containsGroup(const GroupDef *def)
{
return groupList->find(def) >= 0;
}
void GroupDef::addGroup(const GroupDef *def)
{
//printf("adding group `%s' to group `%s'\n",def->name().data(),name().data());
//if (Config_getBool("SORT_MEMBER_DOCS"))
// groupList->inSort(def);
//else
groupList->append(def);
}
bool GroupDef::isASubGroup() const
{
return m_partOfGroups && m_partOfGroups->count()!=0;
}
int GroupDef::countMembers() const
{
return fileList->count()+
classSDict->count()+
namespaceList->count()+
groupList->count()+
allMemberList->count()+
pageDict->count()+
exampleDict->count();
}
/*! Compute the HTML anchor names for all members in the class */
void GroupDef::computeAnchors()
{
setAnchors(0,'a',allMemberList);
}
void GroupDef::writeDetailedDocumentation(OutputList &ol)
{
if (!briefDescription().isEmpty() || !documentation().isEmpty())
{
if (pageDict->count()!=countMembers()) // classical layout
{
ol.writeRuler();
ol.pushGeneratorState();
ol.disable(OutputGenerator::Latex);
ol.disable(OutputGenerator::RTF);
ol.writeAnchor(0,"_details");
ol.popGeneratorState();
ol.startGroupHeader();
ol.parseText(theTranslator->trDetailedDescription());
ol.endGroupHeader();
// repeat brief description
if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF"))
{
ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE);
ol.newParagraph();
}
}
// write documentation
if (!documentation().isEmpty())
{
ol.parseDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE);
}
}
}
void GroupDef::writeDocumentation(OutputList &ol)
{
ol.pushGeneratorState();
//ol.disable(OutputGenerator::Man);
startFile(ol,getOutputFileBase(),name(),title);
startTitle(ol,getOutputFileBase());
ol.docify(title);
addGroupListToTitle(ol,this);
endTitle(ol,getOutputFileBase(),title);
if (Config_getBool("SEARCHENGINE"))
{
Doxygen::searchIndex->setCurrentDoc(title,getOutputFileBase());
Doxygen::searchIndex->addWord(localName().lower());
}
if (Config_getBool("DETAILS_AT_TOP"))
{
writeDetailedDocumentation(ol);
ol.newParagraph();
}
else if (!briefDescription().isEmpty())
{
ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),TRUE,FALSE);
ol.writeString(" \n");
ol.pushGeneratorState();
ol.disable(OutputGenerator::Latex);
ol.disable(OutputGenerator::RTF);
ol.startTextLink(0,"_details");
ol.parseText(theTranslator->trMore());
ol.endTextLink();
//ol.enable(OutputGenerator::Latex);
ol.popGeneratorState();
}
if (!Config_getString("GENERATE_TAGFILE").isEmpty())
{
Doxygen::tagFile << " <compound kind=\"group\">" << endl;
Doxygen::tagFile << " <name>" << convertToXML(name()) << "</name>" << endl;
Doxygen::tagFile << " <title>" << convertToXML(title) << "</title>" << endl;
Doxygen::tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl;
}
ol.startMemberSections();
// write list of files
if (fileList->count()>0)
{
ol.startMemberHeader();
ol.parseText(theTranslator->trFile(TRUE,FALSE));
ol.endMemberHeader();
ol.startMemberList();
FileDef *fd=fileList->first();
while (fd)
{
ol.startMemberItem(0);
ol.docify("file ");
ol.insertMemberAlign();
ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,fd->name());
if (!Config_getString("GENERATE_TAGFILE").isEmpty())
{
Doxygen::tagFile << " <file>" << convertToXML(fd->name()) << "</file>" << endl;
}
ol.endMemberItem();
if (!fd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC"))
{
ol.startMemberDescription();
ol.parseDoc(briefFile(),briefLine(),fd,0,fd->briefDescription(),FALSE,FALSE);
ol.endMemberDescription();
ol.newParagraph();
}
fd=fileList->next();
}
ol.endMemberList();
}
// write list of namespaces
if (namespaceList->count()>0)
{
ol.startMemberHeader();
ol.parseText(theTranslator->trNamespaces());
ol.endMemberHeader();
ol.startMemberList();
NamespaceDef *nd=namespaceList->first();
while (nd)
{
ol.startMemberItem(0);
ol.docify("namespace ");
ol.insertMemberAlign();
ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),0,nd->name());
if (!Config_getString("GENERATE_TAGFILE").isEmpty())
{
Doxygen::tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
}
ol.endMemberItem();
if (!nd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC"))
{
ol.startMemberDescription();
ol.parseDoc(briefFile(),briefLine(),nd,0,nd->briefDescription(),FALSE,FALSE);
ol.endMemberDescription();
ol.newParagraph();
}
nd=namespaceList->next();
}
ol.endMemberList();
}
// write list of groups
if (groupList->count()>0)
{
ol.startMemberHeader();
ol.parseText(theTranslator->trModules());
ol.endMemberHeader();
ol.startMemberList();
GroupDef *gd=groupList->first();
while (gd)
{
ol.startMemberItem(0);
//ol.insertMemberAlign();
ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),0,gd->groupTitle());
if (!Config_getString("GENERATE_TAGFILE").isEmpty())
{
Doxygen::tagFile << " <subgroup>" << convertToXML(gd->name()) << "</subgroup>" << endl;
}
ol.endMemberItem();
if (!gd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC"))
{
ol.startMemberDescription();
ol.parseDoc(briefFile(),briefLine(),gd,0,gd->briefDescription(),FALSE,FALSE);
ol.endMemberDescription();
ol.newParagraph();
}
gd=groupList->next();
}
ol.endMemberList();
}
// write list of classes
classSDict->writeDeclaration(ol);
// write list of members
if (allMemberList->count()>0)
{
/* write user defined member groups */
MemberGroupSDict::Iterator mgli(*memberGroupSDict);
MemberGroup *mg;
for (;(mg=mgli.current());++mgli)
{
mg->writeDeclarations(ol,0,0,0,this);
}
//allMemberList->writeDeclarations(ol,0,0,0,this,0,0);
decDefineMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trDefines(),0);
decProtoMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trFuncProtos(),0);
decTypedefMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trTypedefs(),0);
decEnumMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trEnumerations(),0);
decFuncMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trFunctions(),0);
decVarMembers.writeDeclarations(ol,0,0,0,this,theTranslator->trVariables(),0);
}
ol.endMemberSections();
if (!Config_getBool("DETAILS_AT_TOP"))
{
writeDetailedDocumentation(ol);
}
PageDef *pd=0;
PageSDict::Iterator pdi(*pageDict);
for (pdi.toFirst();(pd=pdi.current());++pdi)
{
if (!pd->isReference())
{
QCString pageName = pd->getOutputFileBase();
if (!Config_getString("GENERATE_TAGFILE").isEmpty())
{
Doxygen::tagFile << " <page>" << convertToXML(pageName) << "</page>" << endl;
}
SectionInfo *si=0;
if (!pd->title().isEmpty() && !pd->name().isEmpty() &&
(si=Doxygen::sectionDict[pd->name()])!=0)
{
ol.startSection(si->label,si->title,SectionInfo::Subsection);
ol.docify(si->title);
ol.endSection(si->label,SectionInfo::Subsection);
}
ol.startTextBlock();
ol.parseDoc(pd->docFile(),pd->docLine(),pd,0,pd->documentation(),TRUE,FALSE);
ol.endTextBlock();
}
}
docDefineMembers.writeDocumentation(ol,name(),this,
theTranslator->trDefineDocumentation());
docProtoMembers.writeDocumentation(ol,name(),this,
theTranslator->trFunctionPrototypeDocumentation());
docTypedefMembers.writeDocumentation(ol,name(),this,
theTranslator->trTypedefDocumentation());
docEnumMembers.writeDocumentation(ol,name(),this,
theTranslator->trEnumerationTypeDocumentation());
docFuncMembers.writeDocumentation(ol,name(),this,
theTranslator->trFunctionDocumentation());
docVarMembers.writeDocumentation(ol,name(),this,
theTranslator->trVariableDocumentation());
if (!Config_getString("GENERATE_TAGFILE").isEmpty())
{
writeDocAnchorsToTagFile();
Doxygen::tagFile << " </compound>" << endl;
}
endFile(ol);
ol.popGeneratorState();
}
//---- helper functions ------------------------------------------------------
void addClassToGroups(Entry *root,ClassDef *cd)
{
QListIterator<Grouping> gli(*root->groups);
Grouping *g;
for (;(g=gli.current());++gli)
{
GroupDef *gd=0;
if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname]))
{
gd->addClass(cd);
cd->makePartOfGroup(gd);
//printf("Compound %s: in group %s\n",cd->name().data(),s->data());
}
}
}
void addNamespaceToGroups(Entry *root,NamespaceDef *nd)
{
//printf("root->groups->count()=%d\n",root->groups->count());
QListIterator<Grouping> gli(*root->groups);
Grouping *g;
for (;(g=gli.current());++gli)
{
GroupDef *gd=0;
//printf("group `%s'\n",s->data());
if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname]))
{
gd->addNamespace(nd);
nd->makePartOfGroup(gd);
//printf("Namespace %s: in group %s\n",nd->name().data(),s->data());
}
}
}
void addGroupToGroups(Entry *root,GroupDef *subGroup)
{
QListIterator<Grouping> gli(*root->groups);
Grouping *g;
for (;(g=gli.current());++gli)
{
GroupDef *gd=0;
if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname]) &&
!gd->containsGroup(subGroup) )
{
gd->addGroup(subGroup);
subGroup->makePartOfGroup(gd);
}
}
}
/*! Add a member to the group with the highest priority */
void addMemberToGroups(Entry *root,MemberDef *md)
{
//printf(" Root %p = %s, md %p=%s groups=%d\n", root, root->name.data(), md, md->name().data(), root->groups->count() );
QListIterator<Grouping> gli(*root->groups);
Grouping *g;
// Search entry's group list for group with highest pri.
Grouping::GroupPri_t pri = Grouping::GROUPING_LOWEST;
GroupDef *fgd=0;
for (;(g=gli.current());++gli)
{
GroupDef *gd=0;
if (!g->groupname.isEmpty() &&
(gd=Doxygen::groupSDict[g->groupname]) &&
g->pri >= pri)
{
if (fgd && g->pri==pri)
{
warn(root->fileName.data(), root->startLine,
"Warning: Member %s found in multiple %s groups! "
"The member will be put in group %s, and not in group %s",
md->name().data(), Grouping::getGroupPriName( pri ),
gd->name().data(), fgd->name().data()
);
}
fgd = gd;
pri = g->pri;
}
}
//printf("fgd=%p\n",fgd);
// put member into group defined by this entry?
if (fgd)
{
GroupDef *mgd = md->getGroupDef();
//printf("mgd=%p\n",mgd);
bool insertit = FALSE;
if (mgd==0)
{
insertit = TRUE;
}
else if (mgd!=fgd)
{
bool moveit = FALSE;
// move member from one group to another if
// - the new one has a higher priority
// - the new entry has the same priority, but with docs where the old one had no docs
if (md->getGroupPri()<pri)
{
moveit = TRUE;
}
else
{
if (md->getGroupPri()==pri)
{
if (!root->doc.isEmpty() && !md->getGroupHasDocs())
{
moveit = TRUE;
}
else if (!root->doc.isEmpty() && md->getGroupHasDocs())
{
warn(md->getGroupFileName(),md->getGroupStartLine(),
"Warning: Member documentation for %s found several times in %s groups!\n"
"%s:%d: The member will remain in group %s, and won't be put into group %s",
md->name().data(), Grouping::getGroupPriName( pri ),
root->fileName.data(), root->startLine,
mgd->name().data(),
fgd->name().data()
);
}
}
}
if (moveit)
{
//printf("removeMember\n");
mgd->removeMember(md);
insertit = TRUE;
}
}
if (insertit)
{
//printf("insertMember found at %s line %d\n",md->getDefFileName().data(),md->getDefLine());
bool success = fgd->insertMember(md);
if (success)
{
//printf("insertMember successful\n");
md->setGroupDef(fgd,pri,root->fileName,root->startLine,!root->doc.isEmpty());
ClassDef *cd = md->getClassDefOfAnonymousType();
if (cd) cd->setGroupDefForAllMembers(fgd,pri,root->fileName,root->startLine,root->doc.length() != 0);
}
}
}
}
void addExampleToGroups(Entry *root,PageDef *eg)
{
QListIterator<Grouping> gli(*root->groups);
Grouping *g;
for (;(g=gli.current());++gli)
{
GroupDef *gd=0;
if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname]))
{
gd->addExample(eg);
eg->makePartOfGroup(gd);
//printf("Example %s: in group %s\n",eg->name().data(),s->data());
}
}
}
QCString GroupDef::getOutputFileBase() const
{
if (isReference())
{
return fileName;
}
else
{
return convertNameToFile(fileName);
}
}
void GroupDef::addListReferences()
{
addRefItem(xrefListItems(),
theTranslator->trGroup(TRUE,TRUE),
getOutputFileBase(),name()
);
MemberGroupSDict::Iterator mgli(*memberGroupSDict);
MemberGroup *mg;
for (;(mg=mgli.current());++mgli)
{
mg->addListReferences(this);
}
docDefineMembers.addListReferences(this);
docProtoMembers.addListReferences(this);
docTypedefMembers.addListReferences(this);
docEnumMembers.addListReferences(this);
docFuncMembers.addListReferences(this);
docVarMembers.addListReferences(this);
}
|