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 116 of file filedef.cpp.

◆ IncludeInfoMap

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

Definition at line 118 of file filedef.cpp.

◆ MemberDefLineMap

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

Definition at line 117 of file filedef.cpp.

Function Documentation

◆ compareFileDefs()

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

Definition at line 1885 of file filedef.cpp.

1886{
1887 return qstricmp_sort(fd1->name(),fd2->name()) < 0;
1888}
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 1795 of file filedef.cpp.

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

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::Java || lang==SrcLangExt::IDL) return ";";
89 switch (kind)
90 {
91 case IncludeKind::ImportLocal: return "\";";
92 case IncludeKind::ImportLocalObjC: return "\"";
93 case IncludeKind::IncludeLocal: return "\"";
94 case IncludeKind::ImportSystem: return ">;";
95 case IncludeKind::ImportSystemObjC: return ">";
96 case IncludeKind::IncludeSystem: return ">";
97 case IncludeKind::ImportModule: return ";";
98 }
99 return "";
100}
@ 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)
77 {
78 return "\"";
79 }
80 else
81 {
82 return "<";
83 }
84}
constexpr uint32_t IncludeKind_LocalMask
Definition filedef.h:63

References 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 102 of file filedef.cpp.

103{
104 QCString result;
105 bool isIDLorJava = lang==SrcLangExt::IDL || lang==SrcLangExt::Java;
106 result.sprintf("local=\"%s\" import=\"%s\" module=\"%s\" objc=\"%s\"",
107 (kind & IncludeKind_LocalMask) ? "yes" : "no",
108 (isIDLorJava || (kind & IncludeKind_ImportMask)) ? "yes" : "no",
109 (kind==IncludeKind::ImportModule) ? "yes" : "no",
110 (kind & IncludeKind_ObjCMask) ? "yes" : "no");
111 return result;
112}
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 1905 of file filedef.cpp.

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

◆ toFileDef() [2/2]