#include <Path.hpp>
Public Member Functions | |
Path () | |
Contrust 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_child_of (const Path &parent) const |
bool | is_parent_of (const Path &child) const |
std::basic_string< char > | name () const |
Return the name of this object (everything after the last '/'). | |
Path | parent () const |
Return the parent's path. | |
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, 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. |
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 # * , ? [ ] { }
Raul::Path::Path | ( | const std::basic_string< char > & | path | ) | [inline] |
Raul::Path::Path | ( | const char * | cpath | ) | [inline] |
std::basic_string<char> Raul::Path::name | ( | ) | const [inline] |
Return the name of this object (everything after the last '/').
This is the "method name" for OSC paths.
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.