Athena IO Library
FileInfo.hpp
1 #ifndef FILEINFO_HPP
2 #define FILEINFO_HPP
3 
4 #include <string>
5 
6 #include "Athena/Global.hpp"
7 
8 namespace Athena
9 {
10 class FileInfo
11 {
12 public:
13  explicit FileInfo(const std::string& path = std::string());
14 
15  std::string absolutePath() const;
16  static inline std::string absolutePath(const std::string& lnk)
17  { return FileInfo(lnk).absolutePath(); }
18 
19  std::string absoluteFilePath() const;
20  static inline std::string absoluteFilePath(const std::string& path)
21  { return FileInfo(path).absoluteFilePath(); }
22 
23  std::string filename() const;
24  static inline std::string filename(const std::string path)
25  { return FileInfo(path).filename(); }
26 
27  std::string path() const;
28  static inline std::string path(const std::string path)
29  { return FileInfo(path).path(); }
30 
31  std::string extension() const;
32  static inline std::string extension(const std::string path)
33  { return FileInfo(path).extension(); }
34 
35  atUint64 size() const;
36  static inline atUint64 size(const std::string path)
37  { return FileInfo(path).size(); }
38 
39  bool exists() const;
40  static inline bool exists(const std::string& path)
41  { return FileInfo(path).exists(); }
42 
43  bool isLink() const;
44  static inline bool isLink(const std::string& lnk)
45  { return FileInfo(lnk).isLink(); }
46  bool isFile() const;
47  static inline bool isFile(const std::string& path)
48  { return FileInfo(path).isFile(); }
49 
50  bool touch() const;
51  static inline bool touch(const std::string& path)
52  { return FileInfo(path).touch(); }
53 
54 private:
55  std::string m_path;
56 };
57 }
58 
59 #endif // FILEINFO_HPP