Doxygen
Loading...
Searching...
No Matches
dirdef.h File Reference
#include <vector>
#include <map>
#include "qcstring.h"
#include "linkedmap.h"
#include "definition.h"
+ Include dependency graph for dirdef.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  FilePair
 Class representing a pair of FileDef objects. More...
 
class  FilePairLinkedMap
 A linked map of file pairs. More...
 
class  UsedDir
 Usage information of a directory. More...
 
class  DirDef
 A model of a directory symbol. More...
 
class  DirDef::UsedDirLinkedMap
 
class  DirRelation
 A usage relation between two directories. More...
 
class  DirLinkedMap
 A linked map of directories. More...
 
class  DirList
 A list of directories. More...
 
class  DirRelationLinkedMap
 

Functions

bool compareDirDefs (const DirDef *item1, const DirDef *item2)
 
DirDeftoDirDef (Definition *d)
 
const DirDeftoDirDef (const Definition *d)
 
void buildDirectories ()
 
void generateDirDocs (OutputList &ol)
 
void computeDirDependencies ()
 

Function Documentation

◆ buildDirectories()

void buildDirectories ( )

Definition at line 1055 of file dirdef.cpp.

1056{
1057 AUTO_TRACE();
1058 // for each input file
1059 for (const auto &fn : *Doxygen::inputNameLinkedMap)
1060 {
1061 for (const auto &fd : *fn)
1062 {
1063 if (fd->getReference().isEmpty())
1064 {
1065 DirDef *dir=Doxygen::dirLinkedMap->find(fd->getPath());
1066 if (dir==nullptr) // new directory
1067 {
1068 dir = DirDefImpl::mergeDirectoryInTree(fd->getPath());
1069 }
1070 if (dir && !fd->isDocumentationFile()) dir->addFile(fd.get());
1071 }
1072 else
1073 {
1074 // do something for file imported via tag files.
1075 }
1076 }
1077 }
1078
1079 // compute relations between directories => introduce container dirs.
1080 for (const auto &dir : *Doxygen::dirLinkedMap)
1081 {
1082 QCString name = dir->name();
1083 int i=name.findRev('/',static_cast<int>(name.length())-2);
1084 if (i>0)
1085 {
1086 DirDef *parent = Doxygen::dirLinkedMap->find(name.left(i+1));
1087 //if (parent==0) parent=root;
1088 if (parent)
1089 {
1090 parent->addSubDir(dir.get());
1091 AUTO_TRACE_ADD("DirDefImpl::addSubdir(): Adding subdir {} to {}",
1092 dir->displayName(), parent->displayName());
1093 }
1094 }
1095 }
1096
1097 // sort the directory contents
1098 for (const auto &dir : *Doxygen::dirLinkedMap)
1099 {
1100 dir->sort();
1101 }
1102
1103 // short the directories themselves
1104 std::stable_sort(Doxygen::dirLinkedMap->begin(),
1106 [](const auto &d1,const auto &d2)
1107 {
1108 QCString s1 = d1->shortName(), s2 = d2->shortName();
1109 int i = qstricmp_sort(s1,s2);
1110 if (i==0) // if sort name are equal, sort on full path
1111 {
1112 QCString n1 = d1->name(), n2 = d2->name();
1113 int n = qstricmp_sort(n1,n2);
1114 return n < 0;
1115 }
1116 return i < 0;
1117 });
1118
1119 // set the directory index identifier
1120 int dirIndex=0;
1121 for (const auto &dir : *Doxygen::dirLinkedMap)
1122 {
1123 dir->setDirIndex(dirIndex++);
1124 }
1125
1127}
virtual QCString displayName(bool includeScope=TRUE) const =0
virtual const QCString & name() const =0
A model of a directory symbol.
Definition dirdef.h:110
virtual void sort()=0
virtual void addFile(FileDef *fd)=0
virtual void setDirIndex(int index)=0
static DirDef * mergeDirectoryInTree(const QCString &path)
Definition dirdef.cpp:854
static FileNameLinkedMap * inputNameLinkedMap
Definition doxygen.h:105
static DirLinkedMap * dirLinkedMap
Definition doxygen.h:129
This is an alternative implementation of QCString.
Definition qcstring.h:101
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition qcstring.cpp:91
QCString left(size_t len) const
Definition qcstring.h:214
DirIterator begin(DirIterator it) noexcept
Definition dir.cpp:170
DirIterator end(const DirIterator &) noexcept
Definition dir.cpp:175
static void computeCommonDirPrefix()
In order to create stable, but unique directory names, we compute the common part of the path shared ...
Definition dirdef.cpp:978
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:47
#define AUTO_TRACE(...)
Definition docnode.cpp:46
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
Definition docnode.h:1324
int qstricmp_sort(const char *str1, const char *str2)
Definition qcstring.h:86

