Doxygen
dirdef.cpp 文件参考
#include <algorithm>
#include "dirdef.h"
#include "md5.h"
#include "filename.h"
#include "doxygen.h"
#include "util.h"
#include "outputlist.h"
#include "language.h"
#include "message.h"
#include "dot.h"
#include "dotdirdeps.h"
#include "layout.h"
#include "config.h"
#include "docparser.h"
#include "definitionimpl.h"
#include "filedef.h"
+ dirdef.cpp 的引用(Include)关系图:

浏览源代码.

class  DirDefImpl
 

函数

DirDefcreateDirDef (const QCString &path)
 
static QCString encodeDirName (const QCString &anchor)
 
static void writePartialDirPath (OutputList &ol, const DirDef *root, const DirDef *target)
 
static void writePartialFilePath (OutputList &ol, const DirDef *root, const FileDef *fd)
 
static void computeCommonDirPrefix ()
 In order to create stable, but unique directory names, we compute the common part of the path shared by all directories. 更多...
 
void buildDirectories ()
 
void computeDirDependencies ()
 
void generateDirDocs (OutputList &ol)
 
bool compareDirDefs (const DirDef *item1, const DirDef *item2)
 
DirDeftoDirDef (Definition *d)
 
const DirDeftoDirDef (const Definition *d)
 

函数说明

◆ buildDirectories()

void buildDirectories ( )

在文件 dirdef.cpp1005 行定义.

1006 {
1007  // for each input file
1008  for (const auto &fn : *Doxygen::inputNameLinkedMap)
1009  {
1010  for (const auto &fd : *fn)
1011  {
1012  if (fd->getReference().isEmpty())
1013  {
1014  DirDef *dir;
1015  if ((dir=Doxygen::dirLinkedMap->find(fd->getPath()))==0) // new directory
1016  {
1017  dir = DirDefImpl::mergeDirectoryInTree(fd->getPath());
1018  }
1019  if (dir && !fd->isDocumentationFile()) dir->addFile(fd.get());
1020  }
1021  else
1022  {
1023  // do something for file imported via tag files.
1024  }
1025  }
1026  }
1027 
1028  // compute relations between directories => introduce container dirs.
1029  for (const auto &dir : *Doxygen::dirLinkedMap)
1030  {
1031  QCString name = dir->name();
1032  int i=name.findRev('/',(int)name.length()-2);
1033  if (i>0)
1034  {
1035  DirDef *parent = Doxygen::dirLinkedMap->find(name.left(i+1));
1036  //if (parent==0) parent=root;
1037  if (parent)
1038  {
1039  parent->addSubDir(dir.get());
1040  //printf("DirDefImpl::addSubdir(): Adding subdir\n%s to\n%s\n",
1041  // qPrint(dir->displayName()), qPrint(parent->displayName()));
1042  }
1043  }
1044  }
1045 
1046  // sort the directory contents
1047  for (const auto &dir : *Doxygen::dirLinkedMap)
1048  {
1049  dir->sort();
1050  }
1051 
1052  // short the directories themselves
1053  std::sort(Doxygen::dirLinkedMap->begin(),
1055  [](const auto &d1,const auto &d2)
1056  {
1057  QCString s1 = d1->shortName(), s2 = d2->shortName();
1058  int i = qstricmp(s1,s2);
1059  if (i==0) // if sort name are equal, sort on full path
1060  {
1061  QCString n1 = d1->name(), n2 = d2->name();
1062  int n = qstricmp(n1,n2);
1063  return n < 0;
1064  }
1065  return i < 0;
1066  });
1067 
1068  // set the directory count identifier
1069  int dirCount=0;
1070  for (const auto &dir : *Doxygen::dirLinkedMap)
1071  {
1072  dir->setDirCount(dirCount++);
1073  }
1074 
1076 }

引用了 DirDef::addFile(), DirDef::addSubDir(), begin(), computeCommonDirPrefix(), Doxygen::dirLinkedMap, end(), LinkedMap< T, Hash, KeyEqual, Map >::find(), QCString::findRev(), Doxygen::inputNameLinkedMap, QCString::left(), QCString::length(), DirDefImpl::mergeDirectoryInTree() , 以及 qstricmp().

