MXAFileSystemPath Class Reference

The class allows for some interrogation of the file system regarding the existance of files or directories and also allows for the creation and deletion of files or directories from the filesystem. More...

List of all members.

Static Public Member Functions

static MXA_EXPORT std::string getSeparator ()
static MXA_EXPORT bool isDirectory (const std::string &path)
 Is the path specified a directory on the filesystem.
static MXA_EXPORT bool isFile (const std::string &path)
 Does the path designate a file on the file system.
static MXA_EXPORT bool isRelativePath (const std::string &path)
 Returns true if the path is a relative path but does not determine if the file actually exists or not @param path The path to check.
static MXA_EXPORT bool isAbsolutePath (const std::string &path)
 Returns true if the path is an absolute path. On Unix this means the first character is '/' and on windows the path starts with 'Drive:\' or '\' @param path The path to check.
static MXA_EXPORT std::string currentPath ()
 Returns the current path.
static MXA_EXPORT std::string parentPath (const std::string &path)
 Returns the path to the parent directory.
static MXA_EXPORT std::string absolutePath (const std::string &path)
 Either calculates an absolute path or returns the same string if it already indicates an absolute path. No Attempt is made to actually determine if the file exists or not. The path will be free of any extra './' or '..' in the path but symbolic links will possibly be in the path.
static MXA_EXPORT std::vector<
std::string > 
entryList (const std::string &path)
 Returns a list of the contents of a directory. No filtering is attempted.
static MXA_EXPORT uint64 fileSize (const std::string &path)
 Get the size of the file in bytes.
static MXA_EXPORT bool exists (const std::string &path)
 Does the path actually exist on the file system.
static MXA_EXPORT std::string extension (const std::string &path)
 Get any file extension on the filepath.
static MXA_EXPORT std::string filename (const std::string &path)
 Return the filename WITH the extension.
static MXA_EXPORT std::string fileNameWithOutExtension (const std::string &path)
 Returns the filename without the extension.
static MXA_EXPORT bool mkdir (const std::string &path, bool createParentDirectories)
 Create a directory or structure of directories.
static MXA_EXPORT bool rmdir (const std::string &path, bool recurseParentDirectories)
 Removes a directory from the file system. Note that the directory must be empty, including hidden files.
static MXA_EXPORT bool remove (const std::string &path)
 Remove a file from the filesystem.
static MXA_EXPORT std::string cleanPath (const std::string &path)
 Cleans a file system path of extra './', '//' and '/../' elements.
static MXA_EXPORT std::string fromNativeSeparators (const std::string &path)
 Converts from native directory separators to unix separators.
static MXA_EXPORT std::string toNativeSeparators (const std::string &path)
 Converts a path to use native directory separators.

Static Public Attributes

static MXA_EXPORT const char Separator = '/'
static MXA_EXPORT const char UnixSeparator = '/'
static MXA_EXPORT const char Dot = '.'

Protected Member Functions

 MXAFileSystemPath ()
 ~MXAFileSystemPath ()

Private Member Functions

 MXAFileSystemPath (const MXAFileSystemPath &)
void operator= (const MXAFileSystemPath &)


Detailed Description

The class allows for some interrogation of the file system regarding the existance of files or directories and also allows for the creation and deletion of files or directories from the filesystem.

Author:
mjackson
Date:
Mar 10, 2009
Version:
$Revision$


Constructor & Destructor Documentation

MXAFileSystemPath::MXAFileSystemPath (  )  [protected]

MXAFileSystemPath::~MXAFileSystemPath (  )  [protected]

MXAFileSystemPath::MXAFileSystemPath ( const MXAFileSystemPath  )  [private]


Member Function Documentation

std::string MXAFileSystemPath::getSeparator (  )  [static]

bool MXAFileSystemPath::isDirectory ( const std::string &  path  )  [static]

Is the path specified a directory on the filesystem.

Parameters:
path Path to examine

bool MXAFileSystemPath::isFile ( const std::string &  path  )  [static]

Does the path designate a file on the file system.

