Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ospath Namespace Reference
[File Utilities]

Platform-neutral file and directory utilities. More...


Functions

SIMDATA_EXPORT std::string basename (const std::string &path)
 Return the basename of pathname path.

SIMDATA_EXPORT bool isabs (const std::string &path)
 Returns true if path is an absolute pathname.

SIMDATA_EXPORT std::string skiproot (const std::string &path)
 Strips leading drive specifier and root directory marker.

SIMDATA_EXPORT std::string dirname (const std::string &path)
 Returns the directory name of pathname path.

SIMDATA_EXPORT std::string currentdir ()
 Returns the current working directory.

SIMDATA_EXPORT std::string ext (const std::string &path)
 Returns the (last) extension of pathname path.

SIMDATA_EXPORT std::string join (const std::string &a, const std::string &b)
 Intelligently joins two path components into a pathname.

SIMDATA_EXPORT std::string stringreplace (const std::string &path, char search, char replace)
 Substitute characters in a string.

SIMDATA_EXPORT std::string normalize (const std::string &path)
 Convert a native path to a standard format (uses '/' instead of '\').

SIMDATA_EXPORT std::string denormalize (const std::string &path)
 Convert a normalized path to the native format.

SIMDATA_EXPORT std::string filter (const std::string &path)
 Filter an input path to use the native directory separation character.

SIMDATA_EXPORT std::string
const & 
addpath (std::string &pathlist, const std::string &path)
 Add a path to a list of paths using the platform path separator.


Variables

SIMDATA_EXPORT const char DIR_SEPARATOR = '/'
 The local, platform-specific directory separator.

SIMDATA_EXPORT const char PATH_SEPARATOR = ':'
 The local, platform-specific search-path separator.


Detailed Description

Platform-neutral file and directory utilities.

Function Documentation

std::string const & ospath::addpath std::string &    pathlist,
const std::string &    path
 

Add a path to a list of paths using the platform path separator.

std::string ospath::basename const std::string &    path
 

Return the basename of pathname path.

Example:

  • basename("/usr/local/csp") == "csp"

std::string ospath::currentdir  
 

Returns the current working directory.

std::string ospath::denormalize const std::string &    path
 

Convert a normalized path to the native format.

std::string ospath::dirname const std::string &    path
 

Returns the directory name of pathname path.

Example:

  • dirname("/usr/local/csp") == "/usr/local".

std::string ospath::ext const std::string &    path
 

Returns the (last) extension of pathname path.

Example:

  • ext("/usr/local/script.csp") == ".csp"

std::string ospath::filter const std::string &    path
 

Filter an input path to use the native directory separation character.

bool ospath::isabs const std::string &    path
 

Returns true if path is an absolute pathname.

std::string ospath::join const std::string &    a,
const std::string &    b
 

Intelligently joins two path components into a pathname.

Examples:

  • join("/usr/local", "lib") == "/usr/local/lib"
  • join("c:\windows\", "system") == "c:\windows\system"

std::string ospath::normalize const std::string &    path
 

Convert a native path to a standard format (uses '/' instead of '\').

Note:
does not handle drive specifiers under windows.

std::string ospath::skiproot const std::string &    path
 

Strips leading drive specifier and root directory marker.

Examples:

  • skiproot("c:\windows") == "windows"
  • skiproot("/linux/csp") == "linux/csp"

std::string ospath::stringreplace const std::string &    path,
char    search,
char    replace
 

Substitute characters in a string.

Todo:
This routine is slightly out of place. Can we find a substitute or better home for it?
Parameters:
path  The path to modify.
search  The character to replace.
replace  The replacement character.


Variable Documentation

NAMESPACE_SIMDATA const char ospath::DIR_SEPARATOR = '/'
 

The local, platform-specific directory separator.

Note:
The value listed in the documentation will depend on the platform under which the documentation was built.

const char ospath::PATH_SEPARATOR = ':'
 

The local, platform-specific search-path separator.

Note:
The value listed in the documentation will depend on the platform under which the documentation was built.


SimData version pre-0.4.0. For more information on SimData, visit the SimData Homepage.

Generated on Tue Oct 14 12:06:42 2003, using Doxygen 1.2.18.

[SF.net]