23 #include <boost/algorithm/string.hpp>
32 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
33 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
34 0,0,0,0,0,0,0,0, 0,0,0,0,0,2,0,0,
35 1,1,1,1,1,1,1,1, 1,1,0,0,0,0,0,0,
36 0,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,
37 1,1,1,1,1,1,1,1, 1,1,1,0,0,0,0,0,
38 0,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,
39 1,1,1,1,1,1,1,1, 1,1,1,0,0,0,0,0,
40 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
41 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
42 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
43 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
44 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
45 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
46 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
47 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
51 std::string::const_iterator first = v.begin();
52 if (!
parse(first, v.end(), *
this) || first != v.end())
53 throw std::invalid_argument(
"invalid domain name: \"" + v +
"\"");
64 bool parse(std::string::const_iterator& first, std::string::const_iterator last,
domain_name& v) {
65 std::string::const_iterator f = first;
67 std::string::const_iterator prev_cls_1 = last;
68 for (; f != last; ++f) {
70 char cls = domain_name::char_class[(
unsigned char)c];
73 if (prev_cls_1 + 1 != f)
75 if (c != domain_name::SEPARATOR_CHAR)
static const char char_class[256]
char class
domain_name & operator+=(const domain_name &rhs)
Append domain name to this and return this.
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...
static const char SEPARATOR_CHAR
separator ('.')
bool is_null() const
Test if null.
friend bool TECOMMONEXPORT parse(std::string::const_iterator &first, std::string::const_iterator last, domain_name &v)
Parse domain name, returning whether found or not and advancing first and setting name if found...
domain_name()
Construct null.