DCL 3.7.4
Loading...
Searching...
No Matches
URI Class Reference

#include <URI.h>

Inheritance diagram for URI:
Object

Protected Member Functions

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 *)
Protected Member Functions inherited from Object
virtual ~Object ()
 Object ()

Protected Attributes

String __scheme
String __schemeSpecificPart
String __authority
String __userInfo
String __host
int __port
String __path
String __query
String __fragment
String __uri

Additional Inherited Members

Public Member Functions inherited from Object
virtual void destroy ()
String className () const
bool isInstanceOf (const std::type_info &typeinfo) const
virtual const std::type_info & typeInfo () const

Detailed Description

Definition at line 35 of file URI.h.

Member Function Documentation

◆ assign()

void URI::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 )
protected

Definition at line 201 of file URI.cpp.

210{
211 StringBuilder r;
212 if (_scheme) {
213 r = _scheme;
214 r += __T(":");
215 }
216
217 if (_userInfo || _host || _port > -1)
218 r += __T("//");
219
220 if (_userInfo) {
221 r += _userInfo;
222 r += __T("@");
223 }
224
225 if (_host)
226 r += _host;
227
228 if (_port > -1) {
229 r +=__T( ":");
230 r += Integer::toString(_port);
231 }
232
233 if (_path)
234 r += _path;
235
236 if (_query) {
237 r += __T("?");
238 r += _query;
239 }
240
241 if (_fragment) {
242 r += __T("#");
243 r += _fragment;
244 }
245
246 parse(r);
247}
IOException *size_t r
Definition MediaInfo.cpp:82
#define __T(str)
Definition Object.h:60
String toString(unsigned _base=10) const
Definition Numeric.inl:21
void parse(const wchar_t *_uri) __DCL_THROWS1(URISyntaxException *)
Definition URI.cpp:266

◆ parse()

void URI::parse ( const wchar_t * _uri)
protected

Definition at line 266 of file URI.cpp.

268{
269 __DCL_ASSERT(_uri && *_uri);
270
271 Regex re(__REGEXP_URI);
272 {
273 Regex::MatchResults m; // aMatch[11];
274 if (!re.match(_uri, m)) {
275 throw new URISyntaxException(
276 __T("doesn't match URI regular expression"),
277 _uri
278 );
279 }
280
281#define __MATCH_STR(m, index) m[index].first, m[index].second
282
286 __path.assign(__MATCH_STR(m, PATH_GROUP));
287 __query.assign(__MATCH_STR(m, QUERY_GROUP));
289 }
290
291 if (__authority.isEmpty())
292 return;
293
294 re.compile(__REGEXP_AUTHORITY);
295 {
296 Regex::MatchResults m;
297 if (re.match(__authority, m)) {
300 String port(__MATCH_STR(m, AUTHORITY_PORT_GROUP));
301 __port = Integer::parse(port, 10, __port);
302 }
303 }
304 __uri = _uri;
305}
#define __DCL_ASSERT(expr)
Definition Object.h:394
#define QUERY_GROUP
Definition URI.cpp:259
#define AUTHORITY_USERINFO_GROUP
Definition URI.cpp:262
#define FRAGMENT_GROUP
Definition URI.cpp:260
#define SCHEME_SPEC_PART_GROUP
Definition URI.cpp:256
#define SCHEME_GROUP
Definition URI.cpp:255
#define AUTHORITY_GROUP
Definition URI.cpp:257
#define AUTHORITY_HOST_GROUP
Definition URI.cpp:263
#define AUTHORITY_PORT_GROUP
Definition URI.cpp:264
#define PATH_GROUP
Definition URI.cpp:258
#define __MATCH_STR(m, index)
static int parse(const wchar_t *_number, unsigned _base=10) __DCL_THROWS1(NumericConvertException *)
Definition Numeric.inl:36
int __port
Definition URI.h:89
String __uri
Definition URI.h:94
String __authority
Definition URI.h:86
String __userInfo
Definition URI.h:87
String __fragment
Definition URI.h:92
String __query
Definition URI.h:91
String __scheme
Definition URI.h:84
String __schemeSpecificPart
Definition URI.h:85
String __host
Definition URI.h:88
String __path
Definition URI.h:90

Member Data Documentation

◆ __authority

String URI::__authority
protected

Definition at line 86 of file URI.h.

◆ __fragment

String URI::__fragment
protected

Definition at line 92 of file URI.h.

◆ __host

String URI::__host
protected

Definition at line 88 of file URI.h.

◆ __path

String URI::__path
protected

Definition at line 90 of file URI.h.

◆ __port

int URI::__port
protected

Definition at line 89 of file URI.h.

◆ __query

String URI::__query
protected

Definition at line 91 of file URI.h.

◆ __scheme

String URI::__scheme
protected

Definition at line 84 of file URI.h.

◆ __schemeSpecificPart

String URI::__schemeSpecificPart
protected

Definition at line 85 of file URI.h.

◆ __uri

String URI::__uri
protected

Definition at line 94 of file URI.h.

◆ __userInfo

String URI::__userInfo
protected

Definition at line 87 of file URI.h.


The documentation for this class was generated from the following files: