Class representing a directory in the file system. More...
Declaration
class Dir { ... }
Public Constructors Index
| Dir () |
|
|
|
| Dir (const std::string &path) |
|
|
|
| Dir (const Dir &d) |
|
|
|
| Dir (Dir &&d) |
|
|
|
Public Destructor Index
Public Operators Index
Public Member Functions Index
void | setPath (const std::string &path) |
|
|
|
std::string | path () const |
|
|
|
DirIterator | iterator () const |
|
|
|
bool | isEmpty (const std::string subdir) const |
|
|
|
bool | exists () const |
|
|
|
std::string | filePath (const std::string &path, bool acceptsAbsPath=true) const |
|
|
|
bool | exists (const std::string &path, bool acceptsAbsPath=true) const |
|
|
|
bool | mkdir (const std::string &path, bool acceptsAbsPath=true) const |
|
|
|
bool | rmdir (const std::string &path, bool acceptsAbsPath=true) const |
|
|
|
bool | remove (const std::string &path, bool acceptsAbsPath=true) const |
|
|
|
bool | rename (const std::string &orgName, const std::string &newName, bool acceptsAbsPath=true) const |
|
|
|
bool | copy (const std::string &src, const std::string &dest, bool acceptsAbsPath=true) const |
|
|
|
std::string | absPath () const |
|
|
|
bool | isRelative () const |
|
|
|
Private Member Attributes Index
Public Static Functions Index
Description
Class representing a directory in the file system.
Definition at line 74 of file dir.h.
Public Constructors
Dir()
Declaration at line 77 of file dir.h, definition at line 189 of file dir.cpp.
190{
191 std::error_code ec;
192 p->path = fs::current_path(ec);
193}
Reference p.
Referenced by Dir, Dir, operator= and operator=.
Dir()
Dir::Dir (const std::string & path) |
|
Dir()
Declaration at line 79 of file dir.h, definition at line 195 of file dir.cpp.
References Dir and p.
Dir()
Declaration at line 81 of file dir.h, definition at line 209 of file dir.cpp.
210{
211 std::exchange(p->path,d.p->path);
212}
References Dir and p.
Public Destructor
~Dir()
Declaration at line 83 of file dir.h, definition at line 225 of file dir.cpp.
Public Operators
operator=()
Dir & Dir::operator= (const Dir & d) |
|
Declaration at line 80 of file dir.h, definition at line 200 of file dir.cpp.
201{
202 if (&d!=this)
203 {
205 }
206 return *this;
207}
References Dir and p.
operator=()
Dir & Dir::operator= (Dir && d) |
|
Declaration at line 82 of file dir.h, definition at line 214 of file dir.cpp.
215{
216 std::exchange(p->path,d.p->path);
217 return *this;
218}
References Dir and p.
Public Member Functions
absPath()
std::string Dir::absPath () |
|
copy()
bool Dir::copy (const std::string & src, const std::string & dest, bool acceptsAbsPath=true) |
|
Declaration at line 98 of file dir.h, definition at line 330 of file dir.cpp.
330bool Dir::copy(const std::string &srcName,const std::string &dstName,bool acceptsAbsPath) const
331{
332 const auto copyOptions = fs::copy_options::overwrite_existing;
333 std::error_code ec;
334 std::string sn = filePath(srcName,acceptsAbsPath);
335 std::string dn = filePath(dstName,acceptsAbsPath);
336 fs::copy(sn,dn,copyOptions,ec);
337 return !ec;
338}
Reference filePath.
exists()
Declaration at line 90 of file dir.h, definition at line 257 of file dir.cpp.
References FileInfo::exists, FileInfo::isDir and p.
Referenced by clearSubDirs, PerlModGenerator::createOutputDir, createOutputDirectory, createSubDirs, generateDEF, FormulaManager::generateImages, generateOutput, CitationManager::generatePage, DocbookGenerator::init, HtmlGenerator::init, LatexGenerator::init, ManGenerator::init, RTFGenerator::init, initWarningFormat, mkdir, parseInput, RTFGenerator::preProcessFileInplace, writeDotGraphFromFile, writeDotImageMapFromFile and DotGfxHierarchyTable::writeGraph.
exists()
bool Dir::exists (const std::string & path, bool acceptsAbsPath=true) |
|
Declaration at line 92 of file dir.h, definition at line 249 of file dir.cpp.
250{
252 std::error_code ec;
253 bool exist = fs::exists(fs::path(result),ec);
254 return !ec && exist;
255}
References filePath and path.
filePath()
std::string Dir::filePath (const std::string & path, bool acceptsAbsPath=true) |
|
isEmpty()
bool Dir::isEmpty (const std::string subdir) |
|
Declaration at line 89 of file dir.h, definition at line 263 of file dir.cpp.
264{
265 fs::path pth = path();
266 pth /= subdir;
267 return fs::is_empty(pth);
268}
Reference path.
Referenced by clearSubDirs.
isRelative()
iterator()
DirIterator Dir::iterator () |
|
Declaration at line 87 of file dir.h, definition at line 239 of file dir.cpp.
Reference p.
Referenced by readDir.
mkdir()
bool Dir::mkdir (const std::string & path, bool acceptsAbsPath=true) |
|
Declaration at line 93 of file dir.h, definition at line 295 of file dir.cpp.
296{
297 std::error_code ec;
300 {
301 return true;
302 }
303 else
304 {
305 return fs::create_directory(result,ec);
306 }
307}
References exists, filePath and path.
Referenced by PerlModGenerator::createOutputDir, createOutputDirectory, createSubDirs, generateDEF, generateOutput, CitationManager::generatePage, DocbookGenerator::init, HtmlGenerator::init, LatexGenerator::init, ManGenerator::init, RTFGenerator::init, initWarningFormat and parseInput.
path()
Declaration at line 85 of file dir.h, definition at line 234 of file dir.cpp.
235{
236 return p->path.string();
237}
Reference p.
Referenced by cleanDirPath, Dir, exists, filePath, isEmpty, isRelativePath, mkdir, remove, rmdir, setCurrent and setPath.
remove()
bool Dir::remove (const std::string & path, bool acceptsAbsPath=true) |
|
Declaration at line 95 of file dir.h, definition at line 314 of file dir.cpp.
315{
316 std::error_code ec;
318 return fs::remove(result,ec);
319}
References filePath and path.
Referenced by determineInkscapeVersion, exitDoxygen, DocParser::findAndCopyImage, FormulaManager::generateImages, generateOutput, CitationManager::generatePage, getMscImageMapFromFile, openDbConnection, openOutputFile, DocbookDocVisitor::operator(), HtmlDocVisitor::operator(), LatexDocVisitor::operator(), RTFDocVisitor::operator(), RTFGenerator::preProcessFileInplace, resetPDFSize, rmdir, DotFilePatcher::run, runPlantumlContent, stopDoxygen, writeDiaGraphFromFile, writeDotImageMapFromFile, ClassDiagram::writeFigure and writeMscGraphFromFile.
rename()
bool Dir::rename (const std::string & orgName, const std::string & newName, bool acceptsAbsPath=true) |
|
rmdir()
bool Dir::rmdir (const std::string & path, bool acceptsAbsPath=true) |
|
setPath()
void Dir::setPath (const std::string & path) |
|
Private Member Attributes
std::unique_ptr<Private> Dir::p |
|
Definition at line 110 of file dir.h.
110 std::unique_ptr<Private> p;
Referenced by absPath, Dir, Dir, Dir, Dir, exists, filePath, isRelative, iterator, operator=, operator=, path and setPath.
Public Static Functions
cleanDirPath()
std::string Dir::cleanDirPath (const std::string & path) |
|
static
|
currentDirPath()
std::string Dir::currentDirPath () |
|
static
|
Declaration at line 104 of file dir.h, definition at line 340 of file dir.cpp.
341{
342 std::error_code ec;
343 std::string result = fs::current_path(ec).string();
345 return result;
346}
Reference correctPath.
Referenced by Config::checkAndCorrect, Htags::execute, FormulaManager::generateImages, generateOutput, CitationManager::generatePage, parseInput, RTFGenerator::preProcessFileInplace, runHtmlHelpCompiler, runQHelpGenerator, setPerlModDoxyfile, Portable::setShortDir and writeDiaGraphFromFile.
isRelativePath()
bool Dir::isRelativePath (const std::string & path) |
|
static
|
setCurrent()
bool Dir::setCurrent (const std::string & path) |
|
static
|
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus by Doxygen 1.14.0.