RAUL
0.5.1
|
Simple wrapper around standard string with useful path-specific methods. More...
#include <Path.hpp>
Public Member Functions | |
Path () | |
Construct an uninitialzed path, because the STL is annoying. More... | |
Path (const std::basic_string< char > &path) | |
Construct a Path from an std::string. More... | |
Path (const char *cpath) | |
Construct a Path from a C string. More... | |
bool | is_child_of (const Path &parent) const |
bool | is_parent_of (const Path &child) const |
Symbol | name () const |
Return the name of this object (everything after the last '/'). More... | |
Path | parent () const |
Return the parent's path. More... | |
Path | relative_to_base (const Path &base) const |
Return path relative to soe base path (chop prefix) | |
const std::string | base () const |
Return path with a trailing "/". More... | |
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, 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. | |
Simple wrapper around standard string with useful path-specific methods.
This enforces that a Path is a valid OSC path (though it is used for GraphObject paths, which aren't directly OSC paths but a portion of one).
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).
Valid characters are the 95 printable ASCII characters (32-126), excluding: space # * , ? [ ] { }
|
inline |
Construct an uninitialzed path, because the STL is annoying.
|
inline |
|
inline |
|
inline |
Return the name of this object (everything after the last '/').
This is the "method name" for OSC paths.
|
inline |
Return the parent's path.
Calling this on the path "/" will return "/". This is the (deepest) "container path" for OSC paths.
|
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.