Doxygen
fileinfo.h
浏览该文件的文档.
1 /******************************************************************************
2  *
3  * Copyright (C) 1997-2021 by Dimitri van Heesch.
4  *
5  * Permission to use, copy, modify, and distribute this software and its
6  * documentation under the terms of the GNU General Public License is hereby
7  * granted. No representations are made about the suitability of this software
8  * for any purpose. It is provided "as is" without express or implied warranty.
9  * See the GNU General Public License for more details.
10  *
11  * Documents produced by Doxygen are derivative works derived from the
12  * input used in their production; they are not affected by this license.
13  *
14  */
15 
16 #ifndef FILEINFO_H
17 #define FILEINFO_H
18 
19 #include <string>
20 
21 /** @brief Minimal replacement for QFileInfo. */
22 class FileInfo
23 {
24  public:
25  explicit FileInfo(const std::string &name) : m_name(name) {}
26  bool exists() const;
27  size_t size() const;
28  bool isWritable() const;
29  bool isReadable() const;
30  bool isExecutable() const;
31  bool isRelative() const;
32  bool isFile() const;
33  bool isDir() const;
34  bool isSymLink() const;
35  std::string readLink() const;
36  std::string filePath() const;
37  std::string absFilePath() const;
38  std::string fileName() const;
39  std::string baseName() const;
40  std::string extension(bool complete) const;
41  std::string dirPath(bool absPath = true) const;
42  private:
43  static void correctPath(std::string &s);
44  std::string m_name;
45 };
46 
47 #endif
FileInfo::m_name
std::string m_name
Definition: fileinfo.h:57
FileInfo::FileInfo
FileInfo(const std::string &name)
Definition: fileinfo.h:38
FileInfo::extension
std::string extension(bool complete) const
Definition: fileinfo.cpp:130
FileInfo::isFile
bool isFile() const
Definition: fileinfo.cpp:63
FileInfo::correctPath
static void correctPath(std::string &s)
Definition: fileinfo.cpp:96
FileInfo::baseName
std::string baseName() const
Definition: fileinfo.cpp:123
FileInfo::isRelative
bool isRelative() const
Definition: fileinfo.cpp:58
FileInfo::size
size_t size() const
Definition: fileinfo.cpp:23
FileInfo::exists
bool exists() const
Definition: fileinfo.cpp:30
FileInfo::readLink
std::string readLink() const
Definition: fileinfo.cpp:84
FileInfo::isDir
bool isDir() const
Definition: fileinfo.cpp:70
FileInfo::isSymLink
bool isSymLink() const
Definition: fileinfo.cpp:77
FileInfo::filePath
std::string filePath() const
Definition: fileinfo.cpp:91
FileInfo::isExecutable
bool isExecutable() const
Definition: fileinfo.cpp:51
FileInfo::dirPath
std::string dirPath(bool absPath=true) const
Definition: fileinfo.cpp:137
FileInfo
Minimal replacement for QFileInfo.
Definition: fileinfo.h:22
FileInfo::absFilePath
std::string absFilePath() const
Definition: fileinfo.cpp:101
FileInfo::isWritable
bool isWritable() const
Definition: fileinfo.cpp:37
FileInfo::isReadable
bool isReadable() const
Definition: fileinfo.cpp:44
FileInfo::fileName
std::string fileName() const
Definition: fileinfo.cpp:118