Doxygen
Loading...
Searching...
No Matches
filedef.cpp File Reference
#include <unordered_set>
#include "memberlist.h"
#include "classlist.h"
#include "filedef.h"
#include "doxygen.h"
#include "memberdef.h"
#include "classdef.h"
#include "namespacedef.h"
#include "util.h"
#include "language.h"
#include "outputlist.h"
#include "dot.h"
#include "dotincldepgraph.h"
#include "message.h"
#include "docparser.h"
#include "searchindex.h"
#include "htags.h"
#include "parserintf.h"
#include "portable.h"
#include "vhdldocgen.h"
#include "debug.h"
#include "layout.h"
#include "entry.h"
#include "groupdef.h"
#include "filename.h"
#include "membergroup.h"
#include "dirdef.h"
#include "config.h"
#include "clangparser.h"
#include "settings.h"
#include "definitionimpl.h"
#include "conceptdef.h"
#include "moduledef.h"
+ Include dependency graph for filedef.cpp:

Go to the source code of this file.

Classes

class  FileDefImpl
 

Typedefs

using DefinitionLineMap = std::unordered_map<int,const Definition *>
 
using MemberDefLineMap = std::unordered_map<int,const MemberDef *>
 
using IncludeInfoMap = std::unordered_map<std::string, const IncludeInfo *>
 

Functions

QCString includeStatement (SrcLangExt lang, IncludeKind kind)
 
QCString includeOpen (SrcLangExt lang, IncludeKind kind)
 
QCString includeClose (SrcLangExt lang, IncludeKind kind)
 
QCString includeTagFileAttributes (SrcLangExt lang, IncludeKind kind)
 
std::unique_ptr< FileDefcreateFileDef (const QCString &p, const QCString &n, const QCString &ref, const QCString &dn)
 
static void getAllIncludeFilesRecursively (StringUnorderedSet &filesVisited, const FileDef *fd, StringVector &incFiles)
 
bool compareFileDefs (const FileDef *fd1, const FileDef *fd2)
 
FileDeftoFileDef (Definition *d)
 
const FileDeftoFileDef (const Definition *d)
 

Typedef Documentation

◆ DefinitionLineMap

using DefinitionLineMap = std::unordered_map<int,const Definition *>

Definition at line 118 of file filedef.cpp.

◆ IncludeInfoMap

using IncludeInfoMap = std::unordered_map<std::string, const IncludeInfo *>

Definition at line 120 of file filedef.cpp.

◆ MemberDefLineMap

using MemberDefLineMap = std::unordered_map<int,const MemberDef *>

Definition at line 119 of file filedef.cpp.

Function Documentation

◆ compareFileDefs()

bool compareFileDefs ( const FileDef * fd1,
const FileDef * fd2 )

Definition at line 1887 of file filedef.cpp.

1888{
1889 return qstricmp_sort(fd1->name(),fd2->name()) < 0;
1890}
virtual const QCString & name() const =0
int qstricmp_sort(const char *str1, const char *str2)
Definition qcstring.h:86

References Definition::name(), and qstricmp_sort().

Referenced by DirDefImpl::sort(), and writeFileIndex().

◆ createFileDef()

◆ getAllIncludeFilesRecursively()

static void getAllIncludeFilesRecursively ( StringUnorderedSet & filesVisited,
const FileDef * fd,
StringVector & incFiles )
static

Definition at line 1797 of file filedef.cpp.

1799{
1800 for (const auto &ii : fd->includeFileList())
1801 {
1802 if (ii.fileDef && !ii.fileDef->isReference() &&
1803 filesVisited.find(ii.fileDef->absFilePath().str())==filesVisited.end())
1804 {
1805 //printf("FileDefImpl::addIncludeDependency(%s)\n",qPrint(ii->fileDef->absFilePath()));
1806 incFiles.push_back(ii.fileDef->absFilePath().str());
1807 filesVisited.insert(ii.fileDef->absFilePath().str());
1808 getAllIncludeFilesRecursively(filesVisited,ii.fileDef,incFiles);
1809 }
1810 }
1811}
virtual const IncludeInfoList & includeFileList() const =0
static void getAllIncludeFilesRecursively(StringUnorderedSet &filesVisited, const FileDef *fd, StringVector &incFiles)
Definition filedef.cpp:1797

References getAllIncludeFilesRecursively(), and FileDef::includeFileList().

Referenced by getAllIncludeFilesRecursively().

◆ includeClose()

QCString includeClose ( SrcLangExt lang,
IncludeKind kind )

Definition at line 86 of file filedef.cpp.

