Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

FilePath Class Reference

Inheritance diagram for FilePath:

IWritable MutableFilePath List of all members.

Public Member Functions

 this (FilePath other)
 this (Uri uri)
 this (char[] filepath)
bool isAbsolute ()
char[] getRoot ()
char[] getPath ()
char[] getName ()
char[] getExtension ()
char[] getSuffix ()
char[] toString ()
MutableUri toUri ()
void write (IWriter writer)
char * toStringZ ()
char[] splice (FilePath base)
IBuffer splice (FilePath base, IBuffer buf)
FilePath toParent ()
bool isChild ()
FilePath toSibling (char[] name)
FilePath toSibling (char[] name, char[] ext)
FilePath toSibling (char[] name, char[] ext, char[] suffix)

Protected Member Functions

 this ()

Private Member Functions

int locateParent ()

Private Attributes

char[] fp
char[] ext
char[] name
char[] path
char[] root
char[] suffix

Static Private Attributes

const int MaxFilePathSize = 1024

Detailed Description

Models a file name. These are expected to be used as the constructor argument to File implementations. The intention is that they easily convert to other representations such as absolute, canonical, or Url. Note that this class is immutable. Use MutableFilePath if you wish to alter specific attributes.

Definition at line 59 of file FilePath.d.


Member Function Documentation

this  )  [inline, protected]
 

Create an empty FilePath. This is strictly for subclass use.

Reimplemented in MutableFilePath.

Definition at line 81 of file FilePath.d.

this FilePath  other  )  [inline]
 

Create a FilePath through reference to another.

Reimplemented in MutableFilePath.

Definition at line 91 of file FilePath.d.

this Uri  uri  )  [inline]
 

Create a FilePath from a Uri. Note that the Uri authority is used to house an optional root (device, drive-letter ...)

Definition at line 110 of file FilePath.d.

this char[]  filepath  )  [inline]
 

Create a FilePath from the given string. Note the path is not duplicated here, so you are expected to provide an immutable copy for the lifetime of this object.

If you're not certain, duplicate the path first.

Definition at line 130 of file FilePath.d.

bool isAbsolute  )  [inline]
 

Returns true if this FilePath is *not* relative to the current working directory.

Definition at line 215 of file FilePath.d.

References root.

char [] getRoot  )  [inline]
 

Return the root of this path. Roots are constructs such as "c:".

Definition at line 229 of file FilePath.d.

References root.

char [] getPath  )  [inline]
 

Return the file path. Paths start with a '/' but do not end with one. The root path is empty. Directory paths are split such that the directory name is placed into the 'name' member.

Definition at line 243 of file FilePath.d.

char [] getName  )  [inline]
 

Return the name of this file, or directory.

Definition at line 254 of file FilePath.d.

Referenced by testScanFiles().

char [] getExtension  )  [inline]
 

Return the file-extension, sans seperator

Definition at line 265 of file FilePath.d.

Referenced by ServletResponse::copyFile(), and testScanFiles().

char [] getSuffix  )  [inline]
 

Suffix is like extension, except it can include multiple '.' sequences. For example, "wumpus1.foo.bar" has suffix "foo.bar" and extension "bar".

Definition at line 278 of file FilePath.d.

References suffix.

char [] toString  )  [inline]
 

Convert this FilePath to a char[]. This is expected to execute optimally in most cases.

Definition at line 290 of file FilePath.d.

References IBuffer::append(), Buffer::append(), Buffer, ext, fp, MaxFilePathSize, root, version, and write().

Referenced by FileBucket::Record::eof(), FileProxy::VersionWin32::toList(), FileProxy::toString(), and toStringZ().

MutableUri toUri  )  [inline]
 

Convert this FilePath to a Uri. Note that a root (such as a drive-letter, or device) is placed into the Uri authority

Definition at line 325 of file FilePath.d.

References ext, root, MutableUri::setHost(), MutableUri::setPath(), MutableUri::setScheme(), and version.

Referenced by testFilePath().

void write IWriter  writer  )  [inline]
 

Write this FilePath to the given IWriter. This makes the FilePath compatible with all Writers

Reimplemented from IWritable.

Definition at line 352 of file FilePath.d.

References ext, IWriter::put(), and root.

Referenced by toString().

char* toStringZ  )  [inline]
 

Return a zero terminated version of this file path. Note that the compiler places a zero at the end of each static string, as does the allocator for char[] requests.

In typical usage, this will not need to duplicate the path

Definition at line 377 of file FilePath.d.

References toString().

Referenced by FileConduit::Versionlinux::_open(), FileConduit::VersionWin32::_open(), FileProxy::Versionlinux::createDirectory(), FileProxy::VersionWin32::createDirectory(), FileProxy::Versionlinux::createFile(), FileProxy::VersionWin32::createFile(), FileProxy::Versionlinux::getInfo(), FileProxy::VersionWin32::getInfo(), FileProxy::Versionlinux::remove(), FileProxy::VersionWin32::remove(), FileSystem::Versionlinux::setDirectory(), FileSystem::VersionWin32::setDirectory(), and FileProxy::Versionlinux::toList().

char [] splice FilePath  base  )  [inline]
 

Splice this FilePath onto the end of the provided base path. Output is return as a char[].

Definition at line 401 of file FilePath.d.

References Buffer, and MaxFilePathSize.

IBuffer splice FilePath  base,
IBuffer  buf
[inline]
 

Splice this FilePath onto the end of the provided base path. Output is placed into the provided IBuffer.

Definition at line 413 of file FilePath.d.

References IBuffer::append(), ext, name, path, and root.

int locateParent  )  [inline, private]
 

Find the next parent of the FilePath. Returns a valid index to the seperator when present, -1 otherwise.

Definition at line 443 of file FilePath.d.

Referenced by toParent().

FilePath toParent  )  [inline]
 

Returns a FilePath representing the parent of this one. An exception is thrown if there is not parent (at the root).

Definition at line 462 of file FilePath.d.

References FilePath, fp, locateParent(), and path.

bool isChild  )  [inline]
 

Returns true if this FilePath has a parent.

Definition at line 487 of file FilePath.d.

FilePath toSibling char[]  name  )  [inline]
 

Return a cloned FilePath with a different name.

Definition at line 498 of file FilePath.d.

Referenced by toSibling().

FilePath toSibling char[]  name,
char[]  ext
[inline]
 

Return a cloned FilePath with a different name and extension. Note that the suffix is destroyed.

Definition at line 510 of file FilePath.d.

References toSibling().

FilePath toSibling char[]  name,
char[]  ext,
char[]  suffix
[inline]
 

Return a cloned FilePath with a different name, extension, and suffix.

Definition at line 522 of file FilePath.d.

References FilePath, and fp.


Member Data Documentation

char [] fp [private]
 

Definition at line 61 of file FilePath.d.

Referenced by toParent(), toSibling(), and toString().

char [] ext [private]
 

Definition at line 61 of file FilePath.d.

Referenced by splice(), toString(), toUri(), and write().

char [] name [private]
 

Definition at line 61 of file FilePath.d.

Referenced by splice().

char [] path [private]
 

Definition at line 61 of file FilePath.d.

Referenced by splice(), and toParent().

char [] root [private]
 

Definition at line 61 of file FilePath.d.

Referenced by getRoot(), isAbsolute(), splice(), toString(), toUri(), and write().

char [] suffix [private]
 

Definition at line 61 of file FilePath.d.

Referenced by getSuffix().

const int MaxFilePathSize = 1024 [static, private]
 

Definition at line 71 of file FilePath.d.

Referenced by splice(), and toString().


The documentation for this class was generated from the following file:
Generated on Sun Oct 24 22:31:24 2004 for Mango by doxygen 1.3.6