#include <directory.h>
Predicates | |
| bool | has (const String &item) |
| Test if the directory has an item. | |
| bool | isValid () const |
| Test if the directory is valid. | |
| bool | isCurrent () const |
| Test if the directory is the current working directory. | |
| bool | isEmpty () |
| Test if the directory is empty. | |
| bool | operator== (const Directory &directory) const |
| Equality operator. | |
| bool | operator!= (const Directory &directory) const |
| Inequality operator. | |
| String | getUserHomeDir () throw () |
| Get the home directory of the current user. | |
| bool | changeToUserHomeDir () throw () |
| Goto the home directory of the current user. | |
Public Member Functions | |
Constructors and Destructors | |
| Directory () | |
| Default constructor. | |
| Directory (const String &directory_path, bool set_current=false) | |
| Detailed constructor. | |
| Directory (const Directory &directory) | |
| Copy constructor. | |
| ~Directory () | |
| Destructor. | |
| void | clear () |
| Explicit default initialization. | |
| void | destroy () |
| Explicit destructor. | |
Assignment | |
| bool | set (const String &directory_path, bool set_current=false) |
Assign the Directory with the path directory_path. | |
| void | set (const Directory &directory) |
| Assignment with cloning facility. | |
| Directory & | operator= (const Directory &directory) |
| Assignment operator. | |
| void | get (Directory &directory) const |
| Copying with cloning facility. | |
Accessors | |
| const String & | getPath () const |
| Get the path of this instance. | |
| bool | rename (String old_path, String new_path) |
| Rename a given directory. | |
| bool | renameTo (String new_path) |
| Rename the directory associated with this object. | |
| bool | setCurrent (String directory_path) |
| Set a directory as the current. | |
| bool | setCurrent () |
| Set this directory as the current working directory. | |
| bool | create (String path, const mode_t &mode=0777) |
| Create a new directory. | |
| bool | remove (String old_path) |
| Remove a directory. | |
| bool | remove () |
| Remove this directory. | |
| bool | getFirstEntry (String &entry) |
| Get the name of the first entry in the directory. | |
| bool | getNextEntry (String &entry) |
| Get the name of the next entry in the directory. | |
| Size | countItems () |
| Count all items in the directory. | |
| Size | countFiles () |
| Count the files in the directory. | |
| Size | countDirectories () |
| Count the subdirectories in the directory. | |
| bool | find (const String &filename, String &filepath) |
| Find a file in the directory. | |
Static Public Attributes | |
Constants | |
| const Size | MAX_PATH_LENGTH |
| The maximum length of a path. | |
|
|
Default constructor. Constructs new Directory object. The directory path is set to the current working directory. The directory path does not have a path seperator {"/"} at its end. |
|
||||||||||||
|
Detailed constructor. Construct new Directory object from {directory_path}. The directory path does not have a path seperator {"/"} at its end. If the given directory does not exists, the directory path is set to an empty string.
|
|
|
Copy constructor. Construct new Directory object by copying directory .
|
|
|
Destructor.
|
|
|
Explicit default initialization. Set the state to the default values. The path is set to an empty string. |
|
|
Count the subdirectories in the directory.
|
|
|
Count the files in the directory.
|
|
|
Count all items in the directory.
|
|
||||||||||||
|
Create a new directory. The directory is created using an absolute path, if it starts with a path seperator, else it is created in this directory.
|
|
|
Explicit destructor.
|
|
||||||||||||
|
Find a file in the directory. The search is recursive.
|
|
|
Copying with cloning facility. Copy this instance to directory .
|
|
|
Get the name of the first entry in the directory.
|
|
|
Get the name of the next entry in the directory.
|
|
|
Get the path of this instance. The directory path does not have a path seperator {"/"} at its end and is absolute. If a unvalid path was set the path is an empty string.
|
|
|
Test if the directory has an item.
|
|
|
Test if the directory is the current working directory.
|
|
|
Test if the directory is empty.
|
|
|
Test if the directory is valid. The directory is valid if it exists. This function uses ::opendir(const char *dirname).
|
|
|
Inequality operator.
|
|
|
Assignment operator. Assign directory to this instance. |
|
|
Equality operator.
|
|
|
Remove this directory. The directory this object points to is deleted and the object is cleared.
|
|
|
Remove a directory. With this method the directory associated with this object can not be removed. Use remove() instead to do so.
|
|
||||||||||||
|
Rename a given directory. With this method the directory associated with this object can not be renamed. Use renameTo instead to do so.
|
|
|
Rename the directory associated with this object.
|
|
|
Assignment with cloning facility.
Assign the Directory
|
|
||||||||||||
|
Assign the Directory with the path The given directory path can be either absolute or relative. If the path starts with a path seperator it is set as a absolute path.
|
|
|
Set this directory as the current working directory.
|
|
|
Set a directory as the current.
|
|
|
The maximum length of a path. This constant is used for system calls that require a maximum length (e.g., getcwd()). Default is 8192. |