Doxygen
Loading...
Searching...
No Matches
filedef.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 "filedef.h"
18
19// standard includes
20#include <unordered_set>
21
22// other includes
23#include "clangparser.h"
24#include "classdef.h"
25#include "classlist.h"
26#include "conceptdef.h"
27#include "config.h"
28#include "debug.h"
29#include "definitionimpl.h"
30#include "docparser.h"
31#include "dot.h"
32#include "dotincldepgraph.h"
33#include "doxygen.h"
34#include "entry.h"
35#include "htags.h"
36#include "language.h"
37#include "layout.h"
38#include "memberdef.h"
39#include "membergroup.h"
40#include "memberlist.h"
41#include "message.h"
42#include "moduledef.h"
43#include "namespacedef.h"
44#include "outputlist.h"
45#include "parserintf.h"
46#include "portable.h"
47#include "util.h"
48#include "vhdldocgen.h"
49
50//---------------------------------------------------------------------------
51
53{
54 bool isIDLorJava = lang==SrcLangExt::IDL || lang==SrcLangExt::Java;
55 if (isIDLorJava || (kind & IncludeKind_ImportMask))
56 {
57 return "import ";
58 }
59 else if (kind & IncludeKind_ObjCMask)
60 {
61 return "#import ";
62 }
63 else
64 {
65 return "#include ";
66 }
67}
68
70{
71 if (lang==SrcLangExt::Java || kind==IncludeKind::ImportModule) return "";
72 if ((kind & IncludeKind_LocalMask) || (lang==SrcLangExt::IDL))
73 {
74 return "\"";
75 }
76 else
77 {
78 return "<";
79 }
80}
81
83{
84 if (lang==SrcLangExt::IDL) return "\";";
85 else if (lang==SrcLangExt::Java) return ";";
86
87 switch (kind)
88 {
89 case IncludeKind::ImportLocal: return "\";";
90 case IncludeKind::ImportLocalObjC: return "\"";
91 case IncludeKind::IncludeLocal: return "\"";
92 case IncludeKind::ImportSystem: return ">;";
93 case IncludeKind::ImportSystemObjC: return ">";
94 case IncludeKind::IncludeSystem: return ">";
95 case IncludeKind::ImportModule: return ";";
96 }
97 return "";
98}
99
101{
102 DString result;
103 bool isIDLorJava = lang==SrcLangExt::IDL || lang==SrcLangExt::Java;
104 result.sprintf("local=\"%s\" import=\"%s\" module=\"%s\" objc=\"%s\"",
105 (kind & IncludeKind_LocalMask) ? "yes" : "no",
106 (isIDLorJava || (kind & IncludeKind_ImportMask)) ? "yes" : "no",
107 (kind==IncludeKind::ImportModule) ? "yes" : "no",
108 (kind & IncludeKind_ObjCMask) ? "yes" : "no");
109 return result;
110}
111
112//---------------------------------------------------------------------------
113
114using DefinitionLineMap = std::unordered_map<int,const Definition *>;
115using MemberDefLineMap = std::unordered_map<int,const MemberDef *>;
116using IncludeInfoMap = std::unordered_map<std::string, const IncludeInfo *>;
117
118class FileDefImpl final : public DefinitionMixin<FileDef>
119{
120 public:
121 FileDefImpl(const DString &p,const DString &n,const DString &ref=DString(),const DString &dn=DString());
122 ~FileDefImpl() override;
124
125 DefType definitionType() const override { return TypeFile; }
127 const DString &name() const override;
128
129 DString displayName(bool=true) const override { return localName(); }
130 DString fileName() const override { return m_fileName; }
131 DString getOutputFileBase() const override;
132 DString anchor() const override { return DString(); }
133 DString getSourceFileBase() const override;
134 DString includeName() const override;
137 DString absFilePath() const override { return m_filePath; }
138 const DString &docName() const override { return m_docname; }
139 bool isSource() const override { return m_isSource; }
140 bool isDocumentationFile() const override;
141 const Definition *getSourceDefinition(int lineNr) const override;
142 const MemberDef *getSourceMember(int lineNr) const override;
143 DString getPath() const override { return m_path; }
144 DString getVersion() const override { return m_fileVersion; }
145 bool isLinkableInProject() const override;
146 bool isLinkable() const override { return isLinkableInProject() || isReference(); }
147 bool isIncluded(const DString &name) const override;
148 DirDef *getDirDef() const override { return m_dir; }
149 ModuleDef *getModuleDef() const override { return m_moduleDef; }
150 const LinkedRefMap<NamespaceDef> &getUsedNamespaces() const override;
152 const IncludeInfoList &includeFileList() const override { return m_includeList; }
153 const IncludeInfoList &includedByFileList() const override { return m_includedByList; }
154 void getAllIncludeFilesRecursively(StringVector &incFiles) const override;
155 MemberList *getMemberList(MemberListType lt) const override;
156 const MemberLists &getMemberLists() const override { return m_memberLists; }
157 const MemberGroupList &getMemberGroups() const override { return m_memberGroups; }
158 const NamespaceLinkedRefMap &getNamespaces() const override { return m_namespaces; }
159 const ConceptLinkedRefMap &getConcepts() const override { return m_concepts; }
160 const ClassLinkedRefMap &getClasses() const override { return m_classes; }
161 DString title() const override;
162 bool hasDetailedDescription() const override;
163 DString fileVersion() const override;
164 bool subGrouping() const override { return m_subGrouping; }
165 void countMembers() override;
166 int numDocMembers() const override;
167 int numDecMembers() const override;
168 void addSourceRef(int line,const Definition *d,const MemberDef *md) override;
169 void writeDocumentation(OutputList &ol) override;
170 void writeMemberPages(OutputList &ol) override;
171 void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const override;
172 void writeSummaryLinks(OutputList &ol) const override;
173 void writePageNavigation(OutputList &ol) const override;
174 void writeTagFile(TextStream &t) override;
175 void writeSourceHeader(OutputList &ol) override;
176 void writeSourceBody(OutputList &ol,ClangTUParser *clangParser) override;
177 void writeSourceFooter(OutputList &ol) override;
178 void parseSource(ClangTUParser *clangParser) override;
179 void setDiskName(const DString &name) override;
180 void insertMember(MemberDef *md) override;
181 void removeMember(MemberDef *md) override;
182 void insertClass(ClassDef *cd) override;
183 void insertConcept(ConceptDef *cd) override;
184 void insertNamespace(NamespaceDef *nd) override;
185 void computeAnchors() override;
186 void setDirDef(DirDef *dd) override { m_dir=dd; }
187 void setModuleDef(ModuleDef *mod) override { m_moduleDef=mod; }
188 void addUsingDirective(NamespaceDef *nd) override;
189 void addUsingDeclaration(const Definition *d) override;
190 void combineUsingRelations() override;
191 bool generateSourceFile() const override;
192 void sortMemberLists() override;
193 void addIncludeDependency(const FileDef *fd,const DString &incName,IncludeKind kind) override;
194 void addIncludedByDependency(const FileDef *fd,const DString &incName,IncludeKind kind) override;
195 void addMembersToMemberGroup() override;
197 void findSectionsInDocumentation() override;
198 void setIncludeFile(FileDef *fd, const DString &includeName,bool local, bool force) override;
199 void addIncludedUsingDirectives(FileDefSet &visitedFiles) override;
200 void addListReferences() override;
201 void addRequirementReferences() override;
202
203 bool hasIncludeGraph() const override;
204 bool hasIncludedByGraph() const override;
205 void overrideIncludeGraph(bool e) override;
206 void overrideIncludedByGraph(bool e) override;
207
208 bool visibleInIndex(bool &genSourceFile) const override;
209
210 private:
211 void setDiskNameLocal(const DString &name);
212 void acquireFileVersion();
221 void writeSourceLink(OutputList &ol);
223 bool isConstantGroup);
225 void writeConcepts(OutputList &ol,const DString &title);
235
242 std::unique_ptr<IncludeInfo> m_incInfo;
254 DirDef *m_dir = nullptr;
266 bool m_hasIncludeGraph = Config_getBool(INCLUDE_GRAPH);
267 bool m_hasIncludedByGraph = Config_getBool(INCLUDED_BY_GRAPH);
268};
269
270std::unique_ptr<FileDef> createFileDef(const DString &p,const DString &n,const DString &ref,const DString &dn)
271{
272 return std::make_unique<FileDefImpl>(p,n,ref,dn);
273}
274
275
276//---------------------------------------------------------------------------
277
278/*! create a new file definition, where \a p is the file path,
279 \a nm the file name, and \a lref is an HTML anchor name if the
280 file was read from a tag file or nullptr otherwise
281*/
283 const DString &lref,const DString &dn)
284 : DefinitionMixin(p+nm,1,1,nm,nullptr,nullptr,!p.empty())
285{
287 m_filePath=p+nm;
288 m_fileName=nm;
289
290 setReference(lref);
291 setDiskNameLocal(!dn.empty() ? dn : nm);
292 m_isSource = EntryType::guessSection(nm).isSource();
293 m_docname = nm;
294 m_dir = nullptr;
295 if (Config_getBool(FULL_PATH_NAMES))
296 {
298 }
300 Config_getBool(FULL_PATH_NAMES) ? m_fileName : DefinitionMixin::name()));
302 m_subGrouping=Config_getBool(SUBGROUPING);
303}
304
305/*! destroy the file definition */
309
311{
312 if (isReference())
313 {
315 m_inclDepFileName = name+"_incl";
316 m_inclByDepFileName = name+"_dep_incl";
317 }
318 else
319 {
323 }
324}
325
330
331/*! Compute the HTML anchor names for all members in the class */
333{
334 MemberList *ml = getMemberList(MemberListType::AllMembersList());
335 if (ml) ml->setAnchors();
336}
337
339{
340 //printf("FileDefImpl::distributeMemberGroupDocumentation()\n");
341 for (const auto &mg : m_memberGroups)
342 {
343 mg->distributeMemberGroupDocumentation();
344 }
345}
346
348{
352 for (const auto &mg : m_memberGroups)
353 {
354 mg->findSectionsInDocumentation(this);
355 }
356
357 for (auto &ml : m_memberLists)
358 {
359 if (ml->listType().isDeclaration())
360 {
361 ml->findSectionsInDocumentation(this);
362 }
363 }
364}
365
367{
368 bool repeatBrief = Config_getBool(REPEAT_BRIEF);
369 bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
370 return ((!briefDescription().empty() && repeatBrief) ||
371 !documentation().stripWhiteSpace().empty() || // avail empty section
372 (sourceBrowser && getStartBodyLine()!=-1 && getBodyDef()) ||
374 );
375}
376
378{
381 tagFile << " <compound kind=\"file\">\n";
382 tagFile << " <name>" << convertToXML(name()) << "</name>\n";
383 tagFile << " <path>" << convertToXML(stripFromPath(getPath())) << "</path>\n";
384 tagFile << " <filename>" << fn << "</filename>\n";
385 for (const auto &ii : m_includeList)
386 {
387 const FileDef *fd=ii.fileDef;
388 if (fd && fd->isLinkable() && !fd->isReference())
389 {
390 DString attr = includeTagFileAttributes(fd->getLanguage(),ii.kind);
391 tagFile << " <includes id=\""
392 << convertToXML(fd->getOutputFileBase()) << "\" "
393 << "name=\"" << convertToXML(fd->name()) << "\" "
394 << attr << ">"
395 << convertToXML(ii.includeName)
396 << "</includes>\n";
397 }
398 }
399 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::File))
400 {
401 switch (lde->kind())
402 {
403 case LayoutDocEntry::FileClasses:
404 {
406 }
407 break;
408 case LayoutDocEntry::FileInterfaces:
409 {
411 }
412 break;
413 case LayoutDocEntry::FileStructs:
414 {
416 }
417 break;
418 case LayoutDocEntry::FileRecords:
419 {
421 }
422 break;
423 case LayoutDocEntry::FileExceptions:
424 {
426 }
427 break;
428 case LayoutDocEntry::FileConcepts:
429 {
430 for (const auto *nd : m_concepts)
431 {
432 if (nd->isLinkableInProject())
433 {
434 tagFile << " <concept>" << convertToXML(nd->name()) << "</concept>\n";
435 }
436 }
437 }
438 break;
439 case LayoutDocEntry::FileNamespaces:
440 {
441 for (const auto *nd : m_namespaces)
442 {
443 if (nd->isLinkableInProject())
444 {
445 tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>\n";
446 }
447 }
448 }
449 break;
450 case LayoutDocEntry::MemberDecl:
451 {
452 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
453 if (lmd)
454 {
455 MemberList * ml = getMemberList(lmd->type);
456 if (ml)
457 {
458 ml->writeTagFile(tagFile,false,false);
459 }
460 }
461 }
462 break;
463 case LayoutDocEntry::MemberGroups:
464 {
465 for (const auto &mg : m_memberGroups)
466 {
467 mg->writeTagFile(tagFile);
468 }
469 }
470 break;
471 default:
472 break;
473 }
474 }
475
477 tagFile << " </compound>\n";
478}
479
481{
483 {
486 ol.writeRuler();
490 ol.writeAnchor(DString(),"details");
492 ol.startGroupHeader("details");
493 ol.parseText(title);
494 ol.endGroupHeader();
495
496 ol.startTextBlock();
497 if (!briefDescription().empty() && Config_getBool(REPEAT_BRIEF))
498 {
500 briefLine(),
501 this,
502 nullptr,
504 DocOptions());
505 }
506 if (!briefDescription().empty() && Config_getBool(REPEAT_BRIEF) &&
507 !documentation().empty())
508 {
512 ol.enableAll();
515 ol.writeString("\n\n");
517 }
518 if (!documentation().empty())
519 {
520 ol.generateDoc(docFile(),
521 docLine(),
522 this,
523 nullptr,
524 documentation()+"\n",
525 DocOptions()
526 .setIndexWords(true));
527 }
528 //printf("Writing source ref for file %s\n",qPrint(name()));
529 if (Config_getBool(SOURCE_BROWSER))
530 {
531 ol.startParagraph("definition");
533 if (size_t fileMarkerPos = refText.find("@0"); fileMarkerPos!=DString::npos) // should always pass this.
534 {
535 ol.parseText(refText.left(fileMarkerPos)); //text left from marker 1
537 ol.parseText(refText.right(
538 refText.length()-fileMarkerPos-2)); // text right from marker 2
539 }
540 else
541 {
542 err("translation error: invalid marker in trDefinedInSourceFile()\n");
543 }
544 ol.endParagraph();
545 }
547 ol.endTextBlock();
548 }
549}
550
552{
554 {
555 auto parser { createDocParser() };
556 auto ast { validatingParseDoc(*parser.get(),
557 briefFile(),
558 briefLine(),
559 this,
560 nullptr,
562 DocOptions()
563 .setIndexWords(true)
564 .setSingleLine(true))
565 };
566 if (!ast->empty())
567 {
568 ol.startParagraph();
571 ol.writeString(" - ");
573 ol.writeDoc(ast.get(),this,nullptr);
576 ol.writeString(" \n");
578
579 if (Config_getBool(REPEAT_BRIEF) ||
580 !documentation().stripWhiteSpace().empty()
581 )
582 {
584 ol.startTextLink(DString(),"details");
586 ol.endTextLink();
587 }
589 ol.endParagraph();
590 }
591 }
592 ol.writeSynopsis();
593}
594
596{
597 for (const auto &cd : list)
598 {
599 if (cd->isLinkableInProject())
600 {
601 tagFile << " <class kind=\"" << cd->compoundTypeString() <<
602 "\">" << convertToXML(cd->name()) << "</class>\n";
603 }
604 }
605}
606
608{
609 if (m_incInfo)
610 {
611 DString nm=m_incInfo->includeName.empty() ?
612 (m_incInfo->fileDef ?
613 m_incInfo->fileDef->docName() : DString()
614 ) :
615 m_incInfo->includeName;
616 if (!nm.empty())
617 {
618 ol.startParagraph();
619 ol.startTypewriter();
620 ol.docify(::includeStatement(SrcLangExt::Cpp,m_incInfo->kind));
621 ol.docify(::includeOpen(SrcLangExt::Cpp,m_incInfo->kind));
624 ol.docify(nm);
627 if (m_incInfo->fileDef)
628 {
629 ol.writeObjectLink(DString(),m_incInfo->fileDef->includeName(),DString(),nm);
630 }
631 else
632 {
633 ol.docify(nm);
634 }
636 ol.docify(::includeClose(SrcLangExt::Cpp,m_incInfo->kind));
637 ol.endTypewriter();
638 ol.endParagraph();
639 }
640 }
641 else if (!m_includeList.empty())
642 {
643 ol.startTextBlock(true);
644 for (const auto &ii : m_includeList)
645 {
646 const FileDef *fd=ii.fileDef;
647 ol.startTypewriter();
648 SrcLangExt lang = fd ? fd->getLanguage() : SrcLangExt::Cpp;
649 ol.docify(::includeStatement(lang,ii.kind));
650 ol.docify(::includeOpen(lang,ii.kind));
652 ol.docify(ii.includeName);
653 ol.enableAll();
655
656 // Here we use the include file name as it appears in the file.
657 // we could also we the name as it is used within doxygen,
658 // then we should have used fd->docName() instead of ii->includeName
659 if (fd && fd->isLinkable())
660 {
663 DString(),ii.includeName);
664 }
665 else
666 {
668 if (ii.kind==IncludeKind::ImportModule && mod && mod->isLinkable())
669 {
671 DString(),ii.includeName);
672 }
673 else
674 {
675 ol.docify(ii.includeName);
676 }
677 }
678
679 ol.enableAll();
680 ol.docify(::includeClose(lang,ii.kind));
681 ol.endTypewriter();
682 ol.lineBreak();
683 }
684 ol.endTextBlock();
685 }
686}
687
689{
690 if (Config_getBool(HAVE_DOT) && m_hasIncludeGraph /*&& Config_getBool(INCLUDE_GRAPH)*/)
691 {
692 //printf("Graph for file %s\n",qPrint(name()));
693 DotInclDepGraph incDepGraph(this,false);
694 if (incDepGraph.isTooBig())
695 {
696 warn_uncond("Include graph for '{}' not generated, too many nodes ({}), threshold is {}. Consider increasing DOT_GRAPH_MAX_NODES.\n",
697 qPrint(name()), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES));
698 }
699 else if (!incDepGraph.isTrivial())
700 {
701 ol.startTextBlock();
705 ol.endInclDepGraph(incDepGraph);
706 ol.enableAll();
707 ol.endTextBlock(true);
708 }
709 //incDepGraph.writeGraph(Config_getString(HTML_OUTPUT),fd->getOutputFileBase());
710 }
711}
712
714{
715 if (Config_getBool(HAVE_DOT) && m_hasIncludedByGraph /*&& Config_getBool(INCLUDED_BY_GRAPH)*/)
716 {
717 //printf("Graph for file %s\n",qPrint(name()));
718 DotInclDepGraph incDepGraph(this,true);
719 if (incDepGraph.isTooBig())
720 {
721 warn_uncond("Included by graph for '{}' not generated, too many nodes ({}), threshold is {}. Consider increasing DOT_GRAPH_MAX_NODES.\n",
722 qPrint(name()), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES));
723 }
724 else if (!incDepGraph.isTrivial())
725 {
726 ol.startTextBlock();
730 ol.endInclDepGraph(incDepGraph);
731 ol.enableAll();
732 ol.endTextBlock(true);
733 }
734 //incDepGraph.writeGraph(Config_getString(HTML_OUTPUT),fd->getOutputFileBase());
735 }
736}
737
738
740{
741 //printf("%s: generateSourceFile()=%d\n",qPrint(name()),generateSourceFile());
742 if (generateSourceFile())
743 {
745 ol.startParagraph();
748 ol.endTextLink();
749 ol.endParagraph();
750 ol.enableAll();
751 }
752}
753
755 bool const isConstantGroup)
756{
757 // write list of namespaces
758 m_namespaces.writeDeclaration(ol,title,isConstantGroup);
759}
760
762{
763 // write list of classes
764 list.writeDeclaration(ol,nullptr,title,false);
765}
766
768{
769 // write list of classes
771}
772
774{
775 // temporarily undo the disabling could be done by startMemberDocumentation()
776 // as a result of setting SEPARATE_MEMBER_PAGES to YES; see bug730512
777 bool isEnabled = ol.isEnabled(OutputType::Html);
779
781
782 // restore the initial state if needed
783 if (!isEnabled) ol.disable(OutputType::Html);
784}
785
790
795
797{
798 if (Config_getBool(SEPARATE_MEMBER_PAGES))
799 {
802 }
803}
804
806{
807 if (Config_getBool(SEPARATE_MEMBER_PAGES))
808 {
811 }
812}
813
815{
816 /* write user defined member groups */
817 for (const auto &mg : m_memberGroups)
818 {
819 if (!mg->allMembersInSameSection() || !m_subGrouping)
820 {
821 mg->writeDeclarations(ol,nullptr,nullptr,this,nullptr,nullptr);
822 }
823 }
824}
825
827{
828 // write Author section (Man only)
831 ol.startGroupHeader();
832 ol.parseText(theTranslator->trAuthor(true,true));
833 ol.endGroupHeader();
836}
837
839{
842 bool first=true;
843 SrcLangExt lang=getLanguage();
844 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::File))
845 {
846 const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get());
847 if (lde->kind()==LayoutDocEntry::FileClasses && m_classes.declVisible() && ls)
848 {
849 DString label = "nested-classes";
850 ol.writeSummaryLink(DString(),label,ls->title(lang),first);
851 first=false;
852 }
853 else if (lde->kind()==LayoutDocEntry::FileInterfaces && m_interfaces.declVisible() && ls)
854 {
855 DString label = "interfaces";
856 ol.writeSummaryLink(DString(),label,ls->title(lang),first);
857 first=false;
858 }
859 else if (lde->kind()==LayoutDocEntry::FileStructs && m_structs.declVisible() && ls)
860 {
861 DString label = "structs";
862 ol.writeSummaryLink(DString(),label,ls->title(lang),first);
863 first=false;
864 }
865 else if (lde->kind()==LayoutDocEntry::FileRecords && m_records.declVisible() && ls)
866 {
867 DString label = "records";
868 ol.writeSummaryLink(DString(),label,ls->title(lang),first);
869 first=false;
870 }
871 else if (lde->kind()==LayoutDocEntry::FileExceptions && m_exceptions.declVisible() && ls)
872 {
873 DString label = "exceptions";
874 ol.writeSummaryLink(DString(),label,ls->title(lang),first);
875 first=false;
876 }
877 else if (lde->kind()==LayoutDocEntry::FileNamespaces && m_namespaces.declVisible(false) && ls)
878 {
879 DString label = "namespaces";
880 ol.writeSummaryLink(DString(),label,ls->title(lang),first);
881 first=false;
882 }
883 else if (lde->kind()==LayoutDocEntry::FileConcepts && m_concepts.declVisible() && ls)
884 {
885 DString label = "concepts";
886 ol.writeSummaryLink(DString(),label,ls->title(lang),first);
887 first=false;
888 }
889 else if (lde->kind()==LayoutDocEntry::MemberDecl)
890 {
891 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
892 if (lmd)
893 {
894 MemberList * ml = getMemberList(lmd->type);
895 if (ml && ml->declVisible())
896 {
897 ol.writeSummaryLink(DString(),ml->listType().toLabel(),lmd->title(lang),first);
898 first=false;
899 }
900 }
901 }
902 }
903 if (!first)
904 {
905 ol.writeString(" </div>\n");
906 }
908}
909
914
915/*! Write the documentation page for this file to the file of output
916 generators \a ol.
917*/
919{
920 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
921 //funcList->countDecMembers();
922
923 //DString fn = name();
924 //if (Config_getBool(FULL_PATH_NAMES))
925 //{
926 // fn.prepend(stripFromPath(getPath()));
927 //}
928
929 //printf("WriteDocumentation diskname=%s\n",qPrint(diskname));
930
931 DString versionTitle;
932 if (!m_fileVersion.empty())
933 {
934 versionTitle=" ("+m_fileVersion+")";
935 }
936 DString title = m_docname+versionTitle;
937 DString pageTitle;
938 if (Config_getBool(HIDE_COMPOUND_REFERENCE))
939 {
940 pageTitle=m_docname;
941 }
942 else
943 {
945 }
946
947 if (getDirDef())
948 {
949 startFile(ol,getOutputFileBase(),false,name(),pageTitle,HighlightedItem::FileVisible,!generateTreeView);
950 if (!generateTreeView)
951 {
953 ol.endQuickIndices();
954 }
955 startTitle(ol,getOutputFileBase(),this);
958 if (Config_getBool(HIDE_COMPOUND_REFERENCE))
959 {
960 ol.parseText(displayName()); // Html only
961 }
962 else
963 {
965 }
966 ol.enableAll();
968 if (Config_getBool(HIDE_COMPOUND_REFERENCE))
969 {
970 ol.parseText(Config_getBool(FULL_PATH_NAMES) ? // other output formats
971 pageTitle :
972 name());
973 }
974 else
975 {
976 ol.parseText(Config_getBool(FULL_PATH_NAMES) ? // other output formats
977 pageTitle :
979 }
981 addGroupListToTitle(ol,this);
983 }
984 else
985 {
986 startFile(ol,getOutputFileBase(),false,name(),pageTitle,HighlightedItem::FileVisible,!generateTreeView);
987 if (!generateTreeView)
988 {
989 ol.endQuickIndices();
990 }
991 startTitle(ol,getOutputFileBase(),this);
992 ol.parseText(pageTitle);
993 addGroupListToTitle(ol,this);
995 }
996
997 ol.startContents();
998
999 if (!m_fileVersion.empty())
1000 {
1002 ol.startProjectNumber();
1003 ol.docify(versionTitle);
1004 ol.endProjectNumber();
1005 ol.enableAll();
1006 }
1007
1008 //---------------------------------------- start flexible part -------------------------------
1009
1010 SrcLangExt lang = getLanguage();
1011 for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::File))
1012 {
1013 const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get());
1014 switch (lde->kind())
1015 {
1016 case LayoutDocEntry::BriefDesc:
1018 break;
1019 case LayoutDocEntry::MemberDeclStart:
1021 break;
1022 case LayoutDocEntry::Includes:
1024 break;
1025 case LayoutDocEntry::FileIncludeGraph:
1027 break;
1028 case LayoutDocEntry::FileIncludedByGraph:
1030 break;
1031 case LayoutDocEntry::FileSourceLink:
1032 writeSourceLink(ol);
1033 break;
1034 case LayoutDocEntry::FileClasses:
1035 if (ls) writeClassDeclarations(ol,ls->title(lang),m_classes);
1036 break;
1037 case LayoutDocEntry::FileInterfaces:
1038 if (ls) writeClassDeclarations(ol,ls->title(lang),m_interfaces);
1039 break;
1040 case LayoutDocEntry::FileStructs:
1041 if (ls) writeClassDeclarations(ol,ls->title(lang),m_structs);
1042 break;
1043 case LayoutDocEntry::FileRecords:
1044 if (ls) writeClassDeclarations(ol,ls->title(lang),m_records);
1045 break;
1046 case LayoutDocEntry::FileExceptions:
1047 if (ls) writeClassDeclarations(ol,ls->title(lang),m_exceptions);
1048 break;
1049 case LayoutDocEntry::FileConcepts:
1050 if (ls) writeConcepts(ol,ls->title(lang));
1051 break;
1052 case LayoutDocEntry::FileNamespaces:
1053 if (ls) writeNamespaceDeclarations(ol,ls->title(lang),false);
1054 break;
1055 case LayoutDocEntry::FileConstantGroups:
1056 if (ls) writeNamespaceDeclarations(ol,ls->title(lang),true);
1057 break;
1058 case LayoutDocEntry::MemberGroups:
1060 break;
1061 case LayoutDocEntry::MemberDecl:
1062 {
1063 const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get());
1064 if (lmd) writeMemberDeclarations(ol,lmd->type,lmd->title(lang));
1065 }
1066 break;
1067 case LayoutDocEntry::MemberDeclEnd:
1069 break;
1070 case LayoutDocEntry::DetailedDesc:
1071 if (ls) writeDetailedDescription(ol,ls->title(lang));
1072 break;
1073 case LayoutDocEntry::MemberDefStart:
1075 break;
1076 case LayoutDocEntry::FileInlineClasses:
1078 break;
1079 case LayoutDocEntry::MemberDef:
1080 {
1081 const LayoutDocEntryMemberDef *lmd = dynamic_cast<const LayoutDocEntryMemberDef*>(lde.get());
1082 if (lmd) writeMemberDocumentation(ol,lmd->type,lmd->title(lang));
1083 }
1084 break;
1085 case LayoutDocEntry::MemberDefEnd:
1087 break;
1088 case LayoutDocEntry::AuthorSection:
1090 break;
1091 case LayoutDocEntry::ClassInheritanceGraph:
1092 case LayoutDocEntry::ClassNestedClasses:
1093 case LayoutDocEntry::ClassCollaborationGraph:
1094 case LayoutDocEntry::ClassAllMembersLink:
1095 case LayoutDocEntry::ClassUsedFiles:
1096 case LayoutDocEntry::ClassInlineClasses:
1097 case LayoutDocEntry::NamespaceNestedNamespaces:
1098 case LayoutDocEntry::NamespaceNestedConstantGroups:
1099 case LayoutDocEntry::NamespaceClasses:
1100 case LayoutDocEntry::NamespaceConcepts:
1101 case LayoutDocEntry::NamespaceInterfaces:
1102 case LayoutDocEntry::NamespaceStructs:
1103 case LayoutDocEntry::NamespaceRecords:
1104 case LayoutDocEntry::NamespaceExceptions:
1105 case LayoutDocEntry::NamespaceInlineClasses:
1106 case LayoutDocEntry::ConceptDefinition:
1107 case LayoutDocEntry::GroupClasses:
1108 case LayoutDocEntry::GroupConcepts:
1109 case LayoutDocEntry::GroupModules:
1110 case LayoutDocEntry::GroupInlineClasses:
1111 case LayoutDocEntry::GroupNamespaces:
1112 case LayoutDocEntry::GroupDirs:
1113 case LayoutDocEntry::GroupNestedGroups:
1114 case LayoutDocEntry::GroupFiles:
1115 case LayoutDocEntry::GroupGraph:
1116 case LayoutDocEntry::GroupPageDocs:
1117 case LayoutDocEntry::ModuleExports:
1118 case LayoutDocEntry::ModuleClasses:
1119 case LayoutDocEntry::ModuleConcepts:
1120 case LayoutDocEntry::ModuleUsedFiles:
1121 case LayoutDocEntry::DirSubDirs:
1122 case LayoutDocEntry::DirFiles:
1123 case LayoutDocEntry::DirGraph:
1124 err("Internal inconsistency: member '{}' should not be part of "
1125 "LayoutDocManager::File entry list\n",lde->entryToString());
1126 break;
1127 }
1128 }
1129
1130 //---------------------------------------- end flexible part -------------------------------
1131
1132 ol.endContents();
1133
1134 endFileWithNavPath(ol,this);
1135
1136 if (Config_getBool(SEPARATE_MEMBER_PAGES))
1137 {
1138 MemberList *ml = getMemberList(MemberListType::AllMembersList());
1139 if (ml) ml->sort();
1140 writeMemberPages(ol);
1141 }
1142}
1143
1145{
1146 ol.pushGeneratorState();
1148
1149 for (const auto &ml : m_memberLists)
1150 {
1151 if (ml->listType().isDocumentation())
1152 {
1153 ml->writeDocumentationPage(ol,name(),this);
1154 }
1155 }
1156
1157 ol.popGeneratorState();
1158}
1159
1161{
1162 bool createSubDirs=Config_getBool(CREATE_SUBDIRS);
1163
1164 ol.writeString(" <div class=\"navtab\">\n");
1165 ol.writeString(" <table>\n");
1166
1167 MemberList *allMemberList = getMemberList(MemberListType::AllMembersList());
1168 if (allMemberList)
1169 {
1170 for (const auto &md : *allMemberList)
1171 {
1172 if (md->getFileDef()==this && md->getNamespaceDef()==nullptr && md->isLinkable() && !md->isEnumValue())
1173 {
1174 if (md->isLinkableInProject())
1175 {
1176 DString fn=md->getOutputFileBase();
1178 if (md==currentMd) // selected item => highlight
1179 {
1180 ol.writeString(" <tr><td class=\"navtabHL\">");
1181 }
1182 else
1183 {
1184 ol.writeString(" <tr><td class=\"navtab\">");
1185 }
1186 ol.writeString("<span class=\"label\"><a ");
1187 ol.writeString("href=\"");
1188 if (createSubDirs) ol.writeString("../../");
1189 ol.writeString(fn+"#"+md->anchor());
1190 ol.writeString("\">");
1191 ol.writeString(convertToHtml(md->localName()));
1192 ol.writeString("</a></span>");
1193 ol.writeString("</td></tr>\n");
1194 }
1195 }
1196 }
1197 }
1198
1199 ol.writeString(" </table>\n");
1200 ol.writeString(" </div>\n");
1201}
1202
1203/*! Write a source listing of this file to the output */
1205{
1206 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
1208 if (!m_fileVersion.empty())
1209 {
1210 title+=" ("+m_fileVersion+")";
1211 }
1214
1215 bool isDocFile = isDocumentationFile();
1216 bool genSourceFile = !isDocFile && generateSourceFile();
1217 if (getDirDef())
1218 {
1220 !generateTreeView,
1221 !isDocFile && genSourceFile ? DString() : getOutputFileBase(),
1222 0);
1223 if (!generateTreeView)
1224 {
1226 ol.endQuickIndices();
1227 }
1229 ol.parseText(name());
1231 }
1232 else
1233 {
1235 !isDocFile && genSourceFile ? DString() : getOutputFileBase(),
1236 0);
1238 ol.parseText(title);
1240 }
1241
1242 ol.startContents();
1243
1244 if (isLinkable())
1245 {
1248 ol.endTextLink();
1249
1250 ol.pushGeneratorState();
1252 ol.writeString("\\par\n");
1253 ol.popGeneratorState();
1254 }
1255}
1256
1257void FileDefImpl::writeSourceBody(OutputList &ol,[[maybe_unused]] ClangTUParser *clangParser)
1258{
1259 bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES);
1260 OutputCodeList devNullList;
1261 devNullList.add<DevNullCodeGenerator>();
1262#if USE_LIBCLANG
1263 if (Doxygen::clangAssistedParsing && clangParser &&
1264 (getLanguage()==SrcLangExt::Cpp || getLanguage()==SrcLangExt::ObjC))
1265 {
1266 auto &codeOL = ol.codeGenerators();
1267 codeOL.startCodeFragment("DoxyCode");
1268 clangParser->switchToFile(this);
1269 clangParser->writeSources(codeOL,this);
1270 codeOL.endCodeFragment("DoxyCode");
1271 }
1272 else
1273#endif
1274 {
1276 intf->resetCodeParserState();
1277 auto &codeOL = ol.codeGenerators();
1278 codeOL.startCodeFragment("DoxyCode");
1279 bool needs2PassParsing =
1280 Doxygen::parseSourcesNeeded && // we need to parse (filtered) sources for cross-references
1281 !filterSourceFiles && // but user wants to show sources as-is
1282 !getFileFilter(absFilePath(),true).empty(); // and there is a filter used while parsing
1283
1284 if (needs2PassParsing)
1285 {
1286 // parse code for cross-references only (see bug707641)
1287 intf->parseCode(devNullList,DString(),
1288 fileToString(absFilePath(),true,true),
1289 getLanguage(),
1290 Config_getBool(STRIP_CODE_COMMENTS),
1292 .setFileDef(this)
1293 );
1294 }
1295 size_t indent = 0;
1296 intf->parseCode(codeOL,DString(),
1297 detab(fileToString(absFilePath(),filterSourceFiles,true),indent),
1298 getLanguage(), // lang
1299 Config_getBool(STRIP_CODE_COMMENTS),
1301 .setFileDef(this)
1302 .setCollectXRefs(!needs2PassParsing)
1303 );
1304 codeOL.endCodeFragment("DoxyCode");
1305 }
1306}
1307
1309{
1310 ol.endContents();
1311 endFileWithNavPath(ol,this,false);
1312 ol.enableAll();
1313}
1314
1315void FileDefImpl::parseSource([[maybe_unused]] ClangTUParser *clangParser)
1316{
1317 bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES);
1318 OutputCodeList devNullList;
1319 devNullList.add<DevNullCodeGenerator>();
1320#if USE_LIBCLANG
1321 if (Doxygen::clangAssistedParsing && clangParser &&
1322 (getLanguage()==SrcLangExt::Cpp || getLanguage()==SrcLangExt::ObjC))
1323 {
1324 clangParser->switchToFile(this);
1325 clangParser->writeSources(devNullList,this);
1326 }
1327 else
1328#endif
1329 {
1331 intf->resetCodeParserState();
1332 size_t indent = 0;
1333 intf->parseCode(
1334 devNullList,DString(),
1335 detab(fileToString(absFilePath(),filterSourceFiles,true),indent),
1336 getLanguage(),
1337 Config_getBool(STRIP_CODE_COMMENTS),
1339 .setFileDef(this)
1340 );
1341 }
1342}
1343
1345{
1346 for (auto &ml : m_memberLists)
1347 {
1348 if (ml->listType().isDeclaration())
1349 {
1351 }
1352 }
1353
1354 // add members inside sections to their groups
1355 for (const auto &mg : m_memberGroups)
1356 {
1357 if (mg->allMembersInSameSection() && m_subGrouping)
1358 {
1359 //printf("----> addToDeclarationSection(%s)\n",qPrint(mg->header()));
1360 mg->addToDeclarationSection();
1361 }
1362 }
1363}
1364
1365/*! Adds member definition \a md to the list of all members of this file */
1367{
1368 if (md->isHidden()) return;
1369 MemberList *allMemberList = getMemberList(MemberListType::AllMembersList());
1370 //printf("%s:FileDefImpl::insertMember(%s (=%p) list has %zu elements)\n",
1371 // qPrint(name()),qPrint(md->name()),(void*)md,allMemberList ? allMemberList->size() : 0);
1372 if (allMemberList && allMemberList->contains(md))
1373 {
1374 //printf("already added\n");
1375 return;
1376 }
1377
1378 if (allMemberList==nullptr)
1379 {
1380 m_memberLists.emplace_back(std::make_unique<MemberList>(MemberListType::AllMembersList(),MemberListContainer::File));
1381 allMemberList = m_memberLists.back().get();
1382 }
1383 allMemberList->push_back(md);
1384 switch (md->memberType())
1385 {
1386 case MemberType::Property:
1387 if (md->getLanguage() == SrcLangExt::Python)
1388 {
1389 addMemberToList(MemberListType::PropertyMembers(),md);
1390 addMemberToList(MemberListType::Properties(),md);
1391 break;
1392 }
1393 // fallthrough, explicitly no break here
1394 case MemberType::Variable:
1395 if (md->anonymousMemberForDeclaration()==nullptr) // not a split member that has a separate declaration member
1396 {
1397 addMemberToList(MemberListType::DecVarMembers(),md);
1398 }
1399 if (!md->isAnonymous() && md->anonymousMemberForDetails()==nullptr) // not a split member that has a separate details member
1400 {
1401 addMemberToList(MemberListType::DocVarMembers(),md);
1402 }
1403 break;
1404 case MemberType::Function:
1405 addMemberToList(MemberListType::DecFuncMembers(),md);
1406 addMemberToList(MemberListType::DocFuncMembers(),md);
1407 break;
1408 case MemberType::Typedef:
1409 addMemberToList(MemberListType::DecTypedefMembers(),md);
1410 addMemberToList(MemberListType::DocTypedefMembers(),md);
1411 break;
1412 case MemberType::Sequence:
1413 addMemberToList(MemberListType::DecSequenceMembers(),md);
1414 addMemberToList(MemberListType::DocSequenceMembers(),md);
1415 break;
1416 case MemberType::Dictionary:
1417 addMemberToList(MemberListType::DecDictionaryMembers(),md);
1418 addMemberToList(MemberListType::DocDictionaryMembers(),md);
1419 break;
1420 case MemberType::Enumeration:
1421 addMemberToList(MemberListType::DecEnumMembers(),md);
1422 addMemberToList(MemberListType::DocEnumMembers(),md);
1423 break;
1424 case MemberType::EnumValue: // enum values are shown inside their enums
1425 break;
1426 case MemberType::Define:
1427 addMemberToList(MemberListType::DecDefineMembers(),md);
1428 addMemberToList(MemberListType::DocDefineMembers(),md);
1429 break;
1430 default:
1431 err("FileDefImpl::insertMembers(): "
1432 "member '{}' with class scope '{}' inserted in file scope '{}'!\n",
1433 md->name(),
1434 md->getClassDef() ? md->getClassDef()->name() : "<global>",
1435 name());
1436 }
1437 //addMemberToGroup(md,groupId);
1438}
1439
1441{
1442 MemberList *ml = getMemberList(lt);
1443 if (ml) ml->remove(md);
1444}
1445
1447{
1448 removeMemberFromList(MemberListType::AllMembersList(),md);
1449 switch(md->memberType())
1450 {
1451 case MemberType::Property:
1452 if (md->getLanguage() == SrcLangExt::Python)
1453 {
1454 removeMemberFromList(MemberListType::PropertyMembers(),md);
1455 removeMemberFromList(MemberListType::Properties(),md);
1456 break;
1457 }
1458 // fallthrough, explicitly no break here
1459 case MemberType::Variable:
1460 removeMemberFromList(MemberListType::DecVarMembers(),md);
1461 removeMemberFromList(MemberListType::DocVarMembers(),md);
1462 break;
1463 case MemberType::Function:
1464 removeMemberFromList(MemberListType::DecFuncMembers(),md);
1465 removeMemberFromList(MemberListType::DocFuncMembers(),md);
1466 break;
1467 case MemberType::Typedef:
1468 removeMemberFromList(MemberListType::DecTypedefMembers(),md);
1469 removeMemberFromList(MemberListType::DocTypedefMembers(),md);
1470 break;
1471 case MemberType::Sequence:
1472 removeMemberFromList(MemberListType::DecSequenceMembers(),md);
1473 removeMemberFromList(MemberListType::DocSequenceMembers(),md);
1474 break;
1475 case MemberType::Dictionary:
1476 removeMemberFromList(MemberListType::DecDictionaryMembers(),md);
1477 removeMemberFromList(MemberListType::DocDictionaryMembers(),md);
1478 break;
1479 case MemberType::Enumeration:
1480 removeMemberFromList(MemberListType::DecEnumMembers(),md);
1481 removeMemberFromList(MemberListType::DocEnumMembers(),md);
1482 break;
1483 case MemberType::EnumValue: // enum values are shown inside their enums
1484 break;
1485 case MemberType::Define:
1486 removeMemberFromList(MemberListType::DecDefineMembers(),md);
1487 removeMemberFromList(MemberListType::DocDefineMembers(),md);
1488 break;
1489 default:
1490 err("FileDefImpl::removeMember(): unexpected member remove in file!\n");
1491 }
1492}
1493
1494/*! Adds compound definition \a cd to the list of all compounds of this file */
1496{
1497 if (cd->isHidden()) return;
1498
1500
1501 if (Config_getBool(OPTIMIZE_OUTPUT_SLICE))
1502 {
1504 {
1505 list = &m_interfaces;
1506 }
1507 else if (cd->compoundType()==ClassDef::Struct)
1508 {
1509 list = &m_structs;
1510 }
1511 else if (cd->compoundType()==ClassDef::Record)
1512 {
1513 list = &m_records;
1514 }
1515 else if (cd->compoundType()==ClassDef::Exception)
1516 {
1517 list = &m_exceptions;
1518 }
1519 }
1520
1521 list->add(cd->name(),cd);
1522}
1523
1525{
1526 if (cd->isHidden()) return;
1527 m_concepts.add(cd->name(),cd);
1528}
1529
1530/*! Adds namespace definition \a nd to the list of all compounds of this file */
1532{
1533 if (nd->isHidden()) return;
1534 m_namespaces.add(nd->name(),nd);
1535}
1536
1538{
1539 if (Config_getBool(FULL_PATH_NAMES))
1540 return m_fileName;
1541 else
1542 return DefinitionMixin::name();
1543}
1544
1545void FileDefImpl::addSourceRef(int line,const Definition *d,const MemberDef *md)
1546{
1547 //printf("FileDefImpl::addSourceRef(%d,%s,%s)\n",line,qPrint(d?d->name():"nullptr"),qPrint(md?md->name():"nullptr"));
1548 if (d)
1549 {
1550 m_srcDefMap.emplace(line,d);
1551 if (md) m_srcMemberMap.emplace(line,md);
1552 //printf("Adding member %s with anchor %s at line %d to file %s\n",
1553 // md?qPrint(md->name()):"<none>",md?qPrint(md->anchor()):"<none>",line,qPrint(name()));
1554 }
1555}
1556
1558{
1559 auto it = m_srcDefMap.find(lineNr);
1560 //printf("%s::getSourceDefinition(%d)=%s\n",qPrint(name()),lineNr,it!=m_srcDefMap.end()?qPrint(it->second->name()):"none");
1561 return it!=m_srcDefMap.end() ? it->second : nullptr;
1562}
1563
1565{
1566 auto it = m_srcMemberMap.find(lineNr);
1567 //printf("%s::getSourceMember(%d)=%s\n",qPrint(name()),lineNr,it!=m_srcMemberMap.end()?qPrint(it->second->name()):"none");
1568 return it!=m_srcMemberMap.end() ? it->second : nullptr;
1569}
1570
1571
1573{
1575 //printf("%p: FileDefImpl::addUsingDirective: %s:%d\n",this,qPrint(name()),usingDirList->count());
1576}
1577
1579{
1580 //printf("%p: FileDefImpl::getUsedNamespace: %s:%d\n",this,qPrint(name()),usingDirList?usingDirList->count():0);
1581 return m_usingDirList;
1582}
1583
1588
1590 const DString &includeName,bool local, bool force)
1591{
1592 //printf("FileDefImpl::setIncludeFile(%p,%s,%d,%d)\n",fd,includeName,local,force);
1593 if (!m_incInfo) m_incInfo = std::make_unique<IncludeInfo>();
1594 if ((!includeName.empty() && m_incInfo->includeName.empty()) ||
1595 (fd!=nullptr && m_incInfo->fileDef==nullptr)
1596 )
1597 {
1598 //printf("Setting file info\n");
1599 m_incInfo->fileDef = fd;
1600 m_incInfo->includeName = includeName;
1602 }
1603 if (force && !includeName.empty())
1604 {
1605 m_incInfo->includeName = includeName;
1607 }
1608}
1609
1611{
1612 //printf("FileDefImpl::addIncludeDependency(%p,%s,%d)\n",(void*)fd,qPrint(incName),kind);
1613 DString iName = fd ? fd->absFilePath() : incName;
1614 if (!iName.empty() && m_includeMap.find(iName.str())==m_includeMap.end())
1615 {
1616 m_includeList.emplace_back(fd,incName,kind);
1617 m_includeMap.emplace(iName.str(),&m_includeList.back());
1618 }
1619}
1620
1622{
1623 if (visitedFiles.find(this)!=visitedFiles.end()) return; // file already processed
1624 visitedFiles.insert(this);
1625 //printf("( FileDefImpl::addIncludedUsingDirectives for file %s\n",qPrint(name()));
1626
1627 if (!m_includeList.empty()) // file contains #includes
1628 {
1629 {
1630 for (const auto &ii : m_includeList) // foreach #include...
1631 {
1632 if (ii.fileDef) // ...that is a known file
1633 {
1634 // recurse into this file
1635 const_cast<FileDef*>(ii.fileDef)->addIncludedUsingDirectives(visitedFiles);
1636 }
1637 }
1638 }
1639 {
1640 // iterate through list from last to first
1641 for (auto ii_it = m_includeList.rbegin(); ii_it!=m_includeList.rend(); ++ii_it)
1642 {
1643 auto &ii = *ii_it;
1644 if (ii.fileDef && ii.fileDef!=this)
1645 {
1646 // add using directives
1647 auto unl = ii.fileDef->getUsedNamespaces();
1648 for (auto it = unl.rbegin(); it!=unl.rend(); ++it)
1649 {
1650 auto *nd = *it;
1651 //printf(" adding using directive for %s\n",qPrint(nd->qualifiedName()));
1652 m_usingDirList.prepend(nd->qualifiedName(),nd);
1653 }
1654 // add using declarations
1655 auto udl = ii.fileDef->getUsedDefinitions();
1656 for (auto it = udl.rbegin(); it!=udl.rend(); ++it)
1657 {
1658 auto *d = *it;
1659 m_usingDeclList.prepend(d->qualifiedName(),d);
1660 }
1661 }
1662 }
1663 }
1664 }
1665 //printf(") end FileDefImpl::addIncludedUsingDirectives for file %s\n",qPrint(name()));
1666}
1667
1668
1670{
1671 //printf("FileDefImpl::addIncludedByDependency(%p,%s,%d)\n",fd,incName,local);
1672 DString iName = fd ? fd->absFilePath() : incName;
1673 if (!iName.empty() && m_includedByMap.find(iName.str())==m_includedByMap.end())
1674 {
1675 m_includedByList.emplace_back(fd,incName,kind);
1676 m_includedByMap.emplace(iName.str(),&m_includedByList.back());
1677 }
1678}
1679
1681{
1682 if (name.empty()) return false;
1683 return m_includeMap.find(name.str())!=m_includeMap.end();
1684}
1685
1687{
1688 bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
1689 bool verbatimHeaders = Config_getBool(VERBATIM_HEADERS);
1690 return !isReference() &&
1691 (sourceBrowser ||
1692 (verbatimHeaders && (EntryType::guessSection(name()).isHeader() || !m_includedByMap.empty()))
1693 ) &&
1695}
1696
1697
1699{
1702 theTranslator->trFile(true,true),
1704 DString(),
1705 nullptr
1706 );
1707 for (const auto &mg : m_memberGroups)
1708 {
1709 mg->addListReferences(this);
1710 }
1711 for (auto &ml : m_memberLists)
1712 {
1713 if (ml->listType().isDocumentation())
1714 {
1715 ml->addListReferences(this);
1716 }
1717 }
1718}
1719
1721{
1723 for (const auto &mg : m_memberGroups)
1724 {
1725 mg->addRequirementReferences(this);
1726 }
1727 for (auto &ml : m_memberLists)
1728 {
1729 if (ml->listType().isDocumentation())
1730 {
1731 ml->addRequirementReferences(this);
1732 }
1733 }
1734}
1735
1736//-------------------------------------------------------------------
1737
1739{
1741 NamespaceDefSet visitedNamespaces;
1742 for (auto &nd : usingDirList)
1743 {
1745 if (ndm)
1746 {
1747 ndm->combineUsingRelations(visitedNamespaces);
1748 }
1749 }
1750
1751 for (auto &nd : usingDirList)
1752 {
1753 // add used namespaces of namespace nd to this namespace
1754 for (const auto &und : nd->getUsedNamespaces())
1755 {
1756 addUsingDirective(und);
1757 }
1758 // add used classes of namespace nd to this namespace
1759 for (const auto &ud : nd->getUsedDefinitions())
1760 {
1762 }
1763 }
1764}
1765
1767{
1768 static const std::unordered_set<std::string> docExtensions =
1769 { "doc", "txt", "dox", "md", "markdown" };
1770
1771 size_t lastDot = name().rfind('.');
1772 return (lastDot!=DString::npos &&
1773 docExtensions.find(name().mid(lastDot+1).str())!=docExtensions.end()) ||
1774 getLanguageFromFileName(getFileNameExtension(name())) == SrcLangExt::Markdown;
1775}
1776
1778{
1779 DString vercmd = Config_getString(FILE_VERSION_FILTER);
1780 if (!vercmd.empty() && !m_filePath.empty() && !isReference() &&
1781 m_filePath!="generated" && m_filePath!="graph_legend.dox")
1782 {
1783 msg("Version of {} : ",m_filePath);
1784 DString cmd = vercmd+" \""+m_filePath+"\"";
1785 Debug::print(Debug::ExtCmd,0,"Executing popen(`{}`)\n",cmd);
1786 FILE *f=Portable::popen(cmd,"r");
1787 if (!f)
1788 {
1789 err("could not execute {}\n",vercmd);
1790 return;
1791 }
1792 const int bufSize=1024;
1793 char buf[bufSize];
1794 int numRead = static_cast<int>(fread(buf,1,bufSize-1,f));
1796 if (numRead>0 && numRead<bufSize)
1797 {
1798 buf[numRead]='\0';
1799 m_fileVersion=DString(buf,numRead).stripWhiteSpace();
1800 if (!m_fileVersion.empty())
1801 {
1802 msg("{}\n",m_fileVersion);
1803 return;
1804 }
1805 }
1806 msg("no version available\n");
1807 }
1808}
1809
1810
1812{
1813 if (Htags::useHtags)
1814 {
1816 }
1817 else
1818 {
1819 return m_outputDiskName+"_source";
1820 }
1821}
1822
1827
1828/*! Returns the name of the verbatim copy of this file (if any). */
1830{
1831 return getSourceFileBase();
1832}
1833
1835{
1836 bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS);
1837 bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS);
1838 const auto &ml = m_memberLists.get(lt,MemberListContainer::File);
1839 ml->setNeedsSorting(
1840 (ml->listType().isDeclaration() && sortBriefDocs) ||
1841 (ml->listType().isDocumentation() && sortMemberDocs));
1842 ml->push_back(md);
1843 if (ml->listType().isDeclaration())
1844 {
1846 if (mdm)
1847 {
1848 mdm->setSectionList(this,ml.get());
1849 }
1850 }
1851}
1852
1854{
1855 for (auto &ml : m_memberLists)
1856 {
1857 if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(false); }
1858 }
1859
1860 for (const auto &mg : m_memberGroups)
1861 {
1862 MemberList &mlg = const_cast<MemberList&>(mg->members());
1863 if (mlg.needsSorting()) { mlg.sort(); mlg.setNeedsSorting(false); }
1864 }
1865
1866 std::stable_sort(m_includedByList.begin(),m_includedByList.end(),
1867 [](const auto &fi1,const auto &fi2) { return fi1.includeName < fi2.includeName; });
1868
1869 if (Config_getBool(SORT_BRIEF_DOCS))
1870 {
1871 auto classComp = [](const ClassLinkedRefMap::Ptr &c1,const ClassLinkedRefMap::Ptr &c2)
1872 {
1873 return Config_getBool(SORT_BY_SCOPE_NAME) ?
1874 dstricmp_sort(c1->displayName(), c2->displayName())<0 :
1875 dstricmp_sort(c1->className(), c2->className())<0;
1876 };
1877
1878 std::stable_sort(m_classes.begin(), m_classes.end(), classComp);
1879 std::stable_sort(m_interfaces.begin(),m_interfaces.end(),classComp);
1880 std::stable_sort(m_structs.begin(), m_structs.end(), classComp);
1881 std::stable_sort(m_records.begin(), m_records.end(), classComp);
1882 std::stable_sort(m_exceptions.begin(),m_exceptions.end(),classComp);
1883
1884 auto conceptComp = [](const ConceptLinkedRefMap::Ptr &c1,const ConceptLinkedRefMap::Ptr &c2)
1885 {
1886 return dstricmp_sort(c1->name(),c2->name())<0;
1887 };
1888
1889 std::stable_sort(m_concepts.begin(), m_concepts.end(), conceptComp);
1890
1891 auto namespaceComp = [](const NamespaceLinkedRefMap::Ptr &n1,const NamespaceLinkedRefMap::Ptr &n2)
1892 {
1893 return dstricmp_sort(n1->name(),n2->name())<0;
1894 };
1895
1896 std::stable_sort(m_namespaces.begin(),m_namespaces.end(),namespaceComp);
1897 }
1898}
1899
1901{
1902 for (auto &ml : m_memberLists)
1903 {
1904 if (ml->listType()==lt)
1905 {
1906 return ml.get();
1907 }
1908 }
1909 return nullptr;
1910}
1911
1913{
1914 bool optVhdl = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
1915 MemberList * ml = getMemberList(lt);
1916 if (ml)
1917 {
1918 if (optVhdl) // use specific declarations function
1919 {
1920
1921 VhdlDocGen::writeVhdlDeclarations(ml,ol,nullptr,nullptr,this,nullptr,nullptr);
1922 }
1923 else
1924 {
1925 ml->writeDeclarations(ol,nullptr,nullptr,this,nullptr,nullptr,title,DString());
1926 }
1927 }
1928}
1929
1931{
1932 MemberList * ml = getMemberList(lt);
1933 if (ml) ml->writeDocumentation(ol,name(),this,title,ml->listType().toLabel());
1934}
1935
1937{
1938 bool showFiles = Config_getBool(SHOW_FILES);
1939 return hasDocumentation() && !isReference() && (showFiles || isLinkableViaGroup());
1940}
1941
1943 StringUnorderedSet &filesVisited,const FileDef *fd,StringVector &incFiles)
1944{
1945 for (const auto &ii : fd->includeFileList())
1946 {
1947 if (ii.fileDef && !ii.fileDef->isReference() &&
1948 filesVisited.find(ii.fileDef->absFilePath().str())==filesVisited.end())
1949 {
1950 //printf("FileDefImpl::addIncludeDependency(%s)\n",qPrint(ii->fileDef->absFilePath()));
1951 incFiles.push_back(ii.fileDef->absFilePath().str());
1952 filesVisited.insert(ii.fileDef->absFilePath().str());
1953 getAllIncludeFilesRecursively(filesVisited,ii.fileDef,incFiles);
1954 }
1955 }
1956}
1957
1959{
1960 StringUnorderedSet includes;
1961 ::getAllIncludeFilesRecursively(includes,this,incFiles);
1962}
1963
1965{
1966 if (Config_getBool(HIDE_COMPOUND_REFERENCE))
1967 {
1968 return name();
1969 }
1970 else
1971 {
1973 }
1974}
1975
1977{
1978 return m_fileVersion;
1979}
1980
1985
1990
1992{
1993 for (auto &ml : m_memberLists)
1994 {
1995 ml->countDecMembers();
1996 ml->countDocMembers();
1997 }
1998 for (const auto &mg : m_memberGroups)
1999 {
2000 mg->countDecMembers();
2001 mg->countDocMembers();
2002 }
2003}
2004
2006{
2007 MemberList *ml = getMemberList(MemberListType::AllMembersList());
2008 return ml ? ml->numDocMembers() : 0;
2009}
2010
2012{
2013 MemberList *ml = getMemberList(MemberListType::AllMembersList());
2014 return ml ? ml->numDecMembers() : 0;
2015}
2016
2021
2026
2028{
2029 return m_hasIncludeGraph;
2030}
2031
2033{
2034 return m_hasIncludedByGraph;
2035}
2036
2037bool FileDefImpl::visibleInIndex(bool &genSourceFile) const
2038{
2039 bool allExternals = Config_getBool(ALLEXTERNALS);
2040 bool isDocFile = isDocumentationFile();
2041 genSourceFile = !isDocFile && generateSourceFile();
2042 return ((allExternals && isLinkable()) || isLinkableInProject()) && !isDocFile;
2043}
2044
2045// -----------------------
2046
2047bool compareFileDefs(const FileDef *fd1, const FileDef *fd2)
2048{
2049 return dstricmp_sort(fd1->name(),fd2->name()) < 0;
2050}
2051
2052// --- Cast functions
2053
2055{
2056 if (d==nullptr) return nullptr;
2057 if (d && typeid(*d)==typeid(FileDefImpl))
2058 {
2059 return static_cast<FileDef*>(d);
2060 }
2061 else
2062 {
2063 return nullptr;
2064 }
2065}
2066
2068{
2069 if (d==nullptr) return nullptr;
2070 if (d && typeid(*d)==typeid(FileDefImpl))
2071 {
2072 return static_cast<const FileDef*>(d);
2073 }
2074 else
2075 {
2076 return nullptr;
2077 }
2078}
2079
Clang parser object for a single translation unit, which consists of a source file and the directly o...
Definition clangparser.h:25
A abstract class representing of a compound symbol.
Definition classdef.h:100
virtual DString className() const =0
Returns the name of the class including outer classes, but not including namespaces.
@ Interface
Definition classdef.h:109
@ Exception
Definition classdef.h:112
virtual CompoundType compoundType() const =0
Returns the type of compound this is, i.e. class/struct/union/...
bool declVisible(const ClassDef::CompoundType *filter=nullptr) const
Definition classlist.cpp:27
void writeDocumentation(OutputList &ol, const Definition *container=nullptr) const
Definition classlist.cpp:72
void writeDeclaration(OutputList &ol, const ClassDef::CompoundType *filter, const DString &header, bool localNames) const
Definition classlist.cpp:51
bool declVisible() const
void writeDeclaration(OutputList &ol, const DString &header, bool localNames) const
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
size_t rfind(char c, size_t pos=npos) const
Definition dstring.h:244
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
DString right(size_t len) const
Definition dstring.h:311
DString & prepend(const char *s)
Definition dstring.h:515
size_t find(char c, size_t pos=0) const
Definition dstring.h:239
DString & sprintf(const char *format,...)
Definition dstring.cpp:34
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:337
DString left(size_t len) const
Definition dstring.h:306
const std::string & str() const
Definition dstring.h:645
DString & insert(size_t index, const DString &s)
Definition dstring.h:425
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151
@ ExtCmd
Definition debug.h:37
static void print(DebugMask mask, int prio, fmt::format_string< Args... > fmt, Args &&... args)
Definition debug.h:78
The common base class of all entity definitions found in the sources.
Definition definition.h:77
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual bool isLinkable() const =0
virtual const DString & name() const =0
virtual bool isAnonymous() const =0
virtual DString displayName(bool includeScope=true) const =0
virtual DString qualifiedName() const =0
virtual bool isHidden() const =0
virtual DString getReference() const =0
virtual bool isReference() const =0
virtual DString getOutputFileBase() const =0
bool isReference() const override
DString docFile() const override
bool isLinkableViaGroup() const override
bool hasBriefDescription() const override
DString briefFile() const override
bool hasRequirementRefs() const override
DString briefDescription(bool abbreviate=false) const override
const DString & name() const override
void setLanguage(SrcLangExt lang) override
void writeRequirementRefs(OutputList &ol) const override
const RefItemVector & xrefListItems() const override
const DString & localName() const override
void setReference(const DString &r) override
DString getDefFileExtension() const override
DString documentation() const override
DefinitionMixin(const DString &defFileName, int defLine, size_t defColumn, const DString &name, const char *b=nullptr, const char *d=nullptr, bool isSymbol=true)
const FileDef * getBodyDef() const override
DString inbodyDocumentation() const override
int getStartBodyLine() const override
int docLine() const override
int briefLine() const override
void writeDocAnchorsToTagFile(TextStream &fs) const override
bool hasDocumentation() const override
SrcLangExt getLanguage() const override
virtual void writeNavigationPath(OutputList &ol) const =0
Class implementing OutputCodeIntf by throwing away everything.
Definition devnullgen.h:23
A model of a directory symbol.
Definition dirdef.h:108
Representation of an include dependency graph.
bool isTooBig() const
bool isTrivial() const
static bool suppressDocWarnings
Definition doxygen.h:123
static bool parseSourcesNeeded
Definition doxygen.h:116
static bool clangAssistedParsing
Definition doxygen.h:129
static ParserManager * parserManager
Definition doxygen.h:122
static EntryType guessSection(const DString &name)
Definition types.cpp:22
A model of a file symbol.
Definition filedef.h:97
virtual DString includeName() const =0
virtual bool generateSourceFile() const =0
virtual DString absFilePath() const =0
virtual const IncludeInfoList & includeFileList() const =0
void addIncludedByDependency(const FileDef *fd, const DString &incName, IncludeKind kind) override
Definition filedef.cpp:1669
bool isDocumentationFile() const override
Definition filedef.cpp:1766
void findSectionsInDocumentation() override
Definition filedef.cpp:347
DString m_inclByDepFileName
Definition filedef.cpp:246
void setModuleDef(ModuleDef *mod) override
Definition filedef.cpp:187
void addIncludedUsingDirectives(FileDefSet &visitedFiles) override
Definition filedef.cpp:1621
void writeBriefDescription(OutputList &ol)
Definition filedef.cpp:551
const LinkedRefMap< const Definition > & getUsedDefinitions() const override
Definition filedef.cpp:151
void addSourceRef(int line, const Definition *d, const MemberDef *md) override
Definition filedef.cpp:1545
LinkedRefMap< const Definition > m_usingDeclList
Definition filedef.cpp:241
DirDef * m_dir
Definition filedef.cpp:254
DString includedByDependencyGraphFileName() const override
Definition filedef.cpp:1986
void insertNamespace(NamespaceDef *nd) override
Definition filedef.cpp:1531
ModuleDef * getModuleDef() const override
Definition filedef.cpp:149
void writeQuickMemberLinks(OutputList &ol, const MemberDef *currentMd) const override
Definition filedef.cpp:1160
bool visibleInIndex(bool &genSourceFile) const override
Returns true if this file is visible in the index.
Definition filedef.cpp:2037
void setDiskName(const DString &name) override
Definition filedef.cpp:326
void writeSourceLink(OutputList &ol)
Definition filedef.cpp:739
void writeSummaryLinks(OutputList &ol) const override
Definition filedef.cpp:838
void writeMemberDocumentation(OutputList &ol, MemberListType lt, const DString &title)
Definition filedef.cpp:1930
ClassLinkedRefMap m_interfaces
Definition filedef.cpp:260
const ConceptLinkedRefMap & getConcepts() const override
Definition filedef.cpp:159
void setDiskNameLocal(const DString &name)
Definition filedef.cpp:310
std::unique_ptr< IncludeInfo > m_incInfo
Definition filedef.cpp:242
DString getSourceFileBase() const override
Definition filedef.cpp:1811
ClassLinkedRefMap m_structs
Definition filedef.cpp:261
void sortMemberLists() override
Definition filedef.cpp:1853
void parseSource(ClangTUParser *clangParser) override
Definition filedef.cpp:1315
void addMemberToList(MemberListType lt, MemberDef *md)
Definition filedef.cpp:1834
void acquireFileVersion()
Definition filedef.cpp:1777
DString displayName(bool=true) const override
Definition filedef.cpp:129
void addUsingDirective(NamespaceDef *nd) override
Definition filedef.cpp:1572
const DString & name() const override
Definition filedef.cpp:1537
void countMembers() override
Definition filedef.cpp:1991
void distributeMemberGroupDocumentation() override
Definition filedef.cpp:338
MemberDefLineMap m_srcMemberMap
Definition filedef.cpp:251
ConceptLinkedRefMap m_concepts
Definition filedef.cpp:264
void insertClass(ClassDef *cd) override
Definition filedef.cpp:1495
DefinitionLineMap m_srcDefMap
Definition filedef.cpp:250
NamespaceLinkedRefMap m_namespaces
Definition filedef.cpp:258
ModuleDef * m_moduleDef
Definition filedef.cpp:255
IncludeInfoList m_includedByList
Definition filedef.cpp:239
CodeSymbolType codeSymbolType() const override
Definition filedef.cpp:126
bool m_hasIncludeGraph
Definition filedef.cpp:266
const NamespaceLinkedRefMap & getNamespaces() const override
Definition filedef.cpp:158
void removeMember(MemberDef *md) override
Definition filedef.cpp:1446
void addUsingDeclaration(const Definition *d) override
Definition filedef.cpp:1584
ClassLinkedRefMap m_exceptions
Definition filedef.cpp:263
void writeTagFile(TextStream &t) override
Definition filedef.cpp:377
void endMemberDeclarations(OutputList &ol)
Definition filedef.cpp:791
void addListReferences() override
Definition filedef.cpp:1698
const MemberGroupList & getMemberGroups() const override
Definition filedef.cpp:157
IncludeInfoMap m_includedByMap
Definition filedef.cpp:238
void insertMember(MemberDef *md) override
Definition filedef.cpp:1366
const LinkedRefMap< NamespaceDef > & getUsedNamespaces() const override
Definition filedef.cpp:1578
void writeConcepts(OutputList &ol, const DString &title)
Definition filedef.cpp:767
void writeInlineClasses(OutputList &ol)
Definition filedef.cpp:773
void writeIncludeFiles(OutputList &ol)
Definition filedef.cpp:607
MemberGroupList m_memberGroups
Definition filedef.cpp:257
void writeNamespaceDeclarations(OutputList &ol, const DString &title, bool isConstantGroup)
Definition filedef.cpp:754
void computeAnchors() override
Definition filedef.cpp:332
void addIncludeDependency(const FileDef *fd, const DString &incName, IncludeKind kind) override
Definition filedef.cpp:1610
void writeMemberPages(OutputList &ol) override
Definition filedef.cpp:1144
void writeSourceFooter(OutputList &ol) override
Definition filedef.cpp:1308
bool generateSourceFile() const override
Definition filedef.cpp:1686
void writeIncludedByGraph(OutputList &ol)
Definition filedef.cpp:713
bool m_isSource
Definition filedef.cpp:252
void writeClassDeclarations(OutputList &ol, const DString &title, const ClassLinkedRefMap &list)
Definition filedef.cpp:761
const MemberDef * getSourceMember(int lineNr) const override
Definition filedef.cpp:1564
~FileDefImpl() override
Definition filedef.cpp:306
DString getOutputFileBase() const override
Definition filedef.cpp:1823
const IncludeInfoList & includeFileList() const override
Definition filedef.cpp:152
DString getVersion() const override
Definition filedef.cpp:144
DString m_fileVersion
Definition filedef.cpp:253
void removeMemberFromList(MemberListType lt, MemberDef *md)
Definition filedef.cpp:1440
void getAllIncludeFilesRecursively(StringVector &incFiles) const override
Definition filedef.cpp:1958
DString m_path
Definition filedef.cpp:243
MemberLists m_memberLists
Definition filedef.cpp:256
DString fileName() const override
Definition filedef.cpp:130
LinkedRefMap< NamespaceDef > m_usingDirList
Definition filedef.cpp:240
void writeAuthorSection(OutputList &ol)
Definition filedef.cpp:826
DString absFilePath() const override
Definition filedef.cpp:137
DString getPath() const override
Definition filedef.cpp:143
void insertConcept(ConceptDef *cd) override
Definition filedef.cpp:1524
const MemberLists & getMemberLists() const override
Definition filedef.cpp:156
DString m_inclDepFileName
Definition filedef.cpp:245
DString m_outputDiskName
Definition filedef.cpp:247
void writeDetailedDescription(OutputList &ol, const DString &title)
Definition filedef.cpp:480
DString includeDependencyGraphFileName() const override
Definition filedef.cpp:1981
IncludeInfoMap m_includeMap
Definition filedef.cpp:236
bool m_subGrouping
Definition filedef.cpp:265
DString m_fileName
Definition filedef.cpp:248
const DString & docName() const override
Definition filedef.cpp:138
DirDef * getDirDef() const override
Definition filedef.cpp:148
void overrideIncludeGraph(bool e) override
Definition filedef.cpp:2017
ClassLinkedRefMap m_classes
Definition filedef.cpp:259
void overrideIncludedByGraph(bool e) override
Definition filedef.cpp:2022
const IncludeInfoList & includedByFileList() const override
Definition filedef.cpp:153
bool hasIncludedByGraph() const override
Definition filedef.cpp:2032
void writePageNavigation(OutputList &ol) const override
Definition filedef.cpp:910
bool subGrouping() const override
Definition filedef.cpp:164
void setIncludeFile(FileDef *fd, const DString &includeName, bool local, bool force) override
Definition filedef.cpp:1589
void writeSourceHeader(OutputList &ol) override
Definition filedef.cpp:1204
void writeSourceBody(OutputList &ol, ClangTUParser *clangParser) override
Definition filedef.cpp:1257
void writeIncludeGraph(OutputList &ol)
Definition filedef.cpp:688
void addMembersToMemberGroup() override
Definition filedef.cpp:1344
int numDocMembers() const override
Definition filedef.cpp:2005
bool m_hasIncludedByGraph
Definition filedef.cpp:267
IncludeInfoList m_includeList
Definition filedef.cpp:237
void startMemberDocumentation(OutputList &ol)
Definition filedef.cpp:796
int numDecMembers() const override
Definition filedef.cpp:2011
DString fileVersion() const override
Definition filedef.cpp:1976
void writeClassesToTagFile(TextStream &t, const ClassLinkedRefMap &list)
Definition filedef.cpp:595
MemberList * getMemberList(MemberListType lt) const override
Definition filedef.cpp:1900
void startMemberDeclarations(OutputList &ol)
Definition filedef.cpp:786
bool isSource() const override
Definition filedef.cpp:139
void combineUsingRelations() override
Definition filedef.cpp:1738
bool isLinkableInProject() const override
Definition filedef.cpp:1936
void endMemberDocumentation(OutputList &ol)
Definition filedef.cpp:805
const ClassLinkedRefMap & getClasses() const override
Definition filedef.cpp:160
void writeMemberDeclarations(OutputList &ol, MemberListType lt, const DString &title)
Definition filedef.cpp:1912
bool hasIncludeGraph() const override
Definition filedef.cpp:2027
void writeDocumentation(OutputList &ol) override
Definition filedef.cpp:918
bool isIncluded(const DString &name) const override
Definition filedef.cpp:1680
DString m_docname
Definition filedef.cpp:249
DString m_filePath
Definition filedef.cpp:244
DString title() const override
Definition filedef.cpp:1964
void addRequirementReferences() override
Definition filedef.cpp:1720
bool isLinkable() const override
Definition filedef.cpp:146
FileDefImpl(const DString &p, const DString &n, const DString &ref=DString(), const DString &dn=DString())
Definition filedef.cpp:282
DefType definitionType() const override
Definition filedef.cpp:125
bool hasDetailedDescription() const override
Definition filedef.cpp:366
ClassLinkedRefMap m_records
Definition filedef.cpp:262
DString anchor() const override
Definition filedef.cpp:132
void setDirDef(DirDef *dd) override
Definition filedef.cpp:186
void writeMemberGroups(OutputList &ol)
Definition filedef.cpp:814
const Definition * getSourceDefinition(int lineNr) const override
Definition filedef.cpp:1557
DString includeName() const override
Definition filedef.cpp:1829
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition layout.cpp:1476
Container class representing a vector of objects with keys.
Definition linkedmap.h:232
bool add(const char *k, T *obj)
Definition linkedmap.h:284
iterator end()
Definition linkedmap.h:367
bool prepend(const char *k, T *obj)
Definition linkedmap.h:317
iterator begin()
Definition linkedmap.h:366
A model of a class/file/namespace member symbol.
Definition memberdef.h:45
virtual const ClassDef * getClassDef() const =0
virtual const MemberDef * anonymousMemberForDeclaration() const =0
virtual const MemberDef * anonymousMemberForDetails() const =0
virtual MemberType memberType() const =0
virtual void setSectionList(const Definition *container, const MemberList *sl)=0
A list of MemberDef objects as shown in documentation sections.
Definition memberlist.h:126
bool needsSorting() const
Definition memberlist.h:141
int numDocMembers() const
Definition memberlist.h:139
void writeTagFile(TextStream &, bool useQualifiedName=false, bool showNamespaceMembers=true)
void setNeedsSorting(bool b)
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 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
const std::unique_ptr< MemberList > & get(MemberListType lt, MemberListContainer con)
Definition memberlist.h:192
void remove(const MemberDef *md)
Definition memberlist.h:85
void sort()
Definition memberlist.h:77
bool contains(const MemberDef *md) const
Definition memberlist.h:90
void push_back(const T &value)
Definition memberlist.h:49
static ModuleManager & instance()
ModuleDef * getPrimaryInterface(const DString &moduleName) const
An abstract interface of a namespace symbol.
virtual void combineUsingRelations(NamespaceDefSet &visitedNamespace)=0
void writeDeclaration(OutputList &ol, const DString &title, bool isConstantGroup=false, bool localName=false)
bool declVisible(bool isContantGroup) const
Class representing a list of different code generators.
Definition outputlist.h:162
void startCodeFragment(const DString &style)
Definition outputlist.h:276
void add(OutputCodeIntfPtr &&p)
Definition outputlist.h:192
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
bool isEnabled(OutputType o)
void parseText(const DString &textStr)
void disable(OutputType o)
void startParagraph(const DString &classDef=DString())
Definition outputlist.h:403
void writeObjectLink(const DString &ref, const DString &file, const DString &anchor, const DString &name)
Definition outputlist.h:435
void startInclDepGraph()
Definition outputlist.h:648
void writeRuler()
Definition outputlist.h:517
const OutputCodeList & codeGenerators() const
Definition outputlist.h:354
void enable(OutputType o)
void endContents()
Definition outputlist.h:616
void endTextBlock(bool paraBreak=false)
Definition outputlist.h:668
void docify(const DString &s)
Definition outputlist.h:433
void lineBreak(const DString &style=DString())
Definition outputlist.h:555
void writeAnchor(const DString &fileName, const DString &name)
Definition outputlist.h:519
void writeString(const DString &text)
Definition outputlist.h:407
void startProjectNumber()
Definition outputlist.h:387
void endParagraph()
Definition outputlist.h:405
void endInclDepGraph(DotInclDepGraph &g)
Definition outputlist.h:650
void startMemberSections()
Definition outputlist.h:457
void endTextLink()
Definition outputlist.h:440
void writeSynopsis()
Definition outputlist.h:588
void startTypewriter()
Definition outputlist.h:445
void pushGeneratorState()
void writeSummaryLink(const DString &file, const DString &anchor, const DString &title, bool first)
Definition outputlist.h:610
void disableAllBut(OutputType o)
void startTextBlock(bool dense=false)
Definition outputlist.h:666
void popGeneratorState()
void startTextLink(const DString &file, const DString &anchor)
Definition outputlist.h:438
void endGroupHeader(int extraLevels=0)
Definition outputlist.h:451
void endQuickIndices()
Definition outputlist.h:600
void writePageOutline()
Definition outputlist.h:612
void generateDoc(const DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &docStr, const DocOptions &options)
void startContents()
Definition outputlist.h:614
void startGroupHeader(const DString &id=DString(), int extraLevels=0)
Definition outputlist.h:449
void enableAll()
void endProjectNumber()
Definition outputlist.h:389
void endTypewriter()
Definition outputlist.h:447
void endMemberSections()
Definition outputlist.h:459
std::unique_ptr< CodeParserInterface > getCodeParser(const DString &extension)
Gets the interface to the parser associated with a given extension.
Definition parserintf.h:253
static RequirementManager & instance()
void addRequirementRefsForSymbol(const Definition *symbol)
Text streaming class that buffers data.
Definition textstream.h:36
virtual DString trAuthor(bool first_capital, bool singular)=0
virtual DString trFileReference(const DString &fileName)=0
virtual DString trGotoDocumentation()=0
virtual DString trInclDepGraph(const DString &fName)=0
virtual DString trMore()=0
virtual DString trInclByDepGraph()=0
virtual DString trSourceFile(const DString &filename)=0
virtual DString trGotoSourceCode()=0
virtual DString trGeneratedAutomatically(const DString &s)=0
virtual DString trFile(bool first_capital, bool singular)=0
virtual DString trDefinedInSourceFile()=0
static void writeVhdlDeclarations(const MemberList *, OutputList &, const GroupDef *, const ClassDef *, const FileDef *, const NamespaceDef *, const ModuleDef *)
#define Config_getInt(name)
Definition config.h:34
#define Config_getBool(name)
Definition config.h:33
#define Config_getString(name)
Definition config.h:32
#define NON_COPYABLE(cls)
Macro to help implementing the rule of 5 for a non-copyable & movable class.
Definition construct.h:37
std::unordered_set< std::string > StringUnorderedSet
Definition containers.h:29
std::vector< std::string > StringVector
Definition containers.h:33
IDocParserPtr createDocParser()
factory function to create a parser
Definition docparser.cpp:59
void docFindSections(const DString &input, const Definition *d, const DString &fileName)
IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf, const DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &input, const DocOptions &options)
int dstricmp_sort(const char *str1, const char *str2)
Definition dstring.h:67
const char * qPrint(const char *s)
Definition dstring.h:783
DString includeClose(SrcLangExt lang, IncludeKind kind)
Definition filedef.cpp:82
std::unordered_map< std::string, const IncludeInfo * > IncludeInfoMap
Definition filedef.cpp:116
DString includeOpen(SrcLangExt lang, IncludeKind kind)
Definition filedef.cpp:69
std::unordered_map< int, const Definition * > DefinitionLineMap
Definition filedef.cpp:114
bool compareFileDefs(const FileDef *fd1, const FileDef *fd2)
Definition filedef.cpp:2047
FileDef * toFileDef(Definition *d)
Definition filedef.cpp:2054
std::unordered_map< int, const MemberDef * > MemberDefLineMap
Definition filedef.cpp:115
DString includeTagFileAttributes(SrcLangExt lang, IncludeKind kind)
Definition filedef.cpp:100
DString includeStatement(SrcLangExt lang, IncludeKind kind)
Definition filedef.cpp:52
std::unique_ptr< FileDef > createFileDef(const DString &p, const DString &n, const DString &ref, const DString &dn)
Definition filedef.cpp:270
static void getAllIncludeFilesRecursively(StringUnorderedSet &filesVisited, const FileDef *fd, StringVector &incFiles)
Definition filedef.cpp:1942
constexpr uint32_t IncludeKind_ObjCMask
Definition filedef.h:64
IncludeKind
Definition filedef.h:44
@ ImportLocal
Definition filedef.h:51
@ ImportModule
Definition filedef.h:52
@ IncludeLocal
Definition filedef.h:47
@ ImportSystemObjC
Definition filedef.h:48
@ ImportLocalObjC
Definition filedef.h:49
@ IncludeSystem
Definition filedef.h:46
@ ImportSystem
Definition filedef.h:50
constexpr uint32_t IncludeKind_ImportMask
Definition filedef.h:62
constexpr uint32_t IncludeKind_LocalMask
Definition filedef.h:60
std::unordered_set< const FileDef * > FileDefSet
Definition filedef.h:41
void endTitle(OutputList &ol, const DString &fileName, const DString &name)
Definition index.cpp:404
void endFileWithNavPath(OutputList &ol, const DefinitionMutable *d, bool showPageNavigation)
Definition index.cpp:458
void startTitle(OutputList &ol, const DString &fileName, const DefinitionMutable *def)
Definition index.cpp:394
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:411
Translator * theTranslator
Definition language.cpp:76
MemberDefMutable * toMemberDefMutable(Definition *d)
#define warn_uncond(fmt,...)
Definition message.h:122
#define msg(fmt,...)
Definition message.h:94
#define err(fmt,...)
Definition message.h:127
FILE * popen(const DString &name, const DString &type)
Definition portable.cpp:495
int pclose(FILE *stream)
Definition portable.cpp:504
DString removeLongPathMarker(const DString &path)
Definition portable.cpp:656
NamespaceDefMutable * toNamespaceDefMutable(Definition *d)
std::unordered_set< const NamespaceDef * > NamespaceDefSet
Portable versions of functions that are platform dependent.
void addRefItem(const RefItemVector &sli, const DString &key, const DString &prefix, const DString &name, const DString &title, const DString &args, const Definition *scope)
Definition reflist.h:136
std::string_view stripWhiteSpace(std::string_view s)
Given a string view s, returns a new, narrower view on that string, skipping over any leading or trai...
Definition stringutil.h:75
Options to configure the code parser.
Definition parserintf.h:77
Helper class to pass options when calling OutputList::generateDoc().
Definition docoptions.h:24
static DString path2URL(const DString &path)
Definition htags.cpp:159
static bool useHtags
Definition htags.h:23
Represents of a member declaration list with configurable title and subtitle.
Definition layout.h:112
MemberListType type
Definition layout.h:118
DString title(SrcLangExt lang) const
Definition layout.cpp:1827
Represents of a member definition list with configurable title.
Definition layout.h:132
MemberListType type
Definition layout.h:137
DString title(SrcLangExt lang) const
Definition layout.cpp:1839
Definition layout.h:102
DString title(SrcLangExt lang) const
Definition layout.cpp:1820
CodeSymbolType
Definition types.h:481
SrcLangExt
Definition types.h:207
DString detab(const DString &s, size_t &refIndent)
Definition util.cpp:5330
DString convertNameToFile(const DString &name, bool allowDots, bool allowUnderscore)
Definition util.cpp:2995
void addGroupListToTitle(OutputList &ol, const Definition *d)
Definition util.cpp:4053
DString getFileNameExtension(const DString &fn)
Definition util.cpp:4342
void createSubDirs(const Dir &d)
Definition util.cpp:3101
DString convertToHtml(const DString &s, bool keepEntities)
Definition util.cpp:3423
SrcLangExt getLanguageFromFileName(const DString &fileName, SrcLangExt defLang)
Definition util.cpp:4300
DString getFileFilter(const DString &name, bool isSourceCode)
Definition util.cpp:1025
void addHtmlExtensionIfMissing(DString &fName)
Definition util.cpp:4063
DString fileToString(const DString &name, bool filter, bool isSourceCode)
Definition util.cpp:1058
DString convertToXML(const DString &s, bool keepEntities, const bool citeEntry)
Definition util.cpp:3364
DString stripFromPath(const DString &path)
Definition util.cpp:219
A bunch of utility functions.