30const char*
const kURI_pchar =
"(?:[[:alpha:][:digit:]-._~!$&'()*+,;=:@]|%[0-9A-Fa-f][0-9A-Fa-f])";
165 while (source.
Length() > 0) {
167 if (
TPRegexp(
"^\\.\\.?/(.*)$").Substitute(source,
"/$1") > 0)
171 if (
TPRegexp(
"^/\\./(.*)$|^/\\.($)").Substitute(source,
"/$1") > 0)
175 if (
TPRegexp(
"^/\\.\\./(.*)$|^/\\.\\.($)").Substitute(source,
"/$1") > 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();
void Printf(const char *fmt,...)
Bool_t operator==(const TUri &u1, const TUri &u2)
Implementation of a TUri Equivalence operator that uses syntax-based normalisation see chapter 6....
const char *const kURI_unreserved
const char *const kURI_pchar
Int_t GetEntries() const
Return the number of objects in array (i.e.
TObject * At(Int_t idx) const
Collectable string class.
Mother of all ROOT objects.
TObject & operator=(const TObject &rhs)
TObject assignment operator.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
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.
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 ToLower()
Change string to lower-case.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
const char * Data() const
Ssiz_t Last(char c) const
Find last occurrence of a character c.
void ToUpper()
Change string to upper case.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Remove(Ssiz_t pos)
This class represents a RFC 3986 compatible URI.
const TString GetRelativePart() const
relative-part = "//" authority path-abempty
static Bool_t IsPath(const TString &)
Returns kTRUE if string qualifies as valid path component:
Bool_t SetScheme(const TString &scheme)
Set scheme component of URI:
Bool_t IsRelative() const
Returns kTRUE if instance qualifies as relative-ref relative-ref = relative-part [ "?...
static const TString RemoveDotSegments(const TString &)
This functions implements the "remove_dot_segments" routine of chapter 5.2.4 "for interpreting and re...
Bool_t SetFragment(const TString &fragment)
Set fragment component of URI:
Bool_t SetPath(const TString &path)
Set path component of URI:
static Bool_t IsPathAbempty(const TString &)
Returns kTRUE if string qualifies as valid path-abempty component:
Bool_t SetRelativePart(const TString &)
Returns kTRUE is string qualifies as relative-part:
Bool_t IsAbsolute() const
Returns kTRUE if instance qualifies as absolute-URI absolute-URI = scheme ":" hier-part [ "?...
const TString GetHost() const
static Bool_t IsFragment(const TString &)
Returns kTRUE if string qualifies as valid fragment component.
Bool_t SetUserInfo(const TString &userinfo)
Set userinfo component of URI:
static Bool_t IsQuery(const TString &)
Returns kTRUE if string qualifies as URI query:
Bool_t IsUri() const
Returns kTRUE if instance qualifies as URI URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] ...
static const TString PctEncode(const TString &source)
Percent-encode and return the given string according to RFC 3986 in principle, this function cannot f...
static const TString PctNormalise(const TString &source)
Normalise the percent-encoded parts of the string i.e.
const TString GetPath() const
const TString GetHierPart() const
void Normalise()
Syntax based normalisation according to RFC chapter 6.2.2.
static Bool_t IsUserInfo(const TString &)
Return kTRUE is string qualifies as valid URI userinfo:
const TString GetUri() const
Returns the whole URI - an implementation of chapter 5.3 component recomposition.
const TString GetFragment() const
static Bool_t IsPathRootless(const TString &)
Returns kTRUE if string qualifies as valid path-rootless component:
static Bool_t IsHost(const TString &)
Returns kTRUE if string qualifies as valid host component: host = IP-literal / IPv4address / reg-name...
static Bool_t IsScheme(const TString &)
Returns kTRUE if string qualifies as URI scheme:
const TString GetQuery() const
Bool_t SetAuthority(const TString &authority)
Set authority part of URI:
void Print(Option_t *option="") const
Display function,.
static TUri Transform(const TUri &reference, const TUri &base)
Transform a URI reference into its target URI using given a base URI.
void Reset()
Initialize this URI object.
const TString GetAuthority() const
Returns the authority part of the instance:
Bool_t HasFragment() const
static Bool_t IsPort(const TString &)
Returns kTRUE if string qualifies as valid port component:
static Bool_t IsAuthority(const TString &)
Returns kTRUE if string qualifies as valid URI authority:
Bool_t HasRelativePart() const
static Bool_t IsPathNoscheme(const TString &)
Returns kTRUE if string qualifies as valid path-noscheme component:
static const TString MergePaths(const TUri &reference, const TUri &base)
RFC 3986, 5.3.2.
static Bool_t IsPathAbsolute(const TString &)
Returns kTRUE if string qualifies as valid path-absolute component.
static Bool_t IsUnreserved(const TString &string)
Returns kTRUE, if the given string does not contain RFC 3986 reserved characters.
Bool_t SetPort(const TString &port)
Set port component of URI:
Bool_t SetQuery(const TString &path)
Set query component of URI:
Bool_t HasHierPart() const
static Bool_t IsHierPart(const TString &)
Returns kTRUE if string qualifies as hier-part:
static Bool_t IsRelativePart(const TString &)
Returns kTRUE is string qualifies as relative-part:
static Bool_t IsIpv4(const TString &)
Returns kTRUE, if string holds a valid IPv4 address currently only decimal variant supported.
Bool_t IsReference() const
Returns kTRUE if instance qualifies as URI-reference URI-reference = URI / relative-ref cf.
static Bool_t IsPathEmpty(const TString &)
Returns kTRUE if string qualifies as valid path-empty component:
TUri & operator=(const TUri &rhs)
TUri assignment operator.
Bool_t SetUri(const TString &uri)
Parse URI and set the member variables accordingly, returns kTRUE if URI validates,...
Bool_t SetHost(const TString &host)
Set host component of URI:
Bool_t SetHierPart(const TString &hier)
returns hier-part component of URI
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 HasAuthority() const
const TString GetScheme() 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.
static Bool_t IsRegName(const TString &)
Returns kTRUE if string qualifies as valid reg-name: