Doxygen
Loading...
Searching...
No Matches
memberlist.cpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2026 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16// own header
17#include "memberlist.h"
18
19// other includes
20#include "classdef.h"
21#include "config.h"
22#include "docparser.h"
23#include "doxygen.h"
24#include "filedef.h"
25#include "groupdef.h"
26#include "language.h"
27#include "membergroup.h"
28#include "message.h"
29#include "moduledef.h"
30#include "namespacedef.h"
31#include "outputlist.h"
32#include "util.h"
33#include "vhdldocgen.h"
34
36{
37 //printf("%p: MemberList::MemberList(%d)\n",this,lt);
38 m_numDecMembers=-1; // special value indicating that value needs to be computed
40 m_numDocMembers=-1; // special value indicating that value needs to be computed
42 m_needsSorting=false;
43}
44
48
50{
51 bool sortConstructorsFirst = Config_getBool(SORT_MEMBERS_CTORS_1ST);
52 if (sortConstructorsFirst)
53 {
54 int ord1 = c1->isConstructor() ? 2 : (c1->isDestructor() ? 1 : 0);
55 int ord2 = c2->isConstructor() ? 2 : (c2->isDestructor() ? 1 : 0);
56 if (ord1 > ord2)
57 return -1;
58 else if (ord2 > ord1)
59 return 1;
60 }
61 // sort on name, first case in-sensitive
62 int cmp = dstricmp_sort(c1->name(),c2->name());
63 // then on qualified name
64 if (cmp==0)
65 {
66 cmp = dstricmp_sort(c1->qualifiedName(),c2->qualifiedName());
67 }
68 // then on argument list
69 if (cmp==0 && !c1->argsString().empty() && !c2->argsString().empty())
70 {
71 cmp = dstricmp_sort(c1->argsString(),c2->argsString());
72 }
73 // then on file in which the item is defined
74 if (cmp==0)
75 {
77 }
78 // then on line number at which the member is defined
79 if (cmp==0)
80 {
81 cmp = c2->getDefLine()-c1->getDefLine();
82 }
83 return cmp;
84}
85
86int MemberList::countInheritableMembers(const ClassDef *inheritedFrom) const
87{
88 int count=0;
89 for (const auto &md : m_members)
90 {
91 if (md->isBriefSectionVisible())
92 {
93 if (md->memberType()!=MemberType::Friend &&
94 md->memberType()!=MemberType::EnumValue)
95 {
96 //printf("member %s: isReimplementedBy(%s)=%d\n",qPrint(md->name()),
97 // qPrint(inheritedFrom->name()),
98 // md->isReimplementedBy(inheritedFrom));
99 if (md->memberType()==MemberType::Function)
100 {
101 if (!md->isReimplementedBy(inheritedFrom)) count++;
102 }
103 else
104 {
105 count++;
106 }
107 }
108 }
109 }
110 for (const auto &mg : m_memberGroupRefList)
111 {
112 count+=mg->countInheritableMembers(inheritedFrom);
113 }
114 //printf("%s::countInheritableMembers(%s)=%d\n",
115 // qPrint(m_listType.toLabel()),
116 // qPrint(inheritedFrom->name()),count);
117 return count;
118}
119
120/*! Count the number of members in this list that are visible in
121 * the declaration part of a compound's documentation page.
122 */
123std::pair<int,int> MemberList::countDecMembers(const ClassDef *inheritedFrom) const
124{
125 //printf("----- countDecMembers count=%d ----\n",count());
126 int numDecMembers=0;
127 int numDecEnumValues=0;
128 for (const auto &md : m_members)
129 {
130 //printf("MemberList::countDecMembers(md=%s,%d)\n",qPrint(md->name()),md->isBriefSectionVisible());
131 if ((inheritedFrom==nullptr || !md->isReimplementedBy(inheritedFrom)) &&
132 md->isBriefSectionVisible())
133 {
134 switch(md->memberType())
135 {
136 case MemberType::Variable: // fall through
137 case MemberType::Event: // fall through
138 case MemberType::Property: numDecMembers++;
139 break;
140// apparently necessary to get this to show up in declarations section?
141 case MemberType::Interface: // fall through
142 case MemberType::Service: // fall through
143 case MemberType::Function: // fall through
144 case MemberType::Signal: // fall through
145 case MemberType::DCOP: // fall through
146 case MemberType::Slot: if (!md->isRelated() || md->getClassDef())
148 break;
149 case MemberType::Enumeration:
151 break;
152 case MemberType::EnumValue: numDecEnumValues++;
154 break;
155 case MemberType::Typedef: numDecMembers++;
156 break;
157 case MemberType::Sequence: numDecMembers++;
158 break;
159 case MemberType::Dictionary: numDecMembers++;
160 break;
161 case MemberType::Define: if (Config_getBool(EXTRACT_ALL) ||
162 !md->argsString().empty() ||
163 !md->initializer().empty() ||
164 md->hasDocumentation()
165 ) numDecMembers++;
166 break;
167 case MemberType::Friend: numDecMembers++;
168 break;
169 default:
170 err("Unknown member type found for member '{}'!\n",md->name());
171 }
172 }
173 }
174 for (const auto &mg : m_memberGroupRefList)
175 {
176 mg->countDecMembers();
177 numDecMembers+=mg->numDecMembers();
178 numDecEnumValues+=mg->numDecEnumValues();
179 }
180 //printf("----- end countDecMembers ----\n");
181
182 return std::make_pair(numDecMembers,numDecEnumValues);
183}
184
186{
187 if (m_numDecMembers!=-1) return; // already cached
188 std::tie(m_numDecMembers, m_numDecEnumValues) = countDecMembers(nullptr); // cache new values
189}
190
192{
193 if (m_numDocMembers!=-1) return; // used cached value
195 for (const auto &md : m_members)
196 {
197 if (md->isDetailedSectionVisible(m_container) && !md->isAlias())
198 {
199 // do not count enum values, since they do not produce entries of their own
200 if (md->memberType()==MemberType::EnumValue)
201 {
203 }
205 }
206 }
207 for (const auto &mg : m_memberGroupRefList)
208 {
209 mg->countDocMembers();
210 m_numDocMembers+=mg->numDocMembers();
211 m_numDocEnumValues+=mg->numDocEnumValues();
212 }
213 //printf("MemberList::countDocMembers()=%d memberGroupList=%p\n",m_numDocMembers,memberGroupList);
214}
215
217{
218 //printf("MemberList(%p)::setAnonymousEnumType()\n",this);
219 for (const auto &md : m_members)
220 {
221 if (md->isBriefSectionVisible())
222 {
223 DString name(md->name());
224 if (size_t i=name.rfind("::"); i!=DString::npos) name=name.mid(i+2);
225 if (md->memberType()==MemberType::Enumeration && name[0]=='@')
226 {
227 for (const auto &vmd : md->enumFieldList())
228 {
230 if (vmdm)
231 {
232 DString vtype=vmd->typeString();
233 if ((vtype.find(name))!=DString::npos)
234 {
235 vmdm->setAnonymousEnumType(md);
236 }
237 }
238 }
239 }
240 }
241 }
242 for (const auto &mg : m_memberGroupRefList)
243 {
244 mg->setAnonymousEnumType();
245 }
246}
247
249{
250 int numEnumValues=0;
251 DString name(md->name());
252 if (size_t i=name.rfind("::"); i!=DString::npos) name=name.mid(i+2);
253 if (name[0]=='@')
254 {
255 for (const auto &vmd : m_members)
256 {
257 DString vtype=vmd->typeString();
258 if ((vtype.find(name))!=DString::npos)
259 {
260 numEnumValues++;
261 }
262 }
263 }
264 return numEnumValues;
265}
266
268{
269 for (const auto &md : m_members)
270 {
271 if (md->isBriefSectionVisible())
272 {
273 switch (md->memberType())
274 {
275 case MemberType::Define: // fall through
276 case MemberType::Typedef: // fall through
277 case MemberType::Variable: // fall through
278 case MemberType::Function: // fall through
279 case MemberType::Signal: // fall through
280 case MemberType::Slot: // fall through
281 case MemberType::DCOP: // fall through
282 case MemberType::Property: // fall through
283 case MemberType::Interface: // fall through
284 case MemberType::Service: // fall through
285 case MemberType::Sequence: // fall through
286 case MemberType::Dictionary: // fall through
287 case MemberType::Event:
288 return true;
289 case MemberType::Enumeration:
290 {
291 // if this is an anonymous enum and there are variables of this
292 // enum type (i.e. enumVars>0), then we do not show the enum here.
293 if (countEnumValues(md)==0) // show enum here
294 {
295 return true;
296 }
297 }
298 break;
299 case MemberType::Friend:
300 return true;
301 case MemberType::EnumValue:
302 {
304 {
305 return true;
306 }
307 }
308 break;
309 }
310 }
311 }
312 return false;
313}
314
316 const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd, const GroupDef *gd,const ModuleDef *mod,
317 int indentLevel, const ClassDef *inheritedFrom,const DString &inheritId
318 ) const
319{
320 //printf("----- writePlainDeclaration() ----\n");
321 if (numDecMembers()==-1)
322 {
323 err("MemberList::numDecMembers()==-1, so the members of this list have not been counted. Please report as a bug.\n");
324 abort();
325 }
327 {
328 //printf(" --> no members!\n");
329 return; // no members in this list
330 }
331 //printf(" --> writePlainDeclaration() numDecMembers()=%d\n",
332 // numDecMembers());
333
335
336 bool first=true;
337 for (const auto &md : m_members)
338 {
339 //printf(">>> Member '%s' type=%d visible=%d inheritedFrom=%p inheritId=%s\n",
340 // qPrint(md->name()),md->memberType(),md->isBriefSectionVisible(),(void*)inheritedFrom,qPrint(inheritId));
341 if ((inheritedFrom==nullptr || !md->isReimplementedBy(inheritedFrom)) &&
342 md->isBriefSectionVisible())
343 {
344 //printf(">>> rendering\n");
345 switch(md->memberType())
346 {
347 case MemberType::Define: // fall through
348 //case MemberType::Prototype: // fall through
349 case MemberType::Typedef: // fall through
350 case MemberType::Variable: // fall through
351 case MemberType::Function: // fall through
352 case MemberType::Signal: // fall through
353 case MemberType::Slot: // fall through
354 case MemberType::DCOP: // fall through
355 case MemberType::Property: // fall through
356 case MemberType::Interface: // fall through
357 case MemberType::Service: // fall through
358 case MemberType::Sequence: // fall through
359 case MemberType::Dictionary: // fall through
360 case MemberType::Event:
361 {
362 if (first) ol.startMemberList(),first=false;
363 md->writeDeclaration(ol,cd,nd,fd,gd,mod,inGroup,indentLevel,inheritedFrom,inheritId);
364 break;
365 }
366 case MemberType::Enumeration:
367 {
368 // if this is an anonymous enum and there are variables of this
369 // enum type (i.e. enumVars>0), then we do not show the enum here.
370 if (countEnumValues(md)==0) // show enum here
371 {
372 //printf("Enum!!\n");
373 if (first)
374 {
375 ol.startMemberList();
376 first=false;
377 }
380 bool detailsLinkable = md->hasDetailedDescription();
381 if (!detailsLinkable)
382 {
383 ol.startDoxyAnchor(md->getOutputFileBase(),DString(),md->anchor(),md->name(),DString());
384 ol.addLabel(md->getOutputFileBase(),md->anchor());
385 }
386 if (md->isSliceLocal())
387 {
388 ol.writeString("local ");
389 }
390 DString enumType = "enum ";
391 if (md->getLanguage()==SrcLangExt::Cpp && md->isStrong())
392 {
393 if (md->isEnumStruct())
394 {
395 enumType+="struct ";
396 }
397 else
398 {
399 enumType+="class ";
400 }
401 }
402 if (md->name().startsWith("@"))
403 {
404 ol.writeObjectLink(md->getReference(),md->getOutputFileBase(),md->anchor(),enumType);
405 }
406 else
407 {
408 ol.writeString(enumType);
409 }
411 md->writeEnumDeclaration(ol,cd,nd,fd,gd,mod);
412 if (!detailsLinkable)
413 {
414 ol.endDoxyAnchor(md->getOutputFileBase(),md->anchor());
415 }
417 if (!md->briefDescription().empty() && Config_getBool(BRIEF_MEMBER_DESC))
418 {
419 auto parser { createDocParser() };
420 auto ast { validatingParseDoc(*parser.get(),
421 md->briefFile(),
422 md->briefLine(),
423 cd ? cd : md->getOuterScope(),
424 md,
425 md->briefDescription(),
426 DocOptions()
427 .setIndexWords(true)
428 .setSingleLine(true))
429 };
430 if (!ast->empty())
431 {
432 ol.startMemberDescription(md->anchor(),inheritId);
433 ol.writeDoc(ast.get(),cd,md);
434 if (md->hasDetailedDescription())
435 {
437 ol.docify(" ");
438 ol.startTextLink(md->getOutputFileBase(),
439 md->anchor());
441 ol.endTextLink();
442 ol.enableAll();
443 }
445 }
446 }
447 ol.endMemberDeclaration(md->anchor(),inheritId);
448 }
449 md->warnIfUndocumented();
450 break;
451 }
452 case MemberType::Friend:
453 if (inheritedFrom==nullptr)
454 {
455 if (first)
456 {
457 ol.startMemberList();
458 first=false;
459 }
460 md->writeDeclaration(ol,cd,nd,fd,gd,mod,inGroup,indentLevel,inheritedFrom,inheritId);
461 break;
462 }
463 case MemberType::EnumValue:
464 {
465 if (inGroup)
466 {
467 //printf("EnumValue!\n");
468 if (first) ol.startMemberList(),first=false;
469 md->writeDeclaration(ol,cd,nd,fd,gd,mod,true,indentLevel,inheritedFrom,inheritId);
470 }
471 }
472 break;
473 }
474 }
475 }
476
477 if (!first)
478 {
479 ol.endMemberList();
480 }
481
483 //printf("----- end writePlainDeclaration() ----\n");
484}
485
486/** Writes the list of members to the output.
487 * @param ol Output list to write to
488 * @param cd non-null if this list is part of class documentation.
489 * @param nd non-null if this list is part of namespace documentation.
490 * @param fd non-null if this list is part of file documentation.
491 * @param gd non-null if this list is part of group documentation.
492 * @param mod non-null if this list is part of module documentation.
493 * @param title Title to use for the member list.
494 * @param subtitle Sub title to use for the member list.
495 * @param showEnumValues Obsolete, always set to false.
496 * @param showInline if set to true if title is rendered differently
497 * @param inheritedFrom if not 0, the list is shown inside the
498 * given class as inherited members, parameter cd points to the
499 * class containing the members.
500 * @param lt Type of list that is inherited from.
501 * @param showSectionTitle do we show the "additional members" header or not?
502 * When combining public and protected inherited members under a single header only for the first list it should be shown
503 */
505 const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod,
506 const DString &title,const DString &subtitle, bool /*showEnumValues*/,
507 bool showInline,const ClassDef *inheritedFrom,MemberListType lt,bool showSectionTitle) const
508{
509 //printf("----- writeDeclaration() this=%p ---- inheritedFrom=%p\n",this,inheritedFrom);
510 bool optimizeVhdl = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
511 DString inheritId;
512
513 const Definition *ctx = cd;
514 if (ctx==nullptr && nd) ctx = nd;
515 if (ctx==nullptr && gd) ctx = gd;
516 if (ctx==nullptr && mod) ctx = mod;
517 if (ctx==nullptr && fd) ctx = fd;
518
519 //printf("%p: MemberList::writeDeclaration(title='%s',subtitle='%s')=%d inheritedFrom=%p\n",
520 // (void*)this,qPrint(title),qPrint(subtitle),numDecMembers(),(void*)inheritedFrom);
521
522 int num = numDecMembers(inheritedFrom);
523 int numEnumValues = numDecEnumValues();
524 if (inheritedFrom && num>0)
525 {
526 if (cd && !optimizeVhdl)
527 {
528 inheritId = substitute(lt.toLabel(),"-","_")+"_"+
530 if (showSectionTitle && !title.empty())
531 {
532 ol.writeInheritedSectionTitle(inheritId,cd->getReference(),
533 cd->getOutputFileBase(),
534 cd->anchor(),title,cd->displayName());
535 }
536 }
537 }
538 else if (num>numEnumValues)
539 {
540 if (!title.empty())
541 {
542 if (showInline)
543 {
545 }
546 else
547 {
549 }
550 ol.parseText(title);
551 if (showInline)
552 {
553 ol.endInlineHeader();
554 }
555 else
556 {
557 ol.endMemberHeader();
558 }
559 }
560 if (!subtitle.stripWhiteSpace().empty())
561 {
563 ol.generateDoc("[generated]", -1, ctx, nullptr, subtitle, DocOptions());
565 }
566 }
567 if (num>numEnumValues)
568 {
570 // TODO: Two things need to be worked out for proper VHDL output:
571 // 1. Signals and types under the group need to be
572 // formatted to associate them with the group somehow
573 // indentation, or at the very least, extra space after
574 // the group is done
575 // 2. This might need to be repeated below for memberGroupLists
576 if (optimizeVhdl) // use specific declarations function
577 {
578 VhdlDocGen::writeVhdlDeclarations(this,ol,nullptr,cd,nullptr,nullptr,nullptr);
579 }
580 else
581 {
582 writePlainDeclarations(ol,inGroup,cd,nd,fd,gd,mod,0,inheritedFrom,inheritId);
583 }
584
585 //printf("memberGroupList=%p\n",memberGroupList);
586 int groupId=0;
587 for (const auto &mg : m_memberGroupRefList)
588 {
589 bool hasHeader=!mg->header().empty();
590 if (inheritId.empty())
591 {
592 DString groupAnchor = DString(listType().toLabel())+"-"+DString().setNum(groupId++);
593 //printf("mg->header=%s hasHeader=%d\n",qPrint(mg->header()),hasHeader);
594 ol.startMemberGroupHeader(groupAnchor,hasHeader);
595 if (hasHeader)
596 {
597 ol.parseText(mg->header());
598 }
599 ol.endMemberGroupHeader(hasHeader);
600 if (!mg->documentation().empty())
601 {
602 //printf("Member group has docs!\n");
604 ol.generateDoc(mg->docFile(),
605 mg->docLine(),
606 mg->memberContainer(),
607 nullptr,
608 mg->documentation()+"\n",
609 DocOptions());
611 }
612 ol.startMemberGroup();
613 }
614 //printf("--- mg->writePlainDeclarations ---\n");
615 mg->writePlainDeclarations(ol,inGroup,cd,nd,fd,gd,mod,0,inheritedFrom,inheritId);
616 if (inheritId.empty())
617 {
618 ol.endMemberGroup(hasHeader);
619 }
620 }
621 }
622 if (inheritedFrom && cd)
623 {
624 // also add members that of this list type, that are grouped together
625 // in a separate list in class 'inheritedFrom'
626 cd->addGroupedInheritedMembers(ol,m_listType,inheritedFrom,inheritId);
627 }
628 //printf("----- end writeDeclaration() ----\n");
629}
630
632 const DString &scopeName, const Definition *container,
633 const DString &title,const DString &anchor,
634 bool showEnumValues,bool showInline) const
635{
636 if (numDocMembers()==-1)
637 {
638 err("MemberList::numDocMembers()==-1, so the members of this list have not been counted. Please report as a bug.\n");
639 abort();
640 }
641
642 if (numDocMembers()==0) return;
643 if (!showEnumValues && numDocMembers()<=numDocEnumValues()) return;
644
645 if (!title.empty())
646 {
649 ol.writeRuler();
652 ol.startGroupHeader(anchor,showInline ? 2 : 0);
653 ol.parseText(title);
654 ol.endGroupHeader(showInline ? 2 : 0);
655 }
657
658 struct OverloadInfo
659 {
660 uint32_t count = 1;
661 uint32_t total = 0;
662 };
663 std::unordered_map<std::string,OverloadInfo> overloadInfo;
664 // count the number of overloaded members
665 for (const auto &md : m_members)
666 {
667 if (md->isDetailedSectionVisible(m_container) &&
668 !(md->isEnumValue() && !showInline))
669 {
670 auto it = overloadInfo.emplace(md->name().str(),OverloadInfo()).first;
671 it->second.total++;
672 }
673 }
674
675 for (const auto &md : m_members)
676 {
677 if (md->isDetailedSectionVisible(m_container) &&
678 !(md->isEnumValue() && !showInline))
679 {
680 auto it = overloadInfo.find(md->name().str());
681 uint32_t overloadCount = it->second.total;
682 uint32_t &count = it->second.count;
684 if (mdm)
685 {
686 mdm->writeDocumentation(this,count++,overloadCount,ol,scopeName,container,
687 m_container==MemberListContainer::Group,showEnumValues,showInline);
688 }
689 }
690 }
691 //printf("MemberList::writeDocumentation() -- member groups %d\n",memberGroupList->count());
692 for (const auto &mg : m_memberGroupRefList)
693 {
694 mg->writeDocumentation(ol,scopeName,container,showEnumValues,showInline);
695 }
696 ol.endMemberDocList();
697}
698
699// members in a table
701 const Definition *container) const
702{
703 //printf("MemberList count=%d enumValues=%d\n",numDocMembers(),numDocEnumValues());
704 if (numDocMembers()<=numDocEnumValues()) return; // only enum values and they should be excluded
705
706 const ClassDef *cd = nullptr;
708 {
709 cd = toClassDef(container);
710 }
711 ol.startMemberDocSimple(cd && cd->isJavaEnum());
712 for (const auto &md : m_members)
713 {
715 if (mdm)
716 {
718 }
719 }
720 ol.endMemberDocSimple(cd && cd->isJavaEnum());
721}
722
723// separate member pages
725 const DString &scopeName, const DefinitionMutable *container, int hierarchyLevel) const
726{
727 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
728
729 struct OverloadInfo
730 {
731 uint32_t count = 1;
732 uint32_t total = 0;
733 };
734 std::unordered_map<std::string,OverloadInfo> overloadInfo;
735
736 // count the number of overloaded members
737 for (const auto &imd : m_members)
738 {
740
741 if (md && md->hasDetailedDescription())
742 {
743 auto it = overloadInfo.emplace(md->name().str(),OverloadInfo()).first;
744 it->second.total++;
745 }
746 }
747
748 for (const auto &imd : m_members)
749 {
750 Definition *container_d = toDefinition(const_cast<DefinitionMutable*>(container));
752 if (md && md->hasDetailedDescription())
753 {
754 auto it = overloadInfo.find(md->name().str());
755 uint32_t overloadCount = it->second.total;
756 uint32_t &count = it->second.count;
757 DString diskName=md->getOutputFileBase();
758 DString title=md->qualifiedName();
759 startFile(ol,diskName,false,md->name(),title,HighlightedItem::None,!generateTreeView,diskName, hierarchyLevel);
760 if (!generateTreeView)
761 {
763 ol.endQuickIndices();
764 }
765 ol.startContents();
766
767 if (generateTreeView)
768 {
769 md->writeDocumentation(this,count++,overloadCount,ol,scopeName,container_d,m_container==MemberListContainer::Group);
770
771 ol.endContents();
773 }
774 else
775 {
776 ol.writeString("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n"
777 " <tr>\n"
778 " <td valign=\"top\">\n");
779
781
782 ol.writeString(" </td>\n");
783 ol.writeString(" <td valign=\"top\" class=\"mempage\">\n");
784
785 md->writeDocumentation(this,count++,overloadCount,ol,scopeName,container_d,m_container==MemberListContainer::Group);
786
787 ol.writeString(" </td>\n");
788 ol.writeString(" </tr>\n");
789 ol.writeString("</table>\n");
790
791 endFile(ol);
792 }
793 }
794 }
795 for (const auto &mg : m_memberGroupRefList)
796 {
797 mg->writeDocumentationPage(ol,scopeName,container);
798 }
799}
800
802{
803 m_memberGroupRefList.push_back(mg);
804}
805
807{
808 for (const auto &imd : m_members)
809 {
811 if (md && !md->isAlias() && (md->getGroupDef()==nullptr || def->definitionType()==Definition::TypeGroup))
812 {
813 md->addListReference(def);
814 const MemberVector &enumFields = md->enumFieldList();
815 if (md->memberType()==MemberType::Enumeration && !enumFields.empty())
816 {
817 //printf(" Adding enum values!\n");
818 for (const auto &vmd : enumFields)
819 {
821 if (vmdm)
822 {
823 //printf(" adding %s\n",qPrint(vmd->name()));
824 vmdm->addListReference(def);
825 }
826 }
827 }
828 }
829 }
830 for (const auto &mg : m_memberGroupRefList)
831 {
832 mg->addListReferences(def);
833 }
834}
835
837{
838 for (const auto &imd : m_members)
839 {
841 if (md && !md->isAlias() && (md->getGroupDef()==nullptr || def->definitionType()==Definition::TypeGroup))
842 {
844 const MemberVector &enumFields = md->enumFieldList();
845 if (md->memberType()==MemberType::Enumeration && !enumFields.empty())
846 {
847 //printf(" Adding enum values!\n");
848 for (const auto &vmd : enumFields)
849 {
851 if (vmdm)
852 {
853 //printf(" adding %s\n",qPrint(vmd->name()));
854 vmdm->addRequirementReferences(def);
855 }
856 }
857 }
858 }
859 }
860 for (const auto &mg : m_memberGroupRefList)
861 {
862 mg->addRequirementReferences(def);
863 }
864}
865
867{
868 for (const auto &imd : m_members)
869 {
871 if (md)
872 {
874 }
875 }
876 for (const auto &mg : m_memberGroupRefList)
877 {
878 mg->findSectionsInDocumentation(d);
879 }
880}
881
883{
884 m_needsSorting = b;
885}
886
887void MemberList::writeTagFile(TextStream &tagFile,bool useQualifiedName,bool showNamespaceMembers)
888{
889 for (const auto &imd : m_members)
890 {
892 if (md)
893 {
894 if (md->getLanguage()!=SrcLangExt::VHDL)
895 {
896 md->writeTagFile(tagFile,useQualifiedName,showNamespaceMembers);
897 if (md->memberType()==MemberType::Enumeration && !md->isStrong())
898 {
899 for (const auto &ivmd : md->enumFieldList())
900 {
902 if (vmd)
903 {
904 vmd->writeTagFile(tagFile,useQualifiedName,showNamespaceMembers);
905 }
906 }
907 }
908 }
909 else
910 {
911 VhdlDocGen::writeTagFile(md,tagFile);
912 }
913 }
914 }
915 for (const auto &mg : m_memberGroupRefList)
916 {
917 mg->writeTagFile(tagFile,useQualifiedName);
918 }
919}
920
921// compute the HTML anchors for a list of members
923{
924 //int count=0;
925 for (const auto &md : m_members)
926 {
928 if (mdm && !md->isReference())
929 {
930 mdm->setAnchor();
931 }
932 }
933}
934
A abstract class representing of a compound symbol.
Definition classdef.h:100
virtual bool isJavaEnum() const =0
virtual void addGroupedInheritedMembers(OutputList &ol, MemberListType lt, const ClassDef *inheritedFrom, const DString &inheritId) const =0
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
DString & setNum(short n)
Definition dstring.h:552
size_t rfind(char c, size_t pos=npos) const
Definition dstring.h:244
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:318
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
Definition dstring.h:178
size_t find(char c, size_t pos=0) const
Definition dstring.h:239
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:337
const std::string & str() const
Definition dstring.h:645
The common base class of all entity definitions found in the sources.
Definition definition.h:77
virtual DString briefDescription(bool abbreviate=false) const =0
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual DString getDefFileName() const =0
virtual int getDefLine() const =0
virtual DefType definitionType() const =0
virtual const DString & name() const =0
virtual DString displayName(bool includeScope=true) const =0
virtual DString qualifiedName() const =0
virtual DString anchor() const =0
virtual DString getReference() const =0
virtual bool isAlias() const =0
virtual Definition * getOuterScope() const =0
virtual bool isReference() const =0
virtual DString getOutputFileBase() const =0
virtual void writeQuickMemberLinks(OutputList &, const MemberDef *) const =0
virtual void writeNavigationPath(OutputList &ol) const =0
A model of a file symbol.
Definition filedef.h:97
A model of a group of symbols.
Definition groupdef.h:48
A model of a class/file/namespace member symbol.
Definition memberdef.h:45
virtual bool isDestructor() const =0
virtual bool hasDetailedDescription() const =0
virtual bool isConstructor() const =0
virtual DString argsString() const =0
virtual GroupDef * getGroupDef()=0
virtual const MemberVector & enumFieldList() const =0
virtual MemberType memberType() const =0
virtual bool isStrong() const =0
virtual void writeDocumentation(const MemberList *ml, int memCount, int memTotal, OutputList &ol, const DString &scopeName, const Definition *container, bool inGroup, bool showEnumValues=false, bool showInline=false) const =0
virtual void writeMemberDocSimple(OutputList &ol, const Definition *container) const =0
virtual void addListReference(const Definition *)=0
virtual void findSectionsInDocumentation()=0
virtual void setAnonymousEnumType(const MemberDef *md)=0
virtual void writeTagFile(TextStream &, bool useQualifiedName, bool showNamespaceMembers) const =0
virtual void addRequirementReferences(const Definition *)=0
virtual void setAnchor()=0
A class representing a group of members.
Definition membergroup.h:42
void addListReferences(const Definition *def)
int numDecEnumValues() const
Definition memberlist.h:138
int m_numDecEnumValues
Definition memberlist.h:174
int numDocMembers() const
Definition memberlist.h:139
int numDocEnumValues() const
Definition memberlist.h:140
int countEnumValues(const MemberDef *md) const
void writeTagFile(TextStream &, bool useQualifiedName=false, bool showNamespaceMembers=true)
int m_numDocMembers
Definition memberlist.h:175
int m_numDecMembers
Definition memberlist.h:173
MemberListContainer container() const
Definition memberlist.h:132
MemberList(MemberListType lt, MemberListContainer container)
int numDecMembers() const
Definition memberlist.h:136
MemberGroupRefList m_memberGroupRefList
Definition memberlist.h:177
bool m_needsSorting
Definition memberlist.h:180
void writeDocumentationPage(OutputList &ol, const DString &scopeName, const DefinitionMutable *container, int hierarchyLevel=0) const
void setAnonymousEnumType()
int countInheritableMembers(const ClassDef *inheritedFrom) const
int m_numDocEnumValues
Definition memberlist.h:176
MemberListContainer m_container
Definition memberlist.h:178
void setNeedsSorting(bool b)
void writeSimpleDocumentation(OutputList &ol, const Definition *container) const
void writeDeclarations(OutputList &ol, const ClassDef *cd, const NamespaceDef *nd, const FileDef *fd, const GroupDef *gd, const ModuleDef *mod, const DString &title, const DString &subtitle, bool showEnumValues=false, bool showInline=false, const ClassDef *inheritedFrom=nullptr, MemberListType lt=MemberListType::PubMethods(), bool showSectionTitle=true) const
Writes the list of members to the output.
void writeDocumentation(OutputList &ol, const DString &scopeName, const Definition *container, const DString &title, const DString &anchor, bool showEnumValues=false, bool showInline=false) const
MemberListType listType() const
Definition memberlist.h:131
void addRequirementReferences(const Definition *def)
void countDecMembers() const
void countDocMembers()
MemberListType m_listType
Definition memberlist.h:179
void writePlainDeclarations(OutputList &ol, bool inGroup, const ClassDef *cd, const NamespaceDef *nd, const FileDef *fd, const GroupDef *gd, const ModuleDef *mod, int indentLevel, const ClassDef *inheritedFrom, const DString &inheritId) const
void findSectionsInDocumentation(const Definition *d)
void addMemberGroup(MemberGroup *mg)
void setAnchors()
int numDecMembers(const ClassDef *inheritedFrom) const
Definition memberlist.h:134
bool declVisible() const
Wrapper class for the MemberListType type.
Definition types.h:346
constexpr const char * toLabel() const noexcept
Definition types.h:402
A vector of MemberDef object.
Definition memberlist.h:36
bool empty() const noexcept
Definition memberlist.h:61
An abstract interface of a namespace symbol.
Class representing a list of output generators that are written to in parallel.
Definition outputlist.h:311
void writeDoc(const IDocNodeAST *ast, const Definition *ctx, const MemberDef *md, int sectionLevel=-1)
Definition outputlist.h:379
void startMemberDeclaration()
Definition outputlist.h:565
void parseText(const DString &textStr)
void disable(OutputType o)
void writeObjectLink(const DString &ref, const DString &file, const DString &anchor, const DString &name)
Definition outputlist.h:435
void writeRuler()
Definition outputlist.h:517
void endContents()
Definition outputlist.h:616
void endMemberDescription()
Definition outputlist.h:563
void endInlineHeader()
Definition outputlist.h:483
void endMemberGroupDocs()
Definition outputlist.h:507
void endMemberDeclaration(const DString &anchor, const DString &inheritId)
Definition outputlist.h:567
void docify(const DString &s)
Definition outputlist.h:433
void startMemberHeader(const DString &anchor, int typ=2)
Definition outputlist.h:465
void writeAnchor(const DString &fileName, const DString &name)
Definition outputlist.h:519
void endMemberGroupHeader(bool b)
Definition outputlist.h:503
void insertMemberAlign(bool templ=false)
Definition outputlist.h:513
void writeString(const DString &text)
Definition outputlist.h:407
void endDoxyAnchor(const DString &fn, const DString &anchor)
Definition outputlist.h:537
void endMemberDocList()
Definition outputlist.h:475
void startMemberGroup()
Definition outputlist.h:509
void startMemberGroupHeader(const DString &id, bool b)
Definition outputlist.h:501
void startMemberList()
Definition outputlist.h:477
void endTextLink()
Definition outputlist.h:440
void addLabel(const DString &fName, const DString &anchor)
Definition outputlist.h:539
void endMemberItem(OutputGenerator::MemberItemType type)
Definition outputlist.h:491
void endMemberList()
Definition outputlist.h:479
void pushGeneratorState()
void startInlineHeader()
Definition outputlist.h:481
void disableAllBut(OutputType o)
void popGeneratorState()
void startTextLink(const DString &file, const DString &anchor)
Definition outputlist.h:438
void writeInheritedSectionTitle(const DString &id, const DString &ref, const DString &file, const DString &anchor, const DString &title, const DString &name)
Definition outputlist.h:569
void endGroupHeader(int extraLevels=0)
Definition outputlist.h:451
void startMemberItem(const DString &anchor, OutputGenerator::MemberItemType type, const DString &id=DString())
Definition outputlist.h:489
void endQuickIndices()
Definition outputlist.h:600
void startMemberDescription(const DString &anchor, const DString &inheritId=DString(), bool typ=false)
Definition outputlist.h:561
void generateDoc(const DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &docStr, const DocOptions &options)
void endMemberGroup(bool last)
Definition outputlist.h:511
void startMemberGroupDocs()
Definition outputlist.h:505
void startContents()
Definition outputlist.h:614
void startMemberDocSimple(bool b)
Definition outputlist.h:718
void startGroupHeader(const DString &id=DString(), int extraLevels=0)
Definition outputlist.h:449
void enableAll()
void endMemberHeader()
Definition outputlist.h:467
void endMemberSubtitle()
Definition outputlist.h:471
void startMemberDocList()
Definition outputlist.h:473
void endMemberDocSimple(bool b)
Definition outputlist.h:720
void startMemberSubtitle()
Definition outputlist.h:469
void startDoxyAnchor(const DString &fName, const DString &manName, const DString &anchor, const DString &name, const DString &args)
Definition outputlist.h:533
Text streaming class that buffers data.
Definition textstream.h:36
virtual DString trMore()=0
static void writeTagFile(MemberDefMutable *mdef, TextStream &tagFile)
static void writeVhdlDeclarations(const MemberList *, OutputList &, const GroupDef *, const ClassDef *, const FileDef *, const NamespaceDef *, const ModuleDef *)
ClassDef * toClassDef(Definition *d)
#define Config_getBool(name)
Definition config.h:33
Definition * toDefinition(DefinitionMutable *dm)
IDocParserPtr createDocParser()
factory function to create a parser
Definition docparser.cpp:59
IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf, const DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &input, const DocOptions &options)
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
Definition dstring.cpp:485
int dstricmp_sort(const char *str1, const char *str2)
Definition dstring.h:67
void endFileWithNavPath(OutputList &ol, const DefinitionMutable *d, bool showPageNavigation)
Definition index.cpp:452
void endFile(OutputList &ol, bool skipNavIndex, bool skipEndContents, const DString &navPath)
Definition index.cpp:431
void startFile(OutputList &ol, const DString &name, bool isSource, const DString &manName, const DString &title, HighlightedItem hli, bool additionalIndices, const DString &altSidebarName, int hierarchyLevel, const DString &allMembersFile)
Definition index.cpp:405
Translator * theTranslator
Definition language.cpp:76
MemberDefMutable * toMemberDefMutable(Definition *d)
int genericCompareMembers(const MemberDef *c1, const MemberDef *c2)
#define err(fmt,...)
Definition message.h:127
Helper class to pass options when calling OutputList::generateDoc().
Definition docoptions.h:24
MemberListContainer
Definition types.h:472
DString stripPath(const DString &s)
Definition util.cpp:3960
A bunch of utility functions.