Rudiments
|
Public Member Functions | |
directory () | |
~directory () | |
bool | open (const char *path) |
bool | close () |
void | rewind () |
uint64_t | getChildCount () |
char * | getChildName (uint64_t index) |
int64_t | maxFileNameLength () |
int64_t | maxPathLength () |
bool | canAccessLongFileNames () |
Static Public Member Functions | |
static bool | create (const char *path, mode_t perms) |
static bool | remove (const char *path) |
static char * | getCurrentWorkingDirectory () |
static bool | changeDirectory (const char *path) |
static bool | changeRoot (const char *path) |
static int64_t | maxFileNameLength (const char *pathname) |
static int64_t | maxPathLength (const char *pathname) |
static bool | canAccessLongFileNames (const char *pathname) |
static bool | needsMutex () |
static void | setMutex (mutex *mtx) |
The directory class provides methods for opening/closing a directory and traversing it's files and subdirectories.
directory::directory | ( | ) |
Creates an instance of the directory class.
directory::~directory | ( | ) |
Deletes this instance of the directory class.
bool directory::canAccessLongFileNames | ( | ) |
Returns true if an attempt to access a file in directory "pathname" longer than the length returned by maxFileNameLength() will succeed or false if it will fail.
static bool directory::canAccessLongFileNames | ( | const char * | pathname | ) | [static] |
Returns true if an attempt to access a file in directory "pathname" longer than the length returned by maxFileNameLength() will succeed or false if it will fail.
static bool directory::changeDirectory | ( | const char * | path | ) | [static] |
Sets the current working directory to "path".
static bool directory::changeRoot | ( | const char * | path | ) | [static] |
Changes root to "path".
bool directory::close | ( | ) |
Closes the currently open directory.
static bool directory::create | ( | const char * | path, |
mode_t | perms | ||
) | [static] |
Creates a new directory "path" with permissions "perms".
uint64_t directory::getChildCount | ( | ) |
Returns the number of files/subdirectories inside the open directory.
char* directory::getChildName | ( | uint64_t | index | ) |
Returns the name of the file/subdirectory at "index".
This methods allocates a buffer internally and returns it. The calling program must deallocate the buffer.
static char* directory::getCurrentWorkingDirectory | ( | ) | [static] |
Returns the current working directory.
This methods allocates a buffer internally and returns it. The calling program must deallocate the buffer.
int64_t directory::maxFileNameLength | ( | ) |
Returns the length of the longest file name that can be created in directory "pathname".
static int64_t directory::maxFileNameLength | ( | const char * | pathname | ) | [static] |
Returns the length of the longest file name that can be created in directory "pathname".
int64_t directory::maxPathLength | ( | ) |
Returns the length of the longest relative path name that can be created under the directory "pathname".
static int64_t directory::maxPathLength | ( | const char * | pathname | ) | [static] |
Returns the length of the longest relative path name that can be created under the directory "pathname".
static bool directory::needsMutex | ( | ) | [static] |
This method returns true if this class needs a mutex to operate safely in a threaded environment and false otherwise.
bool directory::open | ( | const char * | path | ) |
Opens directory "path".
static bool directory::remove | ( | const char * | path | ) | [static] |
Removes the directory "path", if it is empty.
void directory::rewind | ( | ) |
Resets the current file/subdirectory inside the open directory to the first one.
static void directory::setMutex | ( | mutex * | mtx | ) | [static] |
Allows you to supply a mutex is the class needs it. If your application is not multithreaded, then there is no need to supply a mutex.