7#if __DCL_HAVE_ALLOC_DEBUG
8#undef __DCL_ALLOC_LEVEL
9#define __DCL_ALLOC_LEVEL __DCL_ALLOC_INTERNAL
25static int hextoi(
const char* _s)
34 int r = ((
'0' <= c && c <=
'9') ? c -
'0' : c -
'a' + 10) * 16;
41 r += (
'0' <= c && c <=
'9') ? c -
'0' : c -
'a' + 10;
49 while (_begin < _end) {
54 && (_begin + 2) < _end
55 && isxdigit(*(_begin +1))
56 && isxdigit(*(_begin + 2))
59 r += (char)hextoi(_begin + 1);
76 return UTF8Decoder::decode(
78 UTF8Encoder::encode(_str)
85 static unsigned char hexchars[] =
"0123456789ABCDEF";
89 const char* psz = _str.data();
92 unsigned char c = (
unsigned char)*psz;
95 else if ((c <
'0' && c !=
'-' && c !=
'.')
96 || (c <
'A' && c >
'9')
97 || (c >
'Z' && c <
'a' && c !=
'_')
101 r += (char)hexchars[c >> 4];
102 r += (char)hexchars[c & 15];
114 UTF8Encoder::encode(_str)
121URI::URI(
const wchar_t* _uri)
128URI::URI(
const wchar_t* _scheme,
129 const wchar_t* _schemeSpecificPart,
130 const wchar_t* _fragment
145URI::URI(
const wchar_t* _scheme,
146 const wchar_t* _userInfo,
147 const wchar_t* _host,
149 const wchar_t* _path,
150 const wchar_t* _query,
151 const wchar_t* _fragment
166URI::URI(
const wchar_t* _scheme,
167 const wchar_t* _host,
168 const wchar_t* _path,
169 const wchar_t* _fragment
184URI::URI(
const wchar_t* _scheme,
185 const wchar_t* _authority,
186 const wchar_t* _path,
187 const wchar_t* _query,
188 const wchar_t* _fragment
204 const wchar_t* _scheme,
205 const wchar_t* _userInfo,
206 const wchar_t* _host,
208 const wchar_t* _path,
209 const wchar_t* _query,
210 const wchar_t* _fragment
220 if (_userInfo || _host || _port > -1)
256static const wchar_t*
const __REGEXP_URI =
257 __T(
"^(([^:/?#]+):)?((//([^/?#]*))?([^?#]*)(\\?([^#]*))?)?(#(.*))?");
259static const wchar_t*
const __REGEXP_AUTHORITY =
260 __T(
"^(([^?#]*)@)?([^?#:]*)(:([^?#]*))?");
262#define SCHEME_GROUP 2
263#define SCHEME_SPEC_PART_GROUP 3
264#define AUTHORITY_GROUP 5
267#define FRAGMENT_GROUP 10
269#define AUTHORITY_USERINFO_GROUP 2
270#define AUTHORITY_HOST_GROUP 3
271#define AUTHORITY_PORT_GROUP 5
278 Regex re(__REGEXP_URI);
281 if (!re.
match(_uri, m))
284 __T(
"doesn't match URI regular expression"),
289#define __MATCH_STR(m, index) m[index].first, m[index].second
302 re.
compile(__REGEXP_AUTHORITY);
319URISyntaxException::URISyntaxException(
320 const String& _reason,
321 const String& _source
325 __message = _reason +
__T(
": ") + _source;
#define __DCL_ASSERT(expr)
#define IMPLEMENT_CLASSINFO(class_name, base_class_name)
#define AUTHORITY_USERINFO_GROUP
#define SCHEME_SPEC_PART_GROUP
#define AUTHORITY_HOST_GROUP
#define AUTHORITY_PORT_GROUP
#define __MATCH_STR(m, index)
static String decode(const char *_mbs, size_t _mbslen=(size_t) -1)
virtual String toString() const
String toString(unsigned _base=10) const
static int parse(const wchar_t *_number, unsigned _base=10) __DCL_THROWS1(NumericConvertException *)
bool match(const wchar_t *_begin, const wchar_t *_end, unsigned int _flags) __DCL_THROWS1(RegexException *)
void compile(const wchar_t *_pattern, size_t _n, unsigned int _flags=0) __DCL_THROWS1(RegexException *)
void parse(const wchar_t *_uri) __DCL_THROWS1(URISyntaxException *)
void assign(const wchar_t *_scheme, const wchar_t *_userInfo, const wchar_t *_host, int _port, const wchar_t *_path, const wchar_t *_query, const wchar_t *_fragment) __DCL_THROWS1(URISyntaxException *)
String __schemeSpecificPart
static ByteString decode(const char *_begin, const char *_end)
static ByteString encode(const ByteString &_str)