|
|
@@ -42,41 +42,61 @@ namespace CodeDweller { |
|
|
|
|
|
|
|
/** Initialize with the name of the file. |
|
|
|
|
|
|
|
The constructor updates the FileReference object with the file |
|
|
|
status except for the full path. |
|
|
|
|
|
|
|
@param[in] fileName is the name of the file. |
|
|
|
|
|
|
|
*/ |
|
|
|
FileReference(std::string fileName); |
|
|
|
|
|
|
|
/** Return timestamp. |
|
|
|
|
|
|
|
@returns the epoch modification time for file when |
|
|
|
FileReference was created or last refreshed, or zero if the |
|
|
|
file doesn't exist. |
|
|
|
@returns the epoch modification time of the file if the file |
|
|
|
existed when the FileReference object was created, or the last |
|
|
|
time refersh() was called (whichever is more recent), 0 |
|
|
|
otherwise. |
|
|
|
|
|
|
|
*/ |
|
|
|
time_t ModTimestamp() const; |
|
|
|
|
|
|
|
/** Get the file size. |
|
|
|
|
|
|
|
@returns the size of file when FileReference was created or |
|
|
|
last refreshed, or 0 if the file doesn't exist. |
|
|
|
@returns the size of the file if the file existed when the |
|
|
|
FileReference object was created, or the last time refersh() |
|
|
|
was called (whichever is more recent), 0 otherwise. |
|
|
|
|
|
|
|
*/ |
|
|
|
size_t Size() const; |
|
|
|
|
|
|
|
/** Get full path. |
|
|
|
/** Get full path if the file exists. |
|
|
|
|
|
|
|
This method access the filesystem to get the full path of the |
|
|
|
file. |
|
|
|
|
|
|
|
@returns a fully referenced path to the file. |
|
|
|
@warning This method might fail under Windows in a |
|
|
|
multi-threaded application if the current working directory of |
|
|
|
the application is being changed by a thread while this method |
|
|
|
is invoked. |
|
|
|
|
|
|
|
@returns a fully referenced path to the file if the file |
|
|
|
exists. Otherwise, "" is returned. |
|
|
|
*/ |
|
|
|
std:: string FullPath() const; |
|
|
|
std:: string FullPath(); |
|
|
|
|
|
|
|
/** Refreshes the FileReference object. |
|
|
|
|
|
|
|
/** Refreshes the FileReference object with the current data on the file |
|
|
|
system. |
|
|
|
This method updates the FileReference object with the current |
|
|
|
data on the file system, except for the full path. |
|
|
|
*/ |
|
|
|
void refresh(); |
|
|
|
|
|
|
|
/** Check if the file exists. |
|
|
|
|
|
|
|
@returns true if the file reference name exists in the file |
|
|
|
system, false otherwise. |
|
|
|
@returns true if the file reference name existed in the file |
|
|
|
system when the FileReference object was created, or the last |
|
|
|
time refersh() was called (whichever is more recent), false |
|
|
|
otherwise. |
|
|
|
|
|
|
|
@throws std::runtime_error if an error occurs. |
|
|
|
|
|
|
@@ -85,9 +105,11 @@ namespace CodeDweller { |
|
|
|
|
|
|
|
/** Check if the file is a directory. |
|
|
|
|
|
|
|
@returns true if the name provided on construction resulted in |
|
|
|
finding a directory not a file, and false otherwise or if the |
|
|
|
file doesn't exist. |
|
|
|
@returns true if the file reference name existed and was a |
|
|
|
directory in the file system when the FileReference object was |
|
|
|
created, or the last time refersh() was called (whichever is |
|
|
|
more recent), false otherwise. |
|
|
|
|
|
|
|
*/ |
|
|
|
bool isDirectory() const; |
|
|
|
|
|
|
@@ -99,7 +121,7 @@ namespace CodeDweller { |
|
|
|
// |
|
|
|
static std::string getErrorText(); |
|
|
|
|
|
|
|
/// Reset all members but the name and path. */ |
|
|
|
/// Reset all members but the name. */ |
|
|
|
void reset(); |
|
|
|
|
|
|
|
/** Name provided to constructor. */ |