34 std::string::const_iterator first = v.begin();
35 if (!
parse(first, v.end(), *
this) || first != v.end())
36 throw std::invalid_argument(
"invalid URI fragment: \"" + v +
"\"");
42 bool parse(std::string::const_iterator& first, std::string::const_iterator last,
fragment& v, std::string* errs) {
43 std::string::const_iterator f = first;
52 e =
", invalid encoding (using as is)";
54 if (errs && !e.empty()) {
57 *errs +=
"URI fragment: \"" + tmp.
string_ +
"\"" + e;
bool empty() const
Test if null/empty.
friend bool TECOMMONEXPORT parse(std::string::const_iterator &first, std::string::const_iterator last, fragment &v, std::string *errs)
Parse URI fragment, returning whether found or not and advancing first and setting fragment if found...
bool parse(std::string::const_iterator &first, std::string::const_iterator last, authority &v)
Parse URI authority, returning whether found or not and advancing first and setting authority if foun...
bool parse(const traits &ts, std::string::const_iterator &first, std::string::const_iterator last, std::string &comp, char *endc)
Parse the URI componet, returning whether successful and setting the string and end char and advancin...
std::string encode(const traits &ts, const std::string &comp)
Encode the URI (sub) component.
std::string encoding() const
Calculate encoded string.
bool decode(std::string &s)
Decode the pct-encoded (hex) sequences, if any, return success.
const traits FRAGMENT_TRAITS
fragment traits