VR-Forces 4.0.4 Class Documentation
Static Public Member Functions
makVrv::DtVrvFilesystem Class Reference

The DtVrvFilesystem is a wrapper around boost functions that are know to throw exceptions. More...

List of all members.

Static Public Member Functions

static bool createAllDirectories (const std::string &dirPath)
 Creates all the directories from parent to child.
static std::string absolutePath (const std::string &path)
 Get an absolute path from a relative path.
static DtUnicode absolutePath (const DtUnicode &path)
 Get an absolute path from a relative path.
static std::string cleanPath (const std::string &path)
 Clean a path by resolving embedded relative parts and correcting for inconsistent slashes.
static DtUnicode cleanPath (const DtUnicode &path)
 Clean a path by resolving embedded relative parts and correcting for inconsistent slashes.
static bool isAbsolutePath (const std::string &path)
 Check if the given path is an absolute path.
static bool exists (const std::string &path)
 Check if the given path is exists.
static bool exists (const boost::filesystem::path &path)
 Check if the given path is exists.
static bool equivalent (const std::string &path1, const std::string &path2)
 Check if the two given paths are equivalent.
static std::string makeRelative (const std::string &root, const std::string &path)
 Resolve a given path into a relative path based on a specific root.
static std::string setExtension (std::string file, std::string ext)
 Set a new extension to a file name.
static std::string addExtension (std::string file, std::string ext)
 Append a new extension to a file name.
static std::string extension (const std::string &file, bool withDot=false)
 Get the extension from a file path.
static std::string extensionCaseSensitive (std::string file, bool withDot=false)
 Get the extension from a file path.
static std::string baseName (const std::string &file)
 Get the base name of a file, excluding the file path and extension.
static std::string directoryOfFile (const std::string &file)
 Get the directory path containing the existing file.
static std::string directoryOfPath (const std::string &file)
 Get the directory path of a file.
static std::string rootDirectoryOfPath (const std::string &file)
 Get the root of the given directory.
static std::string nativePath (const std::string &path)
 Convert the path to the native format of the platform.
static DtUnicode nativePath (const DtUnicode &path)
 Convert the path to the native format of the platform.
static bool is_directory (const std::string &path)
 Test whether the path is a directory or not.
static bool is_directory (const boost::filesystem::path &path)
 Test whether the path is a directory or not.
static bool deleteFile (const std::string &file)
 Delete the given file.
template<typename PathCollection >
static bool findFile (const std::string &filePathIn, const PathCollection &paths, std::string &actualFilePathOut)
 Find a file in a list of paths.
static bool findFileInPath (const std::string &filePathIn, const std::string &path, std::string &actualFilePathOut)
 Find the file in a path.

Detailed Description

The DtVrvFilesystem is a wrapper around boost functions that are know to throw exceptions.

These functions are all reentrent* however the working directory should not be changed.


Member Function Documentation

static bool makVrv::DtVrvFilesystem::createAllDirectories ( const std::string &  dirPath) [static]

Creates all the directories from parent to child.

Parameters:
[in]dirPathis the directory path to create.
Return values:
trueif the directory path was successfully constructed.
falseotherwise.
static std::string makVrv::DtVrvFilesystem::absolutePath ( const std::string &  path) [static]

Get an absolute path from a relative path.

This function resolves a relative path to an absolute path and converts inconsistent slashes to the native format.

Parameters:
[in]pathis the relative path to convert.
Returns:
The absolute path resolved from a relative path, or an empty string if the absolute path could not be found.
Note:
This function does not test existence of the path.
This function is not thread safe.
See also:
cleanPath(const std::string& path)
static DtUnicode makVrv::DtVrvFilesystem::absolutePath ( const DtUnicode path) [static]

Get an absolute path from a relative path.

This function resolves a relative path to an absolute path and converts inconsistent slashes to the native format.

Parameters:
[in]pathis the relative path to convert.
Returns:
The absolute path resolved from a relative path, or an empty string if the absolute path could not be found.
Note:
This function does not test existence of the path.
This function is not thread safe.
See also:
cleanPath(const DtUnicode& path)
static std::string makVrv::DtVrvFilesystem::cleanPath ( const std::string &  path) [static]

