copasi API  0.1
Static Public Member Functions | Static Public Attributes
CDirEntry Class Reference

#include <CDirEntry.h>

List of all members.

Static Public Member Functions

static bool isFile (const std::string &path)
static bool isDir (const std::string &path)
static bool exist (const std::string &path)
static bool isReadable (const std::string &path)
static bool isWritable (const std::string &path)
static std::string baseName (const std::string &path)
static std::string fileName (const std::string &path)
static std::string dirName (const std::string &path)
static std::string suffix (const std::string &path)
static bool createDir (const std::string &dir, const std::string &parent="")
static std::string createTmpName (const std::string &dir, const std::string &suffix)
static bool move (const std::string &from, const std::string &to)
static bool remove (const std::string &path)
static bool removeFiles (const std::string &pattern, const std::string &dir)
static std::vector< std::string > compilePattern (const std::string &pattern)
static bool match (const std::string &name, const std::vector< std::string > &patternList)
static bool isRelativePath (const std::string &path)
static bool makePathRelative (std::string &absolutePath, const std::string &relativeTo)
static bool makePathAbsolute (std::string &relativePath, const std::string &absoluteTo)
static std::string normalize (const std::string &path)

Static Public Attributes

static const std::string Separator = "/"

Detailed Description

This class provides an OS independent interface to directory entries such as files and directories.


Member Function Documentation

std::string CDirEntry::baseName ( const std::string &  path) [static]

Returns the base name, i.e., the directory path and the the suffix are removed from 'path'.

Parameters:
conststd::string & path
Returns:
std::string baseName
std::vector< std::string > CDirEntry::compilePattern ( const std::string &  pattern) [static]

Compiles the pattern to a patternList. Valid wildcards in the pattern are: '*' matches any number of characters and '?' matches exactly one character.

Parameters:
conststd::string & pattern
Returns:
std::vector< std::string > patternList
bool CDirEntry::createDir ( const std::string &  dir,
const std::string &  parent = "" 
) [static]

Create the directory 'dir' in the parent directory 'parent'.

Parameters:
conststd::string & dir
conststd::string & parent (Default: current working directory)
Returns:
bool success
std::string CDirEntry::createTmpName ( const std::string &  dir,
const std::string &  suffix 
) [static]

Create a name for a temporary directory entry. The directory entry will be located in the directory given

Parameters:
conststd::string & dir
conststd::string & suffix
Returns:
std::string tmpName
std::string CDirEntry::dirName ( const std::string &  path) [static]

Returns the directory path to the parent directoryu, i.e., the file name or directory name are removed from 'path'.

Parameters:
conststd::string & path
Returns:
std::string dirName
bool CDirEntry::exist ( const std::string &  path) [static]

Check whether the directory entry specified by 'path' exists.

Parameters:
conststd::string & path
Returns:
bool exist
std::string CDirEntry::fileName ( const std::string &  path) [static]

Returns the file name, i.e., the directory path is removed from 'path'.

Parameters:
conststd::string & path
Returns:
std::string fileName
bool CDirEntry::isDir ( const std::string &  path) [static]

Check whether the directory entry specified by 'path' is is a directory.

Parameters:
conststd::string & path
Returns:
bool isDir
bool CDirEntry::isFile ( const std::string &  path) [static]

Check whether the directory entry specified by 'path' is a file.

Parameters:
conststd::string & path
Returns:
bool isFile
bool CDirEntry::isReadable ( const std::string &  path) [static]

Check whether the directory entry specified by 'path' is is readable.

Parameters:
conststd::string & path
Returns:
bool isReadable
bool CDirEntry::isRelativePath ( const std::string &  path) [static]

Checks whether the given path is relative

Returns:
bool isRelative
bool CDirEntry::isWritable ( const std::string &  path) [static]

Check whether the directory entry specified by 'path' is writable.

Parameters:
conststd::string & path
Returns:
bool isWritable
bool CDirEntry::makePathAbsolute ( std::string &  relativePath,
const std::string &  absoluteTo 
) [static]

Makes the relative path absolute to the path given in absoluteTo

Parameters:
std::string& relativePath
conststd::string & absoluteTo
Returns:
bool success
bool CDirEntry::makePathRelative ( std::string &  absolutePath,
const std::string &  relativeTo 
) [static]

Makes the absolute path relative to the path given in relativeTo

Parameters:
std::string& absolutePath
conststd::string & relativeTo
Returns:
bool success
bool CDirEntry::match ( const std::string &  name,
const std::vector< std::string > &  patternList 
) [static]

Compare the name against the pattern list and returns whether the name matches. The patternList can be created from a pattern by the compilePattern method.

Parameters:
conststd::string & name
conststd::vector< std::string > & patternList
Returns:
bool match
bool CDirEntry::move ( const std::string &  from,
const std::string &  to 
) [static]

Move a file from. If to is the directory the filename of from is appended.

Parameters:
conststd::string & from
conststd::string & to
Returns:
bool success
std::string CDirEntry::normalize ( const std::string &  path) [static]

This method normalizes the path, i.e., it converts all '\' to '/' (only on WIN32) and collapses '^./' to '^', '/./' to '/', and '[^/]+/../' to '/'

Parameters:
conststd::string & path
Returns:
std::string normalizedPath
bool CDirEntry::remove ( const std::string &  path) [static]

Removes a file or directory specified by path.

Parameters:
conststd::string & path
Returns:
bool success
bool CDirEntry::removeFiles ( const std::string &  pattern,
const std::string &  dir 
) [static]

Remove files or directories matching the pattern in directory dir.

Parameters:
conststd::string & pattern
conststd::string & dir
Returns:
bool success
std::string CDirEntry::suffix ( const std::string &  path) [static]

Returns the suffix, i.e., the directory path and the the base name are removed from 'path'.

Parameters:
conststd::string & path
Returns:
std::string basename

Member Data Documentation

const std::string CDirEntry::Separator = "/" [static]

The character used to separate directory entries.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines