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