References DirDef::addFile(), AUTO_TRACE, AUTO_TRACE_ADD, begin(), computeCommonDirPrefix(), Doxygen::dirLinkedMap, end(), QCString::findRev(), Doxygen::inputNameLinkedMap, QCString::left(), QCString::length(), DirDefImpl::mergeDirectoryInTree(), parent(), and qstricmp_sort().

Referenced by parseInput().

◆ compareDirDefs()

bool compareDirDefs ( const DirDef * item1,
const DirDef * item2 )

Definition at line 1168 of file dirdef.cpp.

1169{
1170 return qstricmp_sort(item1->shortName(),item2->shortName()) < 0;
1171}
virtual const QCString shortName() const =0

References qstricmp_sort(), and DirDef::shortName().

Referenced by DirDefImpl::sort(), and GroupDefImpl::sortMemberLists().

◆ computeDirDependencies()

void computeDirDependencies ( )

Definition at line 1129 of file dirdef.cpp.

1130{
1131 AUTO_TRACE();
1132 // compute nesting level for each directory
1133 for (const auto &dir : *Doxygen::dirLinkedMap)
1134 {
1135 dir->setLevel();
1136 }
1137
1138 // compute uses dependencies between directories
1139 for (const auto &dir : *Doxygen::dirLinkedMap)
1140 {
1141 AUTO_TRACE_ADD("computeDependencies for {}: #dirs={}",dir->name(),Doxygen::dirLinkedMap->size());
1142 dir->computeDependencies();
1143 }
1144}

References AUTO_TRACE, AUTO_TRACE_ADD, and Doxygen::dirLinkedMap.

Referenced by parseInput().

◆ generateDirDocs()

void generateDirDocs ( OutputList & ol)

Definition at line 1146 of file dirdef.cpp.

1147{
1148 AUTO_TRACE();
1149 for (const auto &dir : *Doxygen::dirLinkedMap)
1150 {
1151 ol.pushGeneratorState();
1152 if (!dir->hasDocumentation())
1153 {
1155 }
1156 dir->writeDocumentation(ol);
1157 ol.popGeneratorState();
1158 }
1159 //if (Config_getBool(DIRECTORY_GRAPH))
1160 {
1161 for (const auto &dr : Doxygen::dirRelations)
1162 {
1163 dr->writeDocumentation(ol);
1164 }
1165 }
1166}
static DirRelationLinkedMap dirRelations
Definition doxygen.h:130
void pushGeneratorState()
void disableAllBut(OutputType o)
void popGeneratorState()

References AUTO_TRACE, Doxygen::dirLinkedMap, Doxygen::dirRelations, OutputList::disableAllBut(), Html, OutputList::popGeneratorState(), and OutputList::pushGeneratorState().

Referenced by generateOutput().

◆ toDirDef() [1/2]

const DirDef * toDirDef ( const Definition * d)

Definition at line 1188 of file dirdef.cpp.

1189{
1190 if (d==nullptr) return nullptr;
1191 if (d && typeid(*d)==typeid(DirDefImpl))
1192 {
1193 return static_cast<const DirDef*>(d);
1194 }
1195 else
1196 {
1197 return nullptr;
1198 }
1199}

◆ toDirDef() [2/2]

DirDef * toDirDef ( Definition * d)

Definition at line 1175 of file dirdef.cpp.

1176{
1177 if (d==nullptr) return nullptr;
1178 if (d && typeid(*d)==typeid(DirDefImpl))
1179 {
1180 return static_cast<DirDef*>(d);
1181 }
1182 else
1183 {
1184 return nullptr;
1185 }
1186}