被这些函数引用 parseInput().

◆ compareDirDefs()

bool compareDirDefs ( const DirDef item1,
const DirDef item2 
)

在文件 dirdef.cpp1115 行定义.

1116 {
1117  return qstricmp(item1->shortName(),item2->shortName()) < 0;
1118 }

引用了 qstricmp() , 以及 DirDef::shortName().

被这些函数引用 DirDefImpl::sort() , 以及 GroupDefImpl::sortMemberLists().

◆ computeCommonDirPrefix()

static void computeCommonDirPrefix ( )
static

In order to create stable, but unique directory names, we compute the common part of the path shared by all directories.

在文件 dirdef.cpp930 行定义.

931 {
932  QCString path;
933  auto it = Doxygen::dirLinkedMap->begin();
934  if (!Doxygen::dirLinkedMap->empty()) // we have at least one dir
935  {
936  // start will full path of first dir
937  path=(*it)->name();
938  int i=path.findRev('/',(int)path.length()-2);
939  path=path.left(i+1);
940  bool done=FALSE;
941  if (i==-1)
942  {
943  path="";
944  }
945  else
946  {
947  while (!done)
948  {
949  uint l = path.length();
950  size_t count=0;
951  for (const auto &dir : *Doxygen::dirLinkedMap)
952  {
953  QCString dirName = dir->name();
954  if (dirName.length()>path.length())
955  {
956  if (dirName.left(l)!=path) // dirName does not start with path
957  {
958  i=path.findRev('/',(int)l-2);
959  if (i==-1) // no unique prefix -> stop
960  {
961  path="";
962  done=TRUE;
963  }
964  else // restart with shorter path
965  {
966  path=path.left(i+1);
967  break;
968  }
969  }
970  }
971  else // dir is shorter than path -> take path of dir as new start
972  {
973  path=dir->name();
974  l=path.length();
975  i=path.findRev('/',(int)l-2);
976  if (i==-1) // no unique prefix -> stop
977  {
978  path="";
979  done=TRUE;
980  }
981  else // restart with shorter path
982  {
983  path=path.left(i+1);
984  }
985  break;
986  }
987  count++;
988  }
989  if (count==Doxygen::dirLinkedMap->size())
990  // path matches for all directories -> found the common prefix
991  {
992  done=TRUE;
993  }
994  }
995  }
996  }
997  for (const auto &dir : *Doxygen::dirLinkedMap)
998  {
999  QCString diskName = dir->name().right(dir->name().length()-path.length());
1000  dir->setDiskName(diskName);
1001  //printf("set disk name: %s -> %s\n",qPrint(dir->name()),qPrint(diskName));
1002  }
1003 }

引用了 LinkedMap< T, Hash, KeyEqual, Map >::begin(), Doxygen::dirLinkedMap, FALSE, QCString::findRev(), QCString::left(), QCString::length(), QCString::right() , 以及 TRUE.

被这些函数引用 buildDirectories().

◆ computeDirDependencies()

void computeDirDependencies ( )

在文件 dirdef.cpp1078 行定义.

1079 {
1080  // compute nesting level for each directory
1081  for (const auto &dir : *Doxygen::dirLinkedMap)
1082  {
1083  dir->setLevel();
1084  }
1085 
1086  // compute uses dependencies between directories
1087  for (const auto &dir : *Doxygen::dirLinkedMap)
1088  {
1089  //printf("computeDependencies for %s: #dirs=%d\n",qPrint(dir->name()),Doxygen::directories.count());
1090  dir->computeDependencies();
1091  }
1092 }

引用了 Doxygen::dirLinkedMap.

被这些函数引用 parseInput().

◆ createDirDef()

DirDef* createDirDef ( const QCString path)

在文件 dirdef.cpp102 行定义.

103 {
104  return new DirDefImpl(path);
105 }

被这些函数引用 DirDefImpl::createNewDir().

◆ encodeDirName()

static QCString encodeDirName ( const QCString anchor)
static

在文件 dirdef.cpp181 行定义.

