Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Member Functions | List of all members
om::fs::Path Class Reference

A class representing a path to a file or directory in the local file system (not networked, etc). More...

#include <omPath.h>

Public Member Functions

 Path ()
 Create a path corresponding to the root directory. More...
 
 Path (const Char *newPathString)
 Create a path from the specified NULL-terminated path string. More...
 
 Path (const UTF8String &newPathString)
 Create a path from the specified path string. More...
 
 Path (const Path &path, const Path &children)
 Create a path from an existing path plus the child path specified in the second parameter. More...
 
 Path (const Path &path, const UTF8String &children)
 Create a path from an existing path plus the child path string specified in the second parameter. More...
 
Bool operator== (const Path &other) const
 Return whether or not this path is equal to another. More...
 
Bool operator!= (const Path &other) const
 Return whether or not this path is not equal to another. More...
 
const UTF8String & toString () const
 Return the full string representing this path. More...
 
const UTF8String & getString () const
 Return the full string representing this path. More...
 
 operator const UTF8String & () const
 Convert this path to a string object. More...
 
 operator String () const
 Convert this path to an ASCII string object. More...
 
UTF8String getName () const
 Return the name of the file or directory specified by this path. More...
 
UTF8String getBaseName () const
 Return the base name of the file or directory specified by this path before any file extension. More...
 
UTF8String getExtension () const
 Return a string representing the extension of this paths's file name. More...
 
Size getComponentCount () const
 Return the number of components that make up this path. More...
 
UTF8String getComponent (Index index) const
 Return the name of path component at the specified index (relative to the first parent) in the path heirarchy. More...
 
UTF8String getComponentAtDepth (Index depth) const
 Return the name of path component at the specified depth in the path heirarchy. More...
 
Path getParent () const
 Return a path object that is the parent of this path object in the file system hierarchy. More...
 
Path getParentAtDepth (Index depth) const
 Return a path object that is the ancestor of this path object in the file system at the specified age. More...
 
void append (const Char *pathString)
 Add all of the path components from the specified null-terminated path string as children of this path. More...
 
void append (const UTF8String &pathString)
 Add all of the path components from the specified path string as children of this path. More...
 
void append (const Path &path)
 Add all of the path components from the specified path as children of this path. More...
 
Pathoperator+= (const Char *pathString)
 Add all of the path components from the specified path string as children of this path. More...
 
Pathoperator+= (const UTF8String &pathString)
 Add all of the path components from the specified path string as children of this path. More...
 
Pathoperator+= (const Path &path)
 Add all of the path components from the specified path as children of this path. More...
 
Path operator+ (const Char *pathString) const
 Return a new path as the concatenation of the path components from this and another path string. More...
 
Path operator+ (const UTF8String &pathString) const
 Return a new path as the concatenation of the path components from this and another path string. More...
 
Path operator+ (const Path &path) const
 Return a new path as the concatenation of the path components from this and another path. More...
 
void removeLast ()
 Remove the last path component from this path, resulting in the path representing its parent. More...
 
void removeLast (Size number)
 Remove the specified number of path components from the path. More...
 
Bool isRelative () const
 Return whether or not this path is relative to the current working directory. More...
 
Bool isAtRoot () const
 Return whether or not this path specifies a file or directory at root level. More...
 
Bool isRoot () const
 Return whether or not this path specifies the root system directory. More...
 

Detailed Description

A class representing a path to a file or directory in the local file system (not networked, etc).

Constructor & Destructor Documentation

om::fs::Path::Path ( )

Create a path corresponding to the root directory.

om::fs::Path::Path ( const Char newPathString)

Create a path from the specified NULL-terminated path string.

This path string is parsed into a sequence of path elements for easier manipulation.

om::fs::Path::Path ( const UTF8String &  newPathString)

Create a path from the specified path string.

This path string is parsed into a sequence of path elements for easier manipulation.

om::fs::Path::Path ( const Path path,
const Path children 
)

Create a path from an existing path plus the child path specified in the second parameter.

This creates a new path which consists of all path components from the first path plus any additional path components specified by the second path parameter.

om::fs::Path::Path ( const Path path,
const UTF8String &  children 
)

