tue_filesystem
path.h
Go to the documentation of this file.
1 #ifndef TUE_FILESYSTEM_PATH_H_
2 #define TUE_FILESYSTEM_PATH_H_
3 
6 #include <string>
7 #include <ctime>
8 
9 namespace tue
10 {
11 namespace filesystem
12 {
13 
18 class Path
19 {
20 public:
21 // /** Default constructor, without setting a valid path. */
22  Path();
23 
24 // /**
25 // * Regular constructor
26 // * @param path Path to set.
27 // */
28  Path(const std::string& path);
29 
34  Path(const char* path) : path_(path)
35  {
36  }
37 
39  virtual ~Path();
40 
45  const std::string& string() const
46  {
47  return path_;
48  }
49 
54  std::string extension() const;
55 
61  std::string filename() const;
62 
68  Path parentPath() const;
69 
74  bool exists() const;
75 
81  bool isRegularFile() const;
82 
88  bool isDirectory() const;
89 
95  std::time_t lastWriteTime() const;
96 
102 
107  Path withoutExtension() const;
108 
114  Path join(const Path& path) const;
115 
116 // /** Support printing the path. */
117  friend std::ostream& operator<< (std::ostream& out, const Path& p)
118  {
119  out << p.path_;
120  return out;
121  }
122 
123 private:
125 };
126 
127 } // end filesystem namespace
128 } // end tue namespace
129 
130 #endif
ctime
std::string
tue::filesystem::Path::withoutExtension
Path withoutExtension() const
Definition: path.cpp:72
tue::filesystem::Path
Definition: path.h:18
tue::filesystem::Path::extension
std::string extension() const
Definition: path.cpp:23
tue::filesystem::Path::exists
bool exists() const
Definition: path.cpp:42
tue::filesystem::Path::isDirectory
bool isDirectory() const
Definition: path.cpp:52
std::ostream
tue::filesystem::Path::isRegularFile
bool isRegularFile() const
Definition: path.cpp:47
tue::filesystem::Path::filename
std::string filename() const
Definition: path.cpp:28
tue::filesystem::Path::Path
Path(const char *path)
Definition: path.h:34
std::time_t
tue::filesystem::Path::~Path
virtual ~Path()
Definition: path.cpp:19
tue::filesystem::Path::path_
std::string path_
Text of the file system path.
Definition: path.h:124
tue::filesystem::Path::operator<<
friend std::ostream & operator<<(std::ostream &out, const Path &p)
Definition: path.h:117
tue::filesystem::Path::string
const std::string & string() const
Definition: path.h:45
tue::filesystem::Path::parentPath
Path parentPath() const
Definition: path.cpp:33
tue::filesystem::Path::removeExtension
Path & removeExtension()
Definition: path.cpp:62
tue::filesystem::Path::lastWriteTime
std::time_t lastWriteTime() const
Definition: path.cpp:57
tue
Definition: crawler.h:9
tue::filesystem::Path::Path
Path()
Definition: path.cpp:11
tue::filesystem::Path::join
Path join(const Path &path) const
Definition: path.cpp:85
string