Clean a path by resolving embedded relative parts and correcting for inconsistent slashes.

Parameters:
[in]pathis the relative or absolute path to clean.
Returns:
The corrected relative or absolute path, or an empty string on failure.
Note:
This function does not test existence of the path.
This function is not thread safe.
See also:
absolutePath(const std::string& path)
static DtUnicode makVrv::DtVrvFilesystem::cleanPath ( const DtUnicode path) [static]

Clean a path by resolving embedded relative parts and correcting for inconsistent slashes.

Parameters:
[in]pathis the relative or absolute path to clean.
Returns:
The corrected relative or absolute path, or an empty string on failure.
Note:
This function does not test existence of the path.
This function is not thread safe.
See also:
absolutePath(const DtUnicode& path)
static bool makVrv::DtVrvFilesystem::isAbsolutePath ( const std::string &  path) [static]

Check if the given path is an absolute path.

Parameters:
[in]pathis the path to check.
Return values:
trueif the given path is already absolute.
falseotherwise or failure to check.
Note:
This function does not test existence of the path.
This function is not thread safe.
static bool makVrv::DtVrvFilesystem::exists ( const std::string &  path) [static]

Check if the given path is exists.

Parameters:
[in]pathis the path to check.
Return values:
trueif the given path exists in the filesystem.
falseotherwise or failure to check.

Referenced by makVrv::DtManagerBackup< Manager >::backupExists(), makVrv::DtManagerBackup< Manager >::factoryExists(), and findFile().

static bool makVrv::DtVrvFilesystem::exists ( const boost::filesystem::path &  path) [static]

Check if the given path is exists.

Parameters:
[in]pathis the path to check.
Return values:
trueif the given path exists in the filesystem.
falseotherwise or failure to check.
static bool makVrv::DtVrvFilesystem::equivalent ( const std::string &  path1,
const std::string &  path2 
) [static]

Check if the two given paths are equivalent.

This checks that two given paths, whether relative or absolute, both resolve to the same directory or file location.

Parameters:
[in]path1is the first path to check.
[in]path2is the second path to check.
Return values:
trueif both paths resolve to the same location.
falseotherwise or failure to check.
Note:
This function does not test existence of either path.
static std::string makVrv::DtVrvFilesystem::makeRelative ( const std::string &  root,
const std::string &  path 
) [static]

Resolve a given path into a relative path based on a specific root.

Using a root path location, a given path is converted to a new path relative to that root location.

For example: if the root is "C:\test" and path is "C:\temp\file.txt", the resulting path returned would be "..\file.txt".

The given root and given path values can be relative or absolute file or directory paths. If relative paths are given they are first converted to absolute paths from the current working directory.

Parameters:
[in]rootis the root path to base the relative path from.
[in]pathis the path to convert to a relative path.
Returns:
The given path converted to a relative path from the root.
Note:
If the given root and path are on different devices, such as on different Windows disk drives, an absolute path is returned.
This function does not test existence of either path.
static std::string makVrv::DtVrvFilesystem::setExtension ( std::string  file,
std::string  ext 
) [static]

Set a new extension to a file name.

If an extension already exists, it is changed to the new extension. If the file does not have an extension the new extension is appended.

Parameters:
[in]fileis the path or name of the file.
[in]extis the extension to set on the filename.
Returns:
The filename with the given extension.
Note:
This function does not test existence of the file.
static std::string makVrv::DtVrvFilesystem::addExtension ( std::string  file,
std::string  ext 
) [static]

Append a new extension to a file name.

If an existing extension to the file is the same as the given extension, the file is returned unchanged. If the given file or extension are invalid values, the file is returned unchanged.

Parameters:
[in]fileis the path or name of the file.
[in]extis the extension to append to the filename.
Returns:
The filename appended with the given extension.
Note:
This function does not test existence of the file.
static std::string makVrv::DtVrvFilesystem::extension ( const std::string &  file,
bool  withDot = false 
) [static]

Get the extension from a file path.

The case of the returned extension is converted to lowercase.

