#include <cascade/util/CascadeFSObject.h>
Inheritance diagram for CascadeFSObject:
Public Types | |
enum | FSCopyError { eFSCopyNoErr, eFSCopyCanceled, eFSCopyUnknownErr, eFSCopyDestExists, eFSCopyCantOpenSrc, eFSCopyCantCreateDest, eFSCopyCantOpenDest, eFSCopyReadSrcFailed, eFSCopyWriteDstFailed, eFSCopyDestIsSrc, eFSCopyDestInsideSrc, eFSCopyInsufficientSpace, eFSCopyBadParam, eFSCopyPermissionErr } |
Public Member Functions | |
CascadeFSObject () | |
CascadeFSObject (const char *pName) | |
virtual | ~CascadeFSObject () |
virtual CascadeString | GetName (void) const |
virtual bool | SetName (const char *inName) |
virtual CascadeString | GetFullPath (void) const |
virtual CascadeString | GetFilenameExtension (void) const |
virtual CascadeFSObject * | GetParent (void) const |
virtual bool | IsDirectory (void) const =0 |
virtual bool | Exists (void) const |
virtual bool | IsRoot (void) const |
Static Public Member Functions | |
static bool | Exists (const CascadeString &inPath) |
static bool | IsDirectory (const CascadeString &inPath) |
Protected Attributes | |
void * | m_pFSObjInternal |
CascadeString | m_fullPath |
Classes | |
class | PermissionsSelector |
Selector object which uses file permissions to determine match More... | |
class | RegexpSelector |
Selector object which uses a regular expression test on the object name. More... | |
class | Selector |
abstract base class for selectors passed into CascadeDirectory enumration functions. CascadeFSObject::Selector is an abstract base class used to define objects which select the desired files when using the directory enumeration functions in CascadeDirectory. More... | |
class | TypeSelector |
Selector object which selects files, folders or both More... |
CascadeFSObject represents an object in the filesystem, whether it be a file or directory. It provides for the setting and getting of the object's name and/or full path, as well as some utility tests for whether the object exists, is a directory, or is the root directory. This allows, for example, an application to enumerate the contents of a directory into a list CascadeFSObjects, then use the IsDirectory() test to cast specific elements to a CascadeFile or CascadeDirectory object, using dynamic_cast
.
This class includes a sub-class called Selector. This object is used with CascadeDirectory to filter the contents of a directory. Two basic selectors are provided as well: one which filters based upon the name, using regular expressions, and one which filters based upon permissions.
|
|
|
default constructor Create a CascadeFSObject that doesn't yet point to anything in the filesystem. (Note that this class is pure virtual, so the construcor does common default initialization for base classes. When constructing one of those sub-class objects without a name, you will need to call SetName to bind it to a real filesystem object. |
|
parameterized constructor Create a CascadeFSObject pointing to an object in the hierarchy. The object need not already exist -- the sub-class objects have functions to create the objects. (Note that this class is pure virtual, so this constructor performs common default initialization for the derived classes.)
|
|
destructor Destructor. |
|
test for existence of path Static utility function returns true if there is something at the path specified.
|
|
test for existence of this object Returns true if the object exists, or false otherwise. CascadeFile and CascadeDirectory objects have facilities to create filesystem objects that don't already exist.
|
|
get the object's filename extension Returns the filename extension of this object, not including the '.' character. i.e. a CascadeFile object pointing to /usr/local/bin/foo.bar will return "bar". In the case that a name contains more than one '.', the portion following the last one is treated as the extension. An initial '.' is ignored. Note that no length constraint is enforced, so "a.reallylongextension" will yield "reallylongextension". Returns an empty string (which must still be deleted) if there is no extension, or if the filename ends in the '.' character. The function will work on directories as well, so if you wish to exclude directories be sure to call IsDirectory() first.
|
|
get the object's full path Returns the complete path of this object, including the object's name itself. i.e. a CascadeFile object pointing to /usr/local/bin/vi will return "/usr/local/bin/vi". A CascadeDirectory pointing to /usr/local/bin will return "/usr/local/bin"
|
|
gets the object's name
Returns the name of this object. For example, a CascadeFile object pointing to "/usr/local/bin/vi" would return "vi", and a CascadeDirectory object pointing to "/usr/local/bin" would return "bin" (no trailing slash). Analogous to the
|
|
returns a new CascadeFSObject representing this one's parent Returns the container of this object. You should be able to dynamic_cast the result to a CascadeDirectory if you want to use directory features.
|
|
test whether path points to directory Static utility function returns true if the path is valid and points to a directory
|
|
test whether this object is a directory Returns true if this object is a directory, false otherwise. Note that this is a pure virtual function; all subclasses must override and implement this function.
Implemented in CascadeDirectory, and CascadeFile. |
|
test for root Returns true if the object is the root directory. Returns false if the directory object hasn't had its name set yet, or if it's not the root.
|
|
sets the object's name or full path Set the name of this CascadeFSObject. The corresponding object in the filesystem need not exist. Note that a leading slash will cause the submitted string to be treated as a full path. Otherwise, it will be treated as a name or path relative to the current working directory. Returns false in the case of a failure (unlikely, except for out-of-memory).
Reimplemented in CascadeFile. |
|
|
|
|