30 const char*
const kURI_pchar =
"(?:[[:alpha:][:digit:]-._~!$&'()*+,;=:@]|%[0-9A-Fa-f][0-9A-Fa-f])";
165 while (source.
Length() > 0) {
259 Error(
"SetScheme",
"<scheme> component \"%s\" of URI is not compliant with RFC 3986.", scheme.
Data());
273 "^[[:alpha:]][[:alpha:][:digit:]+-.]*$" 309 Error(
"SetQuery",
"<query> component \"%s\" of URI is not compliant with RFC 3986.", query.
Data());
350 Error(
"SetAuthority",
"<authority> component \"%s\" of URI is not compliant with RFC 3986.", authority.
Data());
416 Error(
"SetUserInfo",
"<userinfo> component \"%s\" of URI is not compliant with RFC 3986.", userinfo.
Data());
432 ).Match(
string) > 0 && !
TString(
string).Contains(
"@"));
449 Error(
"SetHost",
"<host> component \"%s\" of URI is not compliant with RFC 3986.", host.
Data());
467 Error(
"SetPort",
"<port> component \"%s\" of URI is not compliant with RFC 3986.", port.
Data());
488 Error(
"SetPath",
"<path> component \"%s\" of URI is not compliant with RFC 3986.", path.
Data());
505 Error(
"SetFragment",
"<fragment> component \"%s\" of URI is not compliant with RFC 3986.", fragment.
Data());
520 ).Match(
string) > 0);
530 if (strcmp(option,
"d") != 0) {
545 printf(
"path flags: ");
554 printf(
"\nURI flags: ");
556 printf(
"absolute-URI ");
558 printf(
"relative-ref ");
562 printf(
"URI-reference ");
608 TPRegexp regexp =
TPRegexp(
"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)([?]([^#]*))?(#(.*))?");
640 Error(
"SetUri",
"URI \"%s\" is not is not compliant with RFC 3986.", uri.
Data());
706 Error(
"SetHierPart",
"<hier-part> component \"%s\" of URI is not compliant with RFC 3986.", hier.
Data());
727 Error(
"SetHierPart",
"<hier-part> component \"%s\" of URI is not compliant with RFC 3986.", hier.
Data());
784 Error(
"SetRelativePath",
"<relative-part> component \"%s\" of URI is not compliant with RFC 3986.", relative.
Data());
804 Error(
"SetRelativePath",
"<relative-part> component \"%s\" of URI is not compliant with RFC 3986.", relative.
Data());
822 sink = sink + source[i];
827 sprintf(buffer,
"%%%02X", source[i]);
828 sink = sink + buffer;
874 ).Match(
string) > 0);
889 ).Match(
string) > 0);
904 ).Match(
string) > 0);
939 return (
TPRegexp(
"^[[:digit:]]*$").Match(
string) > 0);
953 "^([[:alpha:][:digit:]-._~!$&'()*+,;=]|%[0-9A-Fa-f][0-9A-Fa-f])*$").Match(
string) > 0);
965 "^([[:digit:]]{1,3}[.]){3}[[:digit:]]{1,3}$").Match(
string) > 0);
1016 while (i < source.
Length()) {
1017 if (source[i] ==
'%') {
1018 if (source.
Length() < i+2) {
1024 char c1 = tolower(source[i + 1]) -
'0';
1028 char c0 = tolower(source[i + 2]) -
'0';
1031 char decoded = c1 << 4 | c0;
1034 sink = sink + decoded;
1045 sink = sink + source[i];
1061 while (i < source.
Length()) {
1062 if (source[i] ==
'%') {
1063 if (source.
Length() < i+2) {
1075 sink = sink + source[i];
1090 while (i < source.
Length()) {
1091 if (source[i] ==
'%') {
1092 if (source.
Length() < i+2) {
1098 char c1 = tolower(source[i + 1]) -
'0';
1102 char c0 = tolower(source[i + 2]) -
'0';
1105 sink = sink + (char)(c1 << 4 | c0);
1110 sink = sink + source[i];
1191 result = basepath(0, last + 1) + reference.
GetPath();
Bool_t IsUri() const
Returns kTRUE if instance qualifies as URI URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] ...
Bool_t IsAbsolute() const
Returns kTRUE if instance qualifies as absolute-URI absolute-URI = scheme ":" hier-part [ "...
static Bool_t IsIpv4(const TString &)
Returns kTRUE, if string holds a valid IPv4 address currently only decimal variant supported...
static Bool_t IsAuthority(const TString &)
Returns kTRUE if string qualifies as valid URI authority: authority = [ userinfo "@" ] host [ ":" p...
const char *const kURI_unreserved
const char *const kURI_pchar
Bool_t SetPath(const TString &path)
Set path component of URI: path = path-abempty ; begins with "/" or is empty ...
Collectable string class.
static Bool_t IsRegName(const TString &)
Returns kTRUE if string qualifies as valid reg-name: reg-name = *( unreserved / pct-encoded / sub-...
void Normalise()
Syntax based normalisation according to RFC chapter 6.2.2.
Bool_t HasRelativePart() const
Bool_t SetHierPart(const TString &hier)
returns hier-part component of URI hier-part = "//" authority path-abempty / path-absol...
TObjArray * MatchS(const TString &s, const TString &mods="", Int_t start=0, Int_t nMaxMatch=10)
Returns a TObjArray of matched substrings as TObjString's.
void ToUpper()
Change string to upper case.
static Bool_t IsUserInfo(const TString &)
Return kTRUE is string qualifies as valid URI userinfo: userinfo = *( unreserved / pct-encoded / s...
Bool_t HasAuthority() const
Bool_t SetUserInfo(const TString &userinfo)
Set userinfo component of URI: userinfo = *( unreserved / pct-encoded / sub-delims / ":" )...
Bool_t SetPort(const TString &port)
Set port component of URI: port = *DIGIT.
void ToLower()
Change string to lower-case.
Int_t Substitute(TString &s, const TString &replace, const TString &mods="", Int_t start=0, Int_t nMatchMax=10)
Substitute replaces the string s by a new string in which matching patterns are replaced by the repla...
This class represents a RFC 3986 compatible URI.
TObject * At(Int_t idx) const
static const TString PctDecode(const TString &source)
Percent-decode the given string according to chapter 2.1 we assume a valid pct-encoded string...
Bool_t SetQuery(const TString &path)
Set query component of URI: query = *( pchar / "/" / "?" ).
const TString GetPath() const
TUri & operator=(const TUri &rhs)
TUri assignment operator.
static const TString PctDecodeUnreserved(const TString &source)
Percent-decode the given string according to chapter 2.1 we assume a valid pct-encoded string...
Bool_t SetUri(const TString &uri)
Parse URI and set the member variables accordingly, returns kTRUE if URI validates, and kFALSE otherwise: URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty.
Bool_t IsRelative() const
Returns kTRUE if instance qualifies as relative-ref relative-ref = relative-part [ "...
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
TObject & operator=(const TObject &rhs)
TObject assignment operator.
const TString GetFragment() const
static const TString PctEncode(const TString &source)
Percent-encode and return the given string according to RFC 3986 in principle, this function cannot f...
Bool_t SetAuthority(const TString &authority)
Set authority part of URI: authority = [ userinfo "@" ] host [ ":" port ].
Bool_t HasFragment() const
static Bool_t IsPathNoscheme(const TString &)
Returns kTRUE if string qualifies as valid path-noscheme component: path-noscheme = segment-nz-nc *( ...
void Reset()
Initialize this URI object.
Bool_t SetScheme(const TString &scheme)
Set scheme component of URI: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ).
const TString GetUri() const
Returns the whole URI - an implementation of chapter 5.3 component recomposition. ...
static Bool_t IsPathEmpty(const TString &)
Returns kTRUE if string qualifies as valid path-empty component: path-empty = 0<pchar>.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Bool_t SetFragment(const TString &fragment)
Set fragment component of URI: fragment = *( pchar / "/" / "?" ).
static TUri Transform(const TUri &reference, const TUri &base)
Transform a URI reference into its target URI using given a base URI.
const TString GetHost() const
static Bool_t IsQuery(const TString &)
Returns kTRUE if string qualifies as URI query: query = *( pchar / "/" / "?" )...
static Bool_t IsRelativePart(const TString &)
Returns kTRUE is string qualifies as relative-part: relative-part = "//" authority path-abempty ...
TString & Remove(Ssiz_t pos)
static Bool_t IsPort(const TString &)
Returns kTRUE if string qualifies as valid port component: RFC 3986: port = *DIGIT...
Ssiz_t Last(char c) const
Find last occurrence of a character c.
const TString GetRelativePart() const
relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-empty ...
Bool_t IsReference() const
Returns kTRUE if instance qualifies as URI-reference URI-reference = URI / relative-ref cf...
Bool_t HasHierPart() const
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
const TString GetAuthority() const
Returns the authority part of the instance: authority = [ userinfo "@" ] host [ ":" port ]...
Mother of all ROOT objects.
friend Bool_t operator==(const TUri &u1, const TUri &u2)
Implementation of a TUri Equivalence operator that uses syntax-based normalisation see chapter 6...
Bool_t SetHost(const TString &host)
Set host component of URI: RFC 3986: host = IP-literal / IPv4address / reg-name implemented: host ...
void Print(Option_t *option="") const
Display function,.
static Bool_t IsPath(const TString &)
Returns kTRUE if string qualifies as valid path component: path = path-abempty ; begins w...
const TString GetHierPart() const
hier-part = "//" authority path-abempty / path-absolute / path-rootless ...
static Bool_t IsHost(const TString &)
Returns kTRUE if string qualifies as valid host component: host = IP-literal / IPv4address / reg-name...
static const TString MergePaths(const TUri &reference, const TUri &base)
RFC 3986, 5.3.2.
Int_t GetEntries() const
Return the number of objects in array (i.e.
static Bool_t IsPathAbempty(const TString &)
Returns kTRUE if string qualifies as valid path-abempty component: path-abempty = *( "/" segment ) s...
static Bool_t IsPathAbsolute(const TString &)
Returns kTRUE if string qualifies as valid path-absolute component path-absolute = "/" [ segment-nz *...
static Bool_t IsUnreserved(const TString &string)
Returns kTRUE, if the given string does not contain RFC 3986 reserved characters unreserved = ALPHA ...
const TString GetQuery() const
Bool_t SetRelativePart(const TString &)
Returns kTRUE is string qualifies as relative-part: relative-part = "//" authority path-abempty ...
static const TString PctNormalise(const TString &source)
Normalise the percent-encoded parts of the string i.e.
Int_t Match(const TString &s, const TString &mods="", Int_t start=0, Int_t nMaxMatch=10, TArrayI *pos=0)
The number of matches is returned, this equals the full match + sub-pattern matches.
static Bool_t IsPathRootless(const TString &)
Returns kTRUE if string qualifies as valid path-rootless component: path-rootless = segment-nz *( "/"...
static Bool_t IsFragment(const TString &)
Returns kTRUE if string qualifies as valid fragment component fragment = *( pchar / "/" / "...
static const TString RemoveDotSegments(const TString &)
This functions implements the "remove_dot_segments" routine of chapter 5.2.4 "for interpreting and re...
static Bool_t IsHierPart(const TString &)
Returns kTRUE if string qualifies as hier-part: hier-part = "//" authority path-abempty ...
const TString GetScheme() const
static Bool_t IsScheme(const TString &)
Returns kTRUE if string qualifies as URI scheme: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "...
const char * Data() const