Raul::Path Class Reference

A URI which is a path (for example a filesystem or OSC path). More...

#include <Path.hpp>

Inherits Raul::URI.

Collaboration diagram for Raul::Path:
Collaboration graph

List of all members.

Public Member Functions

 Path ()
 Construct an uninitialzed path, because the STL is annoying.
 Path (const std::basic_string< char > &path)
 Construct a Path from an std::string.
 Path (const char *cpath)
 Construct a Path from a C string.
bool is_root () const
bool is_child_of (const Path &parent) const
bool is_parent_of (const Path &child) const
Path child (const std::string &s) const
Path operator+ (const Path &p) const
std::string name () const
 Return the name of this object (everything after the last '/').
Symbol symbol () const
 Return the name of this object (everything after the last '/').
Path parent () const
 Return the parent's path.
Path relative_to_base (const Path &base) const
 Return path relative to some base path (chop prefix).
const std::string base () const
 Return path with a trailing "/".

Static Public Member Functions

static bool is_valid (const std::basic_string< char > &path)
static bool is_valid_name (const std::basic_string< char > &name)
static std::string pathify (const std::basic_string< char > &str)
static std::string nameify (const std::basic_string< char > &str)
static void replace_invalid_chars (std::string &str, size_t start, bool replace_slash=false)
static bool descendant_comparator (const Path &parent, const Path &child)
 Return true if child is equal to, or a descendant of parent.

Static Public Attributes

static const std::string scheme
static const std::string prefix
static const size_t prefix_len
static const std::string root_uri

Detailed Description

A URI which is a path (for example a filesystem or OSC path).

A Path always has the special URI scheme "path:".

This enforces that a Path is a valid path, where each fragment is a valid Symbol, separated by exactly one slash (/).

A path is divided by slashes (/). The first character MUST be a slash, and the last character MUST NOT be a slash (except in the special case of the root path "/", which is the only valid single-character path). The path: scheme is added automatically (since a Patch is actually a URI).


Constructor & Destructor Documentation

Raul::Path::Path (  )  [inline]

Construct an uninitialzed path, because the STL is annoying.

Raul::Path::Path ( const std::basic_string< char > &  path  )  [inline]

Construct a Path from an std::string.

It is a fatal error to construct a Path from an invalid string, use is_valid first to check.

Raul::Path::Path ( const char *  cpath  )  [inline]

Construct a Path from a C string.

It is a fatal error to construct a Path from an invalid string, use is_valid first to check.


Member Function Documentation

std::string Raul::Path::name (  )  const [inline]

Return the name of this object (everything after the last '/').

This is the "method name" for OSC paths. The empty string may be returned (if the path is "/").

Symbol Raul::Path::symbol (  )  const [inline]

Return the name of this object (everything after the last '/').

This is the "method name" for OSC paths. Note it is illegal to call this method on the path "/".

Path Raul::Path::parent (  )  const [inline]

Return the parent's path.

Calling this on the path "/" will return "/". This is the (deepest) "container path" for OSC paths.

const std::string Raul::Path::base (  )  const [inline]

Return path with a trailing "/".

Returned value is guaranteed to be a valid parent path, i.e. a valid child path can be made using parent.base() + child_name.


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

Generated on 1 Feb 2010 for RAUL by  doxygen 1.6.1