87{
88 if (lang==SrcLangExt::IDL) return "\";";
89 else if (lang==SrcLangExt::Java) return ";";
90
91 switch (kind)
92 {
93 case IncludeKind::ImportLocal: return "\";";
94 case IncludeKind::ImportLocalObjC: return "\"";
95 case IncludeKind::IncludeLocal: return "\"";
96 case IncludeKind::ImportSystem: return ">;";
97 case IncludeKind::ImportSystemObjC: return ">";
98 case IncludeKind::IncludeSystem: return ">";
99 case IncludeKind::ImportModule: return ";";
100 }
101 return "";
102}
@ ImportLocal
Definition filedef.h:54
@ ImportModule
Definition filedef.h:55
@ IncludeLocal
Definition filedef.h:50
@ ImportSystemObjC
Definition filedef.h:51
@ ImportLocalObjC
Definition filedef.h:52
@ IncludeSystem
Definition filedef.h:49
@ ImportSystem
Definition filedef.h:53

References IDL, ImportLocal, ImportLocalObjC, ImportModule, ImportSystem, ImportSystemObjC, IncludeLocal, IncludeSystem, and Java.

Referenced by ClassDefImpl::writeIncludeFiles(), ConceptDefImpl::writeIncludeFiles(), and FileDefImpl::writeIncludeFiles().

◆ includeOpen()

QCString includeOpen ( SrcLangExt lang,
IncludeKind kind )

Definition at line 73 of file filedef.cpp.

74{
75 if (lang==SrcLangExt::Java || kind==IncludeKind::ImportModule) return "";
76 if ((kind & IncludeKind_LocalMask) || (lang==SrcLangExt::IDL))
77 {
78 return "\"";
79 }
80 else
81 {
82 return "<";
83 }
84}
constexpr uint32_t IncludeKind_LocalMask
Definition filedef.h:63

References IDL, ImportModule, IncludeKind_LocalMask, and Java.

Referenced by ClassDefImpl::writeIncludeFiles(), ConceptDefImpl::writeIncludeFiles(), and FileDefImpl::writeIncludeFiles().

◆ includeStatement()

QCString includeStatement ( SrcLangExt lang,
IncludeKind kind )

Definition at line 56 of file filedef.cpp.

57{
58 bool isIDLorJava = lang==SrcLangExt::IDL || lang==SrcLangExt::Java;
59 if (isIDLorJava || (kind & IncludeKind_ImportMask))
60 {
61 return "import ";
62 }
63 else if (kind & IncludeKind_ObjCMask)
64 {
65 return "#import ";
66 }
67 else
68 {
69 return "#include ";
70 }
71}
constexpr uint32_t IncludeKind_ObjCMask
Definition filedef.h:67
constexpr uint32_t IncludeKind_ImportMask
Definition filedef.h:65

References IDL, IncludeKind_ImportMask, IncludeKind_ObjCMask, and Java.

Referenced by ClassDefImpl::writeIncludeFiles(), ConceptDefImpl::writeIncludeFiles(), and FileDefImpl::writeIncludeFiles().

◆ includeTagFileAttributes()

QCString includeTagFileAttributes ( SrcLangExt lang,
IncludeKind kind )

Definition at line 104 of file filedef.cpp.

105{
106 QCString result;
107 bool isIDLorJava = lang==SrcLangExt::IDL || lang==SrcLangExt::Java;
108 result.sprintf("local=\"%s\" import=\"%s\" module=\"%s\" objc=\"%s\"",
109 (kind & IncludeKind_LocalMask) ? "yes" : "no",
110 (isIDLorJava || (kind & IncludeKind_ImportMask)) ? "yes" : "no",
111 (kind==IncludeKind::ImportModule) ? "yes" : "no",
112 (kind & IncludeKind_ObjCMask) ? "yes" : "no");
113 return result;
114}
This is an alternative implementation of QCString.
Definition qcstring.h:101
QCString & sprintf(const char *format,...)
Definition qcstring.cpp:29

References IDL, ImportModule, IncludeKind_ImportMask, IncludeKind_LocalMask, IncludeKind_ObjCMask, Java, and QCString::sprintf().

Referenced by FileDefImpl::writeTagFile().

◆ toFileDef() [1/2]

const FileDef * toFileDef ( const Definition * d)

Definition at line 1907 of file filedef.cpp.

1908{
1909 if (d==nullptr) return nullptr;
1910 if (d && typeid(*d)==typeid(FileDefImpl))
1911 {
1912 return static_cast<const FileDef*>(d);
1913 }
1914 else
1915 {
1916 return nullptr;
1917 }
1918}
A model of a file symbol.
Definition filedef.h:99

◆ toFileDef() [2/2]