182 {
183  // convert to md5 hash
184  uchar md5_sig[16];
185  char sigStr[33];
186  MD5Buffer((const unsigned char *)anchor.data(),anchor.length(),md5_sig);
187  MD5SigToString(md5_sig,sigStr);
188  return sigStr;
189 
190  // old algorithm
191 // QCString result;
192 
193 // int l = anchor.length(),i;
194 // for (i=0;i<l;i++)
195 // {
196 // char c = anchor.at(i);
197 // if ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9'))
198 // {
199 // result+=c;
200 // }
201 // else
202 // {
203 // static char hexStr[]="0123456789ABCDEF";
204 // char escChar[]={ '_', 0, 0, 0 };
205 // escChar[1]=hexStr[c>>4];
206 // escChar[2]=hexStr[c&0xf];
207 // result+=escChar;
208 // }
209 // }
210 // return result;
211 }

引用了 QCString::data() , 以及 QCString::length().

被这些函数引用 DirDefImpl::getOutputFileBase().

◆ generateDirDocs()

void generateDirDocs ( OutputList ol)

在文件 dirdef.cpp1094 行定义.

1095 {
1096  for (const auto &dir : *Doxygen::dirLinkedMap)
1097  {
1098  ol.pushGeneratorState();
1099  if (!dir->hasDocumentation())
1100  {
1102  }
1103  dir->writeDocumentation(ol);
1104  ol.popGeneratorState();
1105  }
1106  if (Config_getBool(DIRECTORY_GRAPH))
1107  {
1108  for (const auto &dr : Doxygen::dirRelations)
1109  {
1110  dr->writeDocumentation(ol);
1111  }
1112  }
1113 }

引用了 Config_getBool, Doxygen::dirLinkedMap, Doxygen::dirRelations, OutputList::disableAllBut(), OutputGenerator::Html, OutputList::popGeneratorState() , 以及 OutputList::pushGeneratorState().

被这些函数引用 generateOutput().

◆ toDirDef() [1/2]

const DirDef* toDirDef ( const Definition d)

在文件 dirdef.cpp1135 行定义.

1136 {
1137  if (d==0) return 0;
1138  if (d && typeid(*d)==typeid(DirDefImpl))
1139  {
1140  return static_cast<const DirDef*>(d);
1141  }
1142  else
1143  {
1144  return 0;
1145  }
1146 }

◆ toDirDef() [2/2]

DirDef* toDirDef ( Definition d)

在文件 dirdef.cpp1122 行定义.

1123 {
1124  if (d==0) return 0;
1125  if (d && typeid(*d)==typeid(DirDefImpl))
1126  {
1127  return static_cast<DirDef*>(d);
1128  }
1129  else
1130  {
1131  return 0;
1132  }
1133 }

被这些函数引用 NestingNodeContext::Private::addDirFiles() , 以及 NestingNodeContext::Private::createDir().

◆ writePartialDirPath()

static void writePartialDirPath ( OutputList ol,
const DirDef root,
const DirDef target 
)
static

在文件 dirdef.cpp843 行定义.

844 {
845  if (target->parent()!=root)
846  {
847  writePartialDirPath(ol,root,target->parent());
848  ol.writeString("&#160;/&#160;");
849  }
850  ol.writeObjectLink(target->getReference(),target->getOutputFileBase(),QCString(),target->shortName());
851 }

引用了 DirDef::getOutputFileBase(), Definition::getReference(), DirDef::parent(), DirDef::shortName(), OutputList::writeObjectLink() , 以及 OutputList::writeString().

被这些函数引用 writePartialFilePath().

◆ writePartialFilePath()

static void writePartialFilePath ( OutputList ol,
const DirDef root,
const FileDef fd 
)
static

在文件 dirdef.cpp853 行定义.

854 {
855  if (fd->getDirDef() && fd->getDirDef()!=root)
856  {
857  writePartialDirPath(ol,root,fd->getDirDef());
858  ol.writeString("&#160;/&#160;");
859  }
860  if (fd->isLinkable())
861  {
863  }
864  else
865  {
866  ol.startBold();
867  ol.docify(fd->name());
868  ol.endBold();
869  }
870 }