Parameters:
[in]fileis the path or name of the file.
[in]withDotis a flag indicating the extension should or should not include the leading dot character.
Returns:
The extension of the filename.
Note:
This function does not test existence of the file.
static std::string makVrv::DtVrvFilesystem::extensionCaseSensitive ( std::string  file,
bool  withDot = false 
) [static]

Get the extension from a file path.

The case of the returned extension is preserved.

Parameters:
[in]fileis the path or name of the file.
[in]withDotis a flag indicating the extension should or should not include the leading dot character.
Returns:
The extension of the filename.
Note:
This function does not test existence of the file.
static std::string makVrv::DtVrvFilesystem::baseName ( const std::string &  file) [static]

Get the base name of a file, excluding the file path and extension.

For example: ...txt -> test

Parameters:
[in]fileis the path or name of the file.
Returns:
The base name of the file.
static std::string makVrv::DtVrvFilesystem::directoryOfFile ( const std::string &  file) [static]

Get the directory path containing the existing file.

For example: ...txt -> ..

Parameters:
[in]fileis the path and name of the file.
Returns:
The parent directory path to the file or an empty string if the file does not exist.
static std::string makVrv::DtVrvFilesystem::directoryOfPath ( const std::string &  file) [static]

Get the directory path of a file.

For example: ...txt -> ..

Parameters:
[in]fileis the path and name of the file.
Returns:
The parent directory path to the file.
Note:
This function does not test existence of the file.
static std::string makVrv::DtVrvFilesystem::rootDirectoryOfPath ( const std::string &  file) [static]

Get the root of the given directory.

For example: data\file\test.text -> data

Parameters:
[in]fileis the file path to get the root directory from
Returns:
The root directory from the file path.
Note:
This function does not test existence of the file.
static std::string makVrv::DtVrvFilesystem::nativePath ( const std::string &  path) [static]

Convert the path to the native format of the platform.

Parameters:
[in]pathis the path to be converted.
Returns:
The path converted into the native format.
Note:
This function does not test existence of the path.
static DtUnicode makVrv::DtVrvFilesystem::nativePath ( const DtUnicode path) [static]

Convert the path to the native format of the platform.

Parameters:
[in]pathis the path to be converted.
Returns:
The path converted into the native format.
Note:
This function does not test existence of the path.
static bool makVrv::DtVrvFilesystem::is_directory ( const std::string &  path) [static]

Test whether the path is a directory or not.

Parameters:
[in]pathis the path to be tested.
Return values:
trueif the path is a directory and exists.
falseotherwise.
static bool makVrv::DtVrvFilesystem::is_directory ( const boost::filesystem::path &  path) [static]

Test whether the path is a directory or not.

Parameters:
[in]pathis the path to be tested.
Return values:
trueif the path is a directory and exists.
falseotherwise.
static bool makVrv::DtVrvFilesystem::deleteFile ( const std::string &  file) [static]

Delete the given file.

Parameters:
[in]fileis the file to be deleted.
Return values:
trueif the file was successfully deleted.
falseotherwise.

Referenced by makVrv::DtManagerBackup< Manager >::deleteBackup().

template<typename PathCollection >
static bool makVrv::DtVrvFilesystem::findFile ( const std::string &  filePathIn,
const PathCollection &  paths,
std::string &  actualFilePathOut 
) [inline, static]

Find a file in a list of paths.

Iterate through a list of paths and attempt to find a file within one of the paths. The first location found in the iteration is returned.

Parameters:
[in]filePathInis a file or filepath to find.
[in]pathsis a list of paths to check for the file.
[out]actualFilePathOutis the filepath where the file was found.
Return values:
trueif the file exists and was found in one of the paths.
falseotherwise.

References exists().

static bool makVrv::DtVrvFilesystem::findFileInPath ( const std::string &  filePathIn,
const std::string &  path,
std::string &  actualFilePathOut 
) [static]

Find the file in a path.

This test tries to find an existing file in a given path. The given filepath is first tested as is within the given path, and on failure, the the filename (stripped of any file path) is then tested within the given path.

Parameters:
[in]filePathInis a file or filepath to find.
[in]pathis the path to check for the file or filepath.
[out]actualFilePathOutis the filepath where the file was found.
Return values:
trueif the file exists and was found.
falseotherwise.

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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)