Classes | |
struct | traits |
Traits used for parsing and encoding components. More... | |
Enumerations | |
enum | char_class_e { CINV = -2, CEND = -1, CVAL = 0, CVA2 = 1 } |
Char class. More... | |
Functions | |
bool URIPP_API | parse (const traits &ts, std::string::const_iterator &first, std::string::const_iterator last, std::string &comp, char *endc=0) |
std::string URIPP_API | encode (const traits &ts, const std::string &comp) |
bool URIPP_API | decode (std::string &s) |
Variables | |
const char URIPP_API | ENCODE_BEGIN_CHAR |
encode begin char ('%') | |
const traits URIPP_API | SCHEME_TRAITS |
scheme traits | |
const traits URIPP_API | AUTHORITY_TRAITS |
authority traits | |
const traits URIPP_API | PATH_TRAITS |
path traits | |
const traits URIPP_API | QUERY_TRAITS |
query traits | |
const traits URIPP_API | FRAGMENT_TRAITS |
fragment traits |
bool URIPP_API uripp::urisyn::parse | ( | const traits & | ts, | |
std::string::const_iterator & | first, | |||
std::string::const_iterator | last, | |||
std::string & | comp, | |||
char * | endc = 0 | |||
) |
Parse the URI componet, returning whether successful and setting the string and end char and advancing if so. This looks for end chars either returning the string up to, but not including, the end char or returning the string up to the first character that is not valid for the component. The arg first
is advanced after the end char if there is one. The arg endc
is set to either 0 if no end char found or to the end char. If the first char is an end char then true is returned and the string will be empty. Leading white space is not skipped.
The component is not decoded and should not be decoded until after futher parsing with the component's subdelimiters, if any.
std::string URIPP_API uripp::urisyn::encode | ( | const traits & | ts, | |
const std::string & | comp | |||
) |
Encode the URI (sub) component. Note that this should be used on the subcomponents before appending to subdelimiter chars, if any.
From the RFC: URI producing applications should percent-encode data octets that correspond to characters in the reserved set unless these characters are specifically allowed by the URI scheme to represent data in that component. If a reserved character is found in a URI component and no delimiting role is known for that character, then it must be interpreted as representing the data octet corresponding to that character's encoding in US-ASCII.
bool URIPP_API uripp::urisyn::decode | ( | std::string & | s | ) |
Decode the pct-encoded (hex) sequences, if any, return success. Does not change string on error.