引用了 OutputList::docify(), OutputList::endBold(), FileDef::getDirDef(), FileDef::getOutputFileBase(), Definition::getReference(), FileDef::isLinkable(), FileDef::name(), OutputList::startBold(), OutputList::writeObjectLink(), writePartialDirPath() , 以及 OutputList::writeString().

被这些函数引用 DirRelation::writeDocumentation().

OutputList::disableAllBut
void disableAllBut(OutputGenerator::OutputType o)
Definition: outputlist.cpp:76
writePartialDirPath
static void writePartialDirPath(OutputList &ol, const DirDef *root, const DirDef *target)
Definition: dirdef.cpp:843
OutputList::docify
void docify(const QCString &s)
Definition: outputlist.h:137
QCString::length
uint length() const
Returns the length of the string, not counting the 0-terminator.
Definition: qcstring.h:147
DirDef::addFile
virtual void addFile(const FileDef *fd)=0
QCString::findRev
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition: qcstring.cpp:86
DirDef
A model of a directory symbol.
Definition: dirdef.h:110
OutputList::startBold
void startBold()
Definition: outputlist.h:302
DirDef::sort
virtual void sort()=0
OutputList::writeString
void writeString(const QCString &text)
Definition: outputlist.h:111
FileDef::isLinkable
virtual bool isLinkable() const =0
Doxygen::dirLinkedMap
static DirLinkedMap * dirLinkedMap
Definition: doxygen.h:109
LinkedMap::begin
iterator begin()
Definition: linkedmap.h:214
begin
DirIterator begin(DirIterator it) noexcept
Definition: dir.cpp:123
end
DirIterator end(const DirIterator &) noexcept
Definition: dir.cpp:128
Doxygen::inputNameLinkedMap
static FileNameLinkedMap * inputNameLinkedMap
Definition: doxygen.h:88
uint
unsigned uint
Definition: qcstring.h:40
DirDef::getOutputFileBase
virtual QCString getOutputFileBase() const =0
DirDef::shortName
virtual const QCString shortName() const =0
uchar
unsigned char uchar
Definition: qcstring.h:38
QCString::left
QCString left(size_t len) const
Definition: qcstring.h:212
FileDef::name
virtual QCString name() const =0
qstricmp
int qstricmp(const char *str1, const char *str2)
Definition: qcstring.cpp:433
DirDefImpl
Definition: dirdef.cpp:37
Definition::name
virtual QCString name() const =0
TRUE
#define TRUE
Definition: qcstring.h:36
OutputGenerator::Html
@ Html
Definition: outputgen.h:333
LinkedMap::find
const T * find(const std::string &key) const
Find an object given the key.
Definition: linkedmap.h:60
Doxygen::dirRelations
static DirRelationLinkedMap dirRelations
Definition: doxygen.h:110
DirDef::addSubDir
virtual void addSubDir(DirDef *subdir)=0
DirDefImpl::mergeDirectoryInTree
static DirDef * mergeDirectoryInTree(const QCString &path)
Definition: dirdef.cpp:817
OutputList::popGeneratorState
void popGeneratorState()
Definition: outputlist.cpp:134
DirDef::setDirCount
virtual void setDirCount(int count)=0
Definition::getReference
virtual QCString getReference() const =0
Config_getBool
#define Config_getBool(name)
Definition: config.h:33
OutputList::pushGeneratorState
void pushGeneratorState()
Definition: outputlist.cpp:126
QCString::data
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string
Definition: qcstring.h:153
computeCommonDirPrefix
static void computeCommonDirPrefix()
In order to create stable, but unique directory names, we compute the common part of the path shared ...
Definition: dirdef.cpp:930
OutputList::writeObjectLink
void writeObjectLink(const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name)
Definition: outputlist.h:141
FileDef::getDirDef
virtual DirDef * getDirDef() const =0
DirDef::parent
virtual DirDef * parent() const =0
FileDef::getOutputFileBase
virtual QCString getOutputFileBase() const =0
QCString::right
QCString right(size_t len) const
Definition: qcstring.h:217
FALSE
#define FALSE
Definition: qcstring.h:33
OutputList::endBold
void endBold()
Definition: outputlist.h:304
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108