libcommonc++
0.7
|
A file search path. More...
#include <SearchPath.h++>
Public Member Functions | |
SearchPath (const String &path="") | |
Construct a new SearchPath for the given path string. More... | |
SearchPath (const SearchPath &other) | |
Copy constructor. More... | |
~SearchPath () | |
Destructor. More... | |
SearchPath & | operator= (const SearchPath &other) |
Assignment operator. More... | |
void | append (const String &dir) |
Append a directory to the end of the path. More... | |
void | prepend (const String &dir) |
Prepend a directory to the beginning of the path. More... | |
void | remove (const String &dir) |
Remove a directory from the path. More... | |
void | clear () |
Clear the path. More... | |
bool | contains (const String &dir) const |
Determine if the path contains a directory. More... | |
bool | find (FileName &file) const |
Search the path for a file. More... | |
bool | isEmpty () const |
Test if the path is empty. More... | |
size_t | getDirectoryCount () const |
Get the number of directories in the search path. More... | |
size_t | length () const |
Get the number of directories in the search path. More... | |
String | getDirectory (int index) const |
Get the directory at the specified index in the search path. More... | |
String | operator[] (int index) const |
Get the directory at the specified index in the search path. More... | |
String | getPath () const |
Get the path as a String. More... | |
void | fromString (const String &path) |
Parse a SearchPath from a String representation. More... | |
String | toString () const |
Get a String representation of the SearchPath. More... | |
Static Public Attributes | |
static const SearchPath | empty |
An empty SearchPath. More... | |
static const char * | separator = PS |
The host platform's path separator. More... | |
A file search path.
A search path is a series of directories (typically specified as absolute paths) that may be searched to locate a file given its filename.
SearchPath | ( | const String & | path = "" | ) |
Construct a new SearchPath for the given path string.
path | The path. |
SearchPath | ( | const SearchPath & | other | ) |
Copy constructor.
~SearchPath | ( | ) |
Destructor.
void append | ( | const String & | dir | ) |
Append a directory to the end of the path.
If the directory is already in the path, the path will be unchanged.
dir | The directory. |
void clear | ( | ) |
Clear the path.
Removes all directories from the path.
bool contains | ( | const String & | dir | ) | const |
Determine if the path contains a directory.
dir | The directory to search for. |
bool find | ( | FileName & | file | ) | const |
Search the path for a file.
file | The name of the file to search for. |
void fromString | ( | const String & | path | ) |
Parse a SearchPath from a String representation.
String getDirectory | ( | int | index | ) | const |
Get the directory at the specified index in the search path.
OutOfBoundsException | If the index is invalid. |
|
inline |
Get the number of directories in the search path.
Equivalent to length().
String getPath | ( | ) | const |
Get the path as a String.
|
inline |
Test if the path is empty.
|
inline |
Get the number of directories in the search path.
SearchPath & operator= | ( | const SearchPath & | other | ) |
Assignment operator.
|
inline |
Get the directory at the specified index in the search path.
OutOfBoundsException | If the index is invalid. |
void prepend | ( | const String & | dir | ) |
Prepend a directory to the beginning of the path.
If the directory is already in the path, the path will be unchanged.
dir | The directory. |
void remove | ( | const String & | dir | ) |
Remove a directory from the path.
If the directory is not in the path, the method does nothing.
|
inline |
Get a String representation of the SearchPath.
Equivalent to getPath().
|
static |
An empty SearchPath.
|
static |
The host platform's path separator.