|
Structure for testing if a path matches a given sequence of path elements. More...
#include <ODIMPathMatcher.h>
Public Member Functions | |
ODIMPathMatcher () | |
Basic constructor. | |
ODIMPathMatcher (const ODIMPathMatcher &matcher) | |
Copy constructor. | |
template<typename ... T> | |
ODIMPathMatcher (const ODIMPathElem &elem, const T &... rest) | |
ODIMPathMatcher (const std::string &path) | |
Almost copy constructor. | |
ODIMPathMatcher (const char *path) | |
Almost copy constructor. | |
bool | ensureLimitingSlash () |
Resolves "where|where". More... | |
bool | isLiteral () const |
Checks if corresponds to a single path, implying that all the index ranges are singletons. | |
void | extractPath (ODIMPath &path) const |
Convert to a single path, assuming uniqueness. Future option: extract all the enumerated paths. More... | |
bool | match (const rack::ODIMPath &path) const |
Match the leading part of path , if matcher starts with root. Else, match the trailing part. | |
bool | matchHead (const rack::ODIMPath &path) const |
Match leading part of path . | |
bool | matchTail (const rack::ODIMPath &path) const |
Match trailing part of path . | |
bool | matchElem (const rack::ODIMPathElem &elem, bool defaultValue=true) const |
Match single element. If matcher path does not contain it, return defaultValue. | |
Public Member Functions inherited from Path< ODIMPathElemMatcher > | |
Path (const path_t &p) | |
Copy constructor. | |
Path (typename path_t::const_iterator it, typename path_t::const_iterator it2) | |
Secondary copy constructor. Handy for creating a parent path, for example. | |
Path (const path_t &arg, const TT &... args) | |
Initialize with a path. | |
Path (const std::string &arg, const TT &... args) | |
Initialize with a path. | |
Path (const char *arg, const TT &... args) | |
Initialize with a path. | |
virtual | ~Path () |
Why the three above instead of this? | |
void | set (const TT &... args) |
void | append (const T2 &arg, const TT &... args) |
Append path with element(s), path(s) or string(s). | |
void | append (const path_t &p, const TT &... args) |
void | append (const char *arg, const TT &... args) |
void | append (const std::string &arg, const TT &... args) |
void | appendPath (const char *p) |
Specialized handler for strings (note, possibly: elem_t==std:::string) | |
void | appendPath (const path_t &p) |
void | appendElem (const elem_t &elem) |
Main method for adding elements. | |
bool | isRoot () const |
Returns true, if the path as only one element which is empty. An empty path is not a root. More... | |
bool | hasRoot () const |
Returns true, if the path is not empty and the first element is empty. More... | |
path_t & | ensureRoot () |
Returns true, if the path is not empty and the first element is empty. More... | |
void | trimHead (bool COMPLETE=false) |
Removes leading empty elements. The resulting string presentation will not start with the separator. More... | |
void | trimTail (bool COMPLETE=false) |
Removes trailing empty elements. The resulting string presentation will not end with the separator. | |
void | simplify () |
ORIGINAL. Removes trailing empty elements, except for the root itself. More... | |
void | simplifyHead () |
Remove duplicates of empty elements from the start. | |
void | simplifyTail () |
Remove duplicates of empty elements from the end. | |
path_t & | operator= (const path_t &p) |
Assigns a path directly with std::list assignment. More... | |
path_t & | operator= (const Path< T2 > &p) |
Conversion from str path type. More... | |
path_t & | operator= (const std::string &p) |
path_t & | operator= (const char *p) |
path_t & | operator<< (const elem_t &elem) |
Append an element, unless empty string. More... | |
path_t & | operator<< (const path_t &path) |
path_t & | operator<< (const T2 &strlike) |
path_t & | operator>> (elem_t &e) |
Extract last element. | |
virtual std::ostream & | toStream (std::ostream &ostr) const |
Path is written like a list, adding the separator between items. Exception: root is displayed as separator. | |
virtual std::string | str () const |
virtual | operator std::string () const |
std::ostream & | debug (std::ostream &ostr=std::cout) const |
Additional Inherited Members | |
Public Types inherited from Path< ODIMPathElemMatcher > | |
typedef ODIMPathElemMatcher | elem_t |
typedef Path< ODIMPathElemMatcher, '/', true, false, true > | path_t |
typedef std::list< path_t > | list_t |
Public Attributes inherited from Path< ODIMPathElemMatcher > | |
const PathSeparatorPolicy | separator |
Protected Member Functions inherited from Path< ODIMPathElemMatcher > | |
void | append () |
Terminal function for variadic templates. | |
void | _append (const elem_t &elem) |
"Default" append function. | |
void | _append (const T2 &p) |
Handler for all the rest args, assumed convertable to elem_t. | |
void | _appendPath (const std::string &p, size_t start=0) |
Extract elements from the string, starting at position i. | |
Structure for testing if a path matches a given sequence of path elements.
Path will be matched from its start or end - not in the middle. Uses index range [index,indexMax] in testing path elements of same group.
bool ensureLimitingSlash | ( | ) |
Resolves "where|where".
If neither end has an empty element (appearing as slash), add one, to root.
void extractPath | ( | ODIMPath & | path | ) | const |
Convert to a single path, assuming uniqueness. Future option: extract all the enumerated paths.
Extracts a single, "deterministic" path only. TODO: enumerate, extract maximally N branches.