Ocular Engine
|
Public Member Functions | |
File (std::string const fullPath="") | |
void | setPath (std::string const fullPath) |
void | refresh () |
bool | exists () const |
bool | canRead () const |
bool | canWrite () const |
bool | isFile () const |
bool | isDirectory () const |
bool | isSymLink () const |
bool | isAbsolute () const |
unsigned | getSize () const |
std::string | getFullPath () const |
std::string | getName () const |
std::string | getExtension () const |
std::string | getDirectory () const |
time_t | getLastModifiedTime () const |
void | formatForSystem () |
virtual bool | create (bool createDirectories=false) |
Ocular::Core::File::File | ( | std::string const | fullPath = "" | ) |
Providing an empty string sets the current path to that of the current working directory.
bool Ocular::Core::File::canRead | ( | ) | const |
Returns whether the file at the specified path can be read from.
bool Ocular::Core::File::canWrite | ( | ) | const |
Returns whether the file at the specified path can be written to.
|
virtual |
Attempts to create the file if it does not already exist.
[in] | createDirectories | If TRUE, creates all necessary parent directories that do not already exist. |
Reimplemented in Ocular::Core::Directory.
bool Ocular::Core::File::exists | ( | ) | const |
Returns whether the object (file, directory, or symlink) at the specified path exists.
void Ocular::Core::File::formatForSystem | ( | ) |
Ensures that all path-separators are the same.
On Windows, the '\' separator is used.
On Linux-based systems, the '/' separator is used.
std::string Ocular::Core::File::getDirectory | ( | ) | const |
Returns the directory path of the file. Example:
/path/to/file/AFile.txt
Returns "/path/to/file"
std::string Ocular::Core::File::getExtension | ( | ) | const |
Returns the extension of the file. Example:
/path/to/file/AFile.txt
Returns ".txt"
std::string Ocular::Core::File::getFullPath | ( | ) | const |
Returns the full specified path of the file. Example:
/path/to/file/AFile.txt
Returns "/path/to/file/AFile.txt"
time_t Ocular::Core::File::getLastModifiedTime | ( | ) | const |
Returns the epoch time (in seconds) of the last write action to the file.
std::string Ocular::Core::File::getName | ( | ) | const |
Returns the name of the file. Example:
/path/to/file/AFile.txt
Returns "AFile"
unsigned Ocular::Core::File::getSize | ( | ) | const |
Returns the size of the file in bytes.
bool Ocular::Core::File::isAbsolute | ( | ) | const |
Returns whether the specified path is an absolute path.
bool Ocular::Core::File::isDirectory | ( | ) | const |
Returns whether the object at the specified path is a directory.
bool Ocular::Core::File::isFile | ( | ) | const |
Returns whether the object at the specified path is a file.
bool Ocular::Core::File::isSymLink | ( | ) | const |
Returns whether the object at the specified path is a symbolic link.
void Ocular::Core::File::refresh | ( | ) |
Refreshes all information about the file.
void Ocular::Core::File::setPath | ( | std::string const | fullPath | ) |
Sets the path to the file object.