Trading System API  3.0
Library for Simulating and Deploying Trading and Investment Strategies
tsa::os::path Class Reference

Utility class to manipulate file system paths. This class is intended to fulfil the requirements of the Trading System API library. For more comprehensive functionality it is recommended to use a library such as 'boost::filesystem'. More...

#include <TSAOS.h>

Inheritance diagram for tsa::os::path:
tsa::object

Public Member Functions

 path (void)
 Constructor.
 
 path (const tsa::string &p)
 Constructor.
 
 path (const std::string &p)
 Constructor.
 
 path (const char *p)
 Constructor.
 
 path (const os::path &)
 Copy constructor.
 
 ~path (void)
 Destructor.
 
void append (const tsa::string &s)
 Appends string s to the path. This is useful for adding file extensions such as '.html'.
 
path as_absolute (void) const
 Returns self as an absolute path.
 
bool defined (void) const
 Returns true if the path is not empty.
 
bool exists (void) const
 Returns true if path exists on disk. If the path is not absolute, the check is performed from the current directory.
 
int64_t file_size (void) const
 Returns the files size, if the file exists. Throws and error if it is a directory.
 
path find_unique_numbered (void) const
 Makes the path name unique by adding '(<num>)' suffix. The path must refer to a directory.
 
bool is_absolute (void) const
 Returns true if self is an absolute path. On *nix systems a path is absolute if it has a '/' prefix. On MS-Windows it is absolute if it has a drive prefix, such as 'c:'.
 
bool is_cwd (void) const
 Returns true if self is equal to the operating system's current directory.
 
bool is_dir (void) const
 Returns true if the path is a directory. The path must exist!
 
void join (const os::path &other)
 Joins self with other.
 
 operator const char * (void) const
 Cast operator to const char*.
 
void operator/= (const os::path &other)
 Joins self with other.
 
void operator= (const os::path &)
 Assignment operator.
 
bool operator== (const os::path &other)
 Comparison operator. Returns true if self and other are identical.
 
void remove_from_disk (bool missing_OK=false) const
 Removes the directory (and recursively all content) referred to by self from disk. Throws an exception if the path does not exist and missing_OK is false.
 
std::string right (size_t n) const
 Returns n-th characters from the right side of self. This is useful when checking for file extensions such as '.html'.
 
void set_as_cwd (void)
 Sets self as the operating system's current directory.
 
void set_to_cwd (void)
 Sets self to the operating system's current directory.
 
const std::stringto_string (void) const
 Returns the path as a string.
 
- Public Member Functions inherited from tsa::object
 object (void)
 Constructor.
 
virtual ~object (void)
 Destructor.
 
const char * class_name (void) const
 Returns the class name as returned by the 'Real Time Type Information' (RTTI) mechanism. More...
 
bool has_same_class_as (const object &other) const
 Returns true if self has the same type as other object. More...
 

Static Public Member Functions

static path join (const os::path &a, const os::path &b)
 Joins paths a and b.
 

Detailed Description

Utility class to manipulate file system paths. This class is intended to fulfil the requirements of the Trading System API library. For more comprehensive functionality it is recommended to use a library such as 'boost::filesystem'.