Create a path from an existing path plus the child path string specified in the second parameter.

This creates a new path which consists of all path components from the first path plus any additional path components specified by the second path parameter.

Member Function Documentation

Bool om::fs::Path::operator== ( const Path other) const
inline

Return whether or not this path is equal to another.

Bool om::fs::Path::operator!= ( const Path other) const
inline

Return whether or not this path is not equal to another.

const UTF8String& om::fs::Path::toString ( ) const
inline

Return the full string representing this path.

const UTF8String& om::fs::Path::getString ( ) const
inline

Return the full string representing this path.

om::fs::Path::operator const UTF8String & ( ) const
inline

Convert this path to a string object.

om::fs::Path::operator String ( ) const
inline

Convert this path to an ASCII string object.

This conversion may result in corruption of the path string if any unicode characters are present in the string

UTF8String om::fs::Path::getName ( ) const

Return the name of the file or directory specified by this path.

This name is last component of the path string.

UTF8String om::fs::Path::getBaseName ( ) const

Return the base name of the file or directory specified by this path before any file extension.

The returned string is the same as if the extension (if it exists) had been removed from the output of getName().

UTF8String om::fs::Path::getExtension ( ) const

Return a string representing the extension of this paths's file name.

The extension is defined as the characters after the last period '.' in the last component of the path string, if present. If there is no extension, the empty string is returned.

Size om::fs::Path::getComponentCount ( ) const
inline

Return the number of components that make up this path.

UTF8String om::fs::Path::getComponent ( Index  index) const

Return the name of path component at the specified index (relative to the first parent) in the path heirarchy.

UTF8String om::fs::Path::getComponentAtDepth ( Index  depth) const

Return the name of path component at the specified depth in the path heirarchy.

If a depth of 0 is specified, the name of the path's last component is returned. A depth of 1 returns the name of the parent component of the last component and so on.

Path om::fs::Path::getParent ( ) const

Return a path object that is the parent of this path object in the file system hierarchy.

If the path represents a file system node at root level or is the root directory, the root path is returned.

Path om::fs::Path::getParentAtDepth ( Index  depth) const

Return a path object that is the ancestor of this path object in the file system at the specified age.

A depth of 0 returns a copy of this path object. A depth of 1 returns the parent directory of this path and so on. If the requested depth is greater than the depth of the path's hierarchy, the root path is returned.

void om::fs::Path::append ( const Char pathString)

Add all of the path components from the specified null-terminated path string as children of this path.

void om::fs::Path::append ( const UTF8String &  pathString)

Add all of the path components from the specified path string as children of this path.

void om::fs::Path::append ( const Path path)

Add all of the path components from the specified path as children of this path.

Path& om::fs::Path::operator+= ( const Char pathString)
inline

Add all of the path components from the specified path string as children of this path.

Path& om::fs::Path::operator+= ( const UTF8String &  pathString)
inline

Add all of the path components from the specified path string as children of this path.

Path& om::fs::Path::operator+= ( const Path path)
inline

Add all of the path components from the specified path as children of this path.

Path om::fs::Path::operator+ ( const Char pathString) const
inline

Return a new path as the concatenation of the path components from this and another path string.

Path om::fs::Path::operator+ ( const UTF8String &  pathString) const
inline

Return a new path as the concatenation of the path components from this and another path string.

Path om::fs::Path::operator+ ( const Path path) const
inline

Return a new path as the concatenation of the path components from this and another path.

void om::fs::Path::removeLast ( )

Remove the last path component from this path, resulting in the path representing its parent.

void om::fs::Path::removeLast ( Size  number)

Remove the specified number of path components from the path.

Starting with the last path component, this method removes as many path components as possible from the path until either the specified number is removed or the root directory is reached.

Bool om::fs::Path::isRelative ( ) const
inline

Return whether or not this path is relative to the current working directory.

Bool om::fs::Path::isAtRoot ( ) const
inline

Return whether or not this path specifies a file or directory at root level.

Bool om::fs::Path::isRoot ( ) const
inline

Return whether or not this path specifies the root system directory.


The documentation for this class was generated from the following file: