Ocular Engine
File.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_CORE_FILEIO_FILE__H__
19 #define __H__OCULAR_CORE_FILEIO_FILE__H__
20 
21 #include "Utilities/Types.hpp"
22 #include <string>
23 
24 //------------------------------------------------------------------------------------------
25 
30 namespace Ocular
31 {
36  namespace Core
37  {
41  class File
42  {
43  public:
44 
48  File(std::string const fullPath = "");
49  ~File();
50 
54  void setPath(std::string const fullPath);
55 
59  void refresh();
60 
64  bool exists() const;
65 
69  bool canRead() const;
70 
74  bool canWrite() const;
75 
79  bool isFile() const;
80 
84  bool isDirectory() const;
85 
89  bool isSymLink() const;
90 
94  bool isAbsolute() const;
95 
99  unsigned getSize() const;
100 
110  std::string getFullPath() const;
111 
121  std::string getName() const;
122 
132  std::string getExtension() const;
133 
143  std::string getDirectory() const;
144 
148  time_t getLastModifiedTime() const;
149 
156  void formatForSystem();
157 
164  virtual bool create(bool createDirectories = false);
165 
166  protected:
167 
168  bool m_IsReal;
169  bool m_IsReadable;
170  bool m_IsWritable;
171  bool m_IsFile;
172  bool m_IsDirectory;
173  bool m_IsSymLink;
174  bool m_IsAbsolute;
175 
176  unsigned m_FileSize;
177 
178  std::string m_FullPath;
179  std::string m_Name;
180  std::string m_Extension;
181  std::string m_Directory;
182 
183  private:
184  };
185  }
189 }
194 OCULAR_REGISTER_TYPE_CUSTOM(Ocular::Core::File, "File");
195 
196 //------------------------------------------------------------------------------------------
197 
198 #endif
File(std::string const fullPath="")
Definition: File.cpp:76
bool exists() const
Definition: File.cpp:166
bool isAbsolute() const
Definition: File.cpp:196
time_t getLastModifiedTime() const
Definition: File.cpp:226
bool canRead() const
Definition: File.cpp:171
unsigned getSize() const
Definition: File.cpp:201
std::string getExtension() const
Definition: File.cpp:216
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
void formatForSystem()
Definition: File.cpp:239
bool canWrite() const
Definition: File.cpp:176
bool isDirectory() const
Definition: File.cpp:186
std::string getName() const
Definition: File.cpp:211
bool isFile() const
Definition: File.cpp:181
void refresh()
Definition: File.cpp:114
Definition: File.hpp:41
std::string getDirectory() const
Definition: File.cpp:221
virtual bool create(bool createDirectories=false)
Definition: File.cpp:250
bool isSymLink() const
Definition: File.cpp:191
std::string getFullPath() const
Definition: File.cpp:206
void setPath(std::string const fullPath)
Definition: File.cpp:108