URI path component. More...
#include <path.h>
Public Types | |
| typedef segments_type::const_iterator | const_iterator |
| segments const iterator type More... | |
| typedef std::list< std::string > | segments_type |
| segments type More... | |
Public Member Functions | |
| bool | absolute () const |
| Test if absolute, meaning path begins with "/". More... | |
| void | absolute (bool v) |
| Set whether absolute or not. More... | |
| const std::string & | back () const |
| Get back segment. More... | |
| const_iterator | begin () const |
| Get iterator at beginning. More... | |
| void | clear () |
| Clear segments and reset absolute and is_directory. More... | |
| bool | empty () const |
| Test if empty and not absolute. More... | |
| std::string | encoding () const |
| Calculate encoded string. More... | |
| const_iterator | end () const |
| Get iterator at end. More... | |
| const std::string & | front () const |
| Get front segment. More... | |
| bool | is_directory () const |
| Test if a directory, meaning the path ends in a "/". More... | |
| void | is_directory (bool v) |
| Set whether a directory or not. More... | |
| bool | match_prefix (const path &rhs) const |
| Test if the given other URI path is a prefix of this. More... | |
| bool | operator!= (const path &rhs) const |
| Not equal operator. More... | |
| path | operator+ (const std::string &rhs) const |
| Append unencoded segment and reset is_directory. More... | |
| path | operator+ (const path &rhs) const |
| Append path and set is_directory according to rhs. More... | |
| path & | operator+= (const std::string &rhs) |
| Append unencoded segment and reset is_directory. More... | |
| path & | operator+= (const path &rhs) |
| Append path and set is_directory according to rhs. More... | |
| bool | operator< (const path &rhs) const |
| Less operator. More... | |
| bool | operator== (const path &rhs) const |
| Get number of segments. More... | |
| path () | |
| Construct. More... | |
| path (const std::string &v) | |
| Construct from encoded string. More... | |
| bool | pop_back (const path &back) |
| Remove the back of the path if it matches the argument (including whether directory or not) and return whether removed/matched. More... | |
| void | pop_front () |
| Pop front segment and reset absolute. More... | |
| size_t | size () const |
| std::string | string () const |
| Return path string. Added by Lauro. More... | |
Static Public Attributes | |
| static const char | SEPARATOR_CHAR = '/' |
| separator ('/') More... | |
Private Attributes | |
| bool | absolute_ |
| bool | is_directory_ |
| segments_type | segments_ |
Friends | |
| bool TECOMMONEXPORT | parse (std::string::const_iterator &first, std::string::const_iterator last, path &v, std::string *errs) |
| Parse URI path, returning whether found or not and advancing first and setting path if found. More... | |
URI path component.
Note that there are potential ambiguities when using ":" and "//" in paths in URIs (see RFC).
Syntax: Segments are pct-decoded after parsing.
ALPHA = x41-5A | x61-7A ; A-Z | a-z
DIGIT = x30-39 ; 0-9
sub-delims = "!" | "$" | "&" | "'" | "(" | ")" | "*"
| "+" | "," | ";" | "="
unreserved = ALPHA | DIGIT | "-" | "." | "_" | "~"
pchar = unreserved | pct-encoded | sub-delims | ":" | "@"
segment = *pchar
path = *( "/" segment )
| typedef segments_type::const_iterator te::common::uri::path::const_iterator |
| typedef std::list<std::string> te::common::uri::path::segments_type |
| te::common::uri::path::path | ( | ) |
Construct.
Definition at line 32 of file path.cpp.
Referenced by te::common::URL::addPath(), te::common::URL::beginPath(), te::common::URL::clearPath(), te::common::URL::endPath(), te::common::URL::setEncodedPathString(), te::common::URL::setIsAbsolutePath(), and te::common::URL::setIsDirectoryPath().
| te::common::uri::path::path | ( | const std::string & | v | ) |
|
inline |
Test if absolute, meaning path begins with "/".
Definition at line 64 of file path.h.
Referenced by te::common::URL::setIsAbsolutePath().
|
inline |
| const std::string & te::common::uri::path::back | ( | ) | const |
|
inline |
Get iterator at beginning.
Definition at line 111 of file path.h.
Referenced by te::common::URL::beginPath(), match_prefix(), and string().
| void te::common::uri::path::clear | ( | ) |
Clear segments and reset absolute and is_directory.
Definition at line 40 of file path.cpp.
References absolute_, is_directory_, and segments_.
Referenced by te::common::URL::clearPath().
|
inline |
Test if empty and not absolute.
Definition at line 62 of file path.h.
Referenced by te::common::uri::uri::is_null(), and pop_back().
| std::string te::common::uri::path::encoding | ( | ) | const |
Calculate encoded string.
Definition at line 137 of file path.cpp.
References te::common::uri::urisyn::encode(), is_directory_, te::common::uri::urisyn::PATH_TRAITS, segments_, and SEPARATOR_CHAR.
Referenced by te::common::uri::convert(), and te::common::uri::operator<<().
|
inline |
Get iterator at end.
Definition at line 112 of file path.h.
Referenced by te::common::URL::endPath(), match_prefix(), and string().
| const std::string & te::common::uri::path::front | ( | ) | const |
|
inline |
Test if a directory, meaning the path ends in a "/".
Definition at line 68 of file path.h.
Referenced by te::common::URL::setIsDirectoryPath().
|
inline |
| bool te::common::uri::path::match_prefix | ( | const path & | rhs | ) | const |
|
inline |
|
inline |
| path & te::common::uri::path::operator+= | ( | const std::string & | rhs | ) |
Append unencoded segment and reset is_directory.
Definition at line 125 of file path.cpp.
References is_directory_, and segments_.
Append path and set is_directory according to rhs.
Definition at line 130 of file path.cpp.
References absolute_, is_directory_, and segments_.
| bool te::common::uri::path::operator< | ( | const path & | rhs | ) | const |
Less operator.
Examines the following in order:
Definition at line 111 of file path.cpp.
References absolute_, is_directory_, and segments_.
| bool te::common::uri::path::operator== | ( | const path & | rhs | ) | const |
Get number of segments.
Equal operator.
Definition at line 108 of file path.cpp.
References absolute_, is_directory_, and segments_.
| bool te::common::uri::path::pop_back | ( | const path & | back | ) |
Remove the back of the path if it matches the argument (including whether directory or not) and return whether removed/matched.
Note that if this starts as a directory it stays a directory. If back is absolute and it does not match all of this or this is not absolute then there is no match.
Definition at line 80 of file path.cpp.
References absolute_, empty(), is_directory_, and segments_.
| void te::common::uri::path::pop_front | ( | ) |
Pop front segment and reset absolute.
Definition at line 72 of file path.cpp.
References absolute_, is_directory_, and segments_.
| std::string te::common::uri::path::string | ( | ) | const |
Return path string. Added by Lauro.
Definition at line 151 of file path.cpp.
References begin(), end(), is_directory_, and SEPARATOR_CHAR.
|
friend |
Parse URI path, returning whether found or not and advancing first and setting path if found.
Does not skip leading space.
If errs is specified the following take place:
errs. The segment is used without decoding (i.e. assumes an unencoded ''). Definition at line 169 of file path.cpp.
Referenced by path().
|
private |
Definition at line 116 of file path.h.
Referenced by clear(), match_prefix(), operator+=(), operator<(), operator==(), te::common::uri::parse(), pop_back(), and pop_front().
|
private |
Definition at line 117 of file path.h.
Referenced by clear(), encoding(), match_prefix(), operator+=(), operator<(), operator==(), te::common::uri::parse(), pop_back(), pop_front(), and string().
|
private |
Definition at line 118 of file path.h.
Referenced by back(), clear(), encoding(), front(), operator+=(), operator<(), operator==(), te::common::uri::parse(), pop_back(), and pop_front().
|
static |
separator ('/')
Definition at line 113 of file path.h.
Referenced by encoding(), te::common::uri::parse(), and string().