![]() |
Gorgon Game Engine
|
Helps to manage URIPaths. More...
Public Member Functions | |
URIPath ()=default | |
Empty constructor. More... | |
URIPath (const char *path) | |
Parses the given path. More... | |
URIPath (const std::string &path) | |
Parses the given path. More... | |
URIPath (std::initializer_list< std::string > init) | |
Initializes the path by the given segments. More... | |
void | Combine (const URIPath &another) |
Combines another URIPath using this one as the root. More... | |
std::string | Convert () const |
Converts the path to string properly escaping for URI. More... | |
std::string | Get (int ind) const |
Returns the segment at the given index. Index 0 will never cause an error, if does not exists, it will be empty string. More... | |
int | GetSize () const |
void | Normalize () |
Normalizes any relative references in the path. May throw URIError. More... | |
operator std::string () const | |
Converts the path to string properly escaping for URI. More... | |
bool | operator!= (const URIPath &other) const |
Compares two paths after normalization. More... | |
URIPath | operator+ (const URIPath &another) const |
Combines this path with another, using this path as the root. More... | |
URIPath & | operator+= (const URIPath &another) |
Combines another URIPath into this one, using this path as the root. More... | |
bool | operator== (const URIPath &other) const |
Compares two paths after normalization. More... | |
std::string & | operator[] (int ind) |
Returns the segment at the given index. More... | |
const std::string & | operator[] (int ind) const |
Returns the segment at the given index. More... | |
std::string | StripFirst () |
Returns the first segment and removes it from the list of segments. More... | |
Public Attributes | |
std::vector< std::string > | segments |
List of segments. More... | |
Helps to manage URIPaths.
Note that the URI paths are always absolute. Allows normalization as well as remapping, which would be useful to convert URI paths to file system paths.
URIPath | ( | std::initializer_list< std::string > | init | ) |
Initializes the path by the given segments.
URIPath | ( | const std::string & | path | ) |
Parses the given path.
References URIPath::segments.
URIPath | ( | const char * | path | ) |
Parses the given path.
void Combine | ( | const URIPath & | another | ) |
Combines another URIPath using this one as the root.
References URIPath::segments.
std::string Convert | ( | ) | const |
Converts the path to string properly escaping for URI.
std::string Get | ( | int | ind | ) | const |
Returns the segment at the given index. Index 0 will never cause an error, if does not exists, it will be empty string.
References URIPath::segments.
int GetSize | ( | ) | const |
References URIPath::segments.
void Normalize | ( | ) |
Normalizes any relative references in the path. May throw URIError.
References URIPath::segments.
operator std::string | ( | ) | const |
Converts the path to string properly escaping for URI.
bool operator!= | ( | const URIPath & | other | ) | const |
Compares two paths after normalization.
Combines this path with another, using this path as the root.
References URIPath::Combine().
Combines another URIPath into this one, using this path as the root.
References URIPath::Combine().
bool operator== | ( | const URIPath & | other | ) | const |
Compares two paths after normalization.
References URIPath::Normalize().
std::string& operator[] | ( | int | ind | ) |
Returns the segment at the given index.
References URIPath::segments.
const std::string& operator[] | ( | int | ind | ) | const |
Returns the segment at the given index.
References URIPath::segments.
std::string StripFirst | ( | ) |
Returns the first segment and removes it from the list of segments.
This function will never fire error. If there are no segments it will return empty string
References URIPath::segments.
std::vector<std::string> segments |
List of segments.