Parameters:
path Path to examine

bool MXAFileSystemPath::isRelativePath ( const std::string &  path  )  [static]

Returns true if the path is a relative path but does not determine if the file actually exists or not @param path The path to check.

Returns:
True if the path is relative

bool MXAFileSystemPath::isAbsolutePath ( const std::string &  path  )  [static]

Returns true if the path is an absolute path. On Unix this means the first character is '/' and on windows the path starts with 'Drive:\' or '\' @param path The path to check.

Returns:
True if the path is absolute

std::string MXAFileSystemPath::currentPath (  )  [static]

Returns the current path.

Returns:
The current working directory as reported by the operating system

std::string MXAFileSystemPath::parentPath ( const std::string &  path  )  [static]

Returns the path to the parent directory.

Parameters:
path The path to return the parent path
Returns:
The Parent path

std::string MXAFileSystemPath::absolutePath ( const std::string &  path  )  [static]

Either calculates an absolute path or returns the same string if it already indicates an absolute path. No Attempt is made to actually determine if the file exists or not. The path will be free of any extra './' or '..' in the path but symbolic links will possibly be in the path.

Parameters:
path The path to check/convert
Returns:
The absolute path.

std::vector< std::string > MXAFileSystemPath::entryList ( const std::string &  path  )  [static]

Returns a list of the contents of a directory. No filtering is attempted.

Parameters:
path The path to the directory
Returns:
List of contents

uint64 MXAFileSystemPath::fileSize ( const std::string &  path  )  [static]

Get the size of the file in bytes.

bool MXAFileSystemPath::exists ( const std::string &  path  )  [static]

Does the path actually exist on the file system.

Parameters:
path Path to examine

std::string MXAFileSystemPath::extension ( const std::string &  path  )  [static]

Get any file extension on the filepath.

Parameters:
path Path to examine

std::string MXAFileSystemPath::filename ( const std::string &  path  )  [static]

Return the filename WITH the extension.

Parameters:
path Path to examine

std::string MXAFileSystemPath::fileNameWithOutExtension ( const std::string &  path  )  [static]

Returns the filename without the extension.

Parameters:
path Path to examine

bool MXAFileSystemPath::mkdir ( const std::string &  path,
bool  createParentDirectories 
) [static]

Create a directory or structure of directories.

Parameters:
path The path to create
createParentDirectories If true then any directories missing from the path will also be created.
Returns:
True if all directories were created successfully.

bool MXAFileSystemPath::rmdir ( const std::string &  path,
bool  recurseParentDirectories 
) [static]

Removes a directory from the file system. Note that the directory must be empty, including hidden files.

Parameters:
path to delete from the filesystem
recurseParentDirectories 

bool MXAFileSystemPath::remove ( const std::string &  path  )  [static]

Remove a file from the filesystem.

Parameters:
path The path to the file to remove
Returns:
True on successful removal

std::string MXAFileSystemPath::cleanPath ( const std::string &  path  )  [static]

Cleans a file system path of extra './', '//' and '/../' elements.

Parameters:
path Path to clean
Returns:
A new string containing the cleaned path.

std::string MXAFileSystemPath::fromNativeSeparators ( const std::string &  path  )  [static]

Converts from native directory separators to unix separators.

Parameters:
path The path to conver
Returns:
Newly converted path

std::string MXAFileSystemPath::toNativeSeparators ( const std::string &  path  )  [static]

Converts a path to use native directory separators.

Parameters:
path The path to convert
Returns:
The newly converted path

void MXAFileSystemPath::operator= ( const MXAFileSystemPath  )  [private]


Member Data Documentation

MXA_EXPORT const char MXAFileSystemPath::Separator = '/' [static]

MXA_EXPORT const char MXAFileSystemPath::UnixSeparator = '/' [static]

MXA_EXPORT const char MXAFileSystemPath::Dot = '.' [static]


The documentation for this class was generated from the following files:
Generated on Tue Nov 17 18:43:15 2009 for MXADataModel by  doxygen 1.5.2