29 const char*
const kURI_pchar =
"(?:[[:alpha:][:digit:]-._~!$&'()*+,;=:@]|%[0-9A-Fa-f][0-9A-Fa-f])";
164 while (source.
Length() > 0) {
258 Error(
"SetScheme",
"<scheme> component \"%s\" of URI is not compliant with RFC 3986.", scheme.
Data());
272 "^[[:alpha:]][[:alpha:][:digit:]+-.]*$"
308 Error(
"SetQuery",
"<query> component \"%s\" of URI is not compliant with RFC 3986.", query.
Data());
349 Error(
"SetAuthority",
"<authority> component \"%s\" of URI is not compliant with RFC 3986.", authority.
Data());
415 Error(
"SetUserInfo",
"<userinfo> component \"%s\" of URI is not compliant with RFC 3986.", userinfo.
Data());
431 ).Match(
string) > 0 && !
TString(
string).Contains(
"@"));
448 Error(
"SetHost",
"<host> component \"%s\" of URI is not compliant with RFC 3986.", host.
Data());
466 Error(
"SetPort",
"<port> component \"%s\" of URI is not compliant with RFC 3986.", port.
Data());
487 Error(
"SetPath",
"<path> component \"%s\" of URI is not compliant with RFC 3986.", path.
Data());
504 Error(
"SetFragment",
"<fragment> component \"%s\" of URI is not compliant with RFC 3986.", fragment.
Data());
519 ).Match(
string) > 0);
529 if (strcmp(option,
"d") != 0) {
639 Error(
"SetUri",
"URI \"%s\" is not is not compliant with RFC 3986.", uri.
Data());
705 Error(
"SetHierPart",
"<hier-part> component \"%s\" of URI is not compliant with RFC 3986.", hier.
Data());
726 Error(
"SetHierPart",
"<hier-part> component \"%s\" of URI is not compliant with RFC 3986.", hier.
Data());
783 Error(
"SetRelativePath",
"<relative-part> component \"%s\" of URI is not compliant with RFC 3986.", relative.
Data());
803 Error(
"SetRelativePath",
"<relative-part> component \"%s\" of URI is not compliant with RFC 3986.", relative.
Data());
821 sink = sink + source[i];
826 sprintf(buffer,
"%%%02X", source[i]);
873 ).Match(
string) > 0);
888 ).Match(
string) > 0);
903 ).Match(
string) > 0);
938 return (
TPRegexp(
"^[[:digit:]]*$").Match(
string) > 0);
952 "^([[:alpha:][:digit:]-._~!$&'()*+,;=]|%[0-9A-Fa-f][0-9A-Fa-f])*$").Match(
string) > 0);
964 "^([[:digit:]]{1,3}[.]){3}[[:digit:]]{1,3}$").Match(
string) > 0);
1015 while (i < source.
Length()) {
1016 if (source[i] ==
'%') {
1017 if (source.
Length() < i+2) {
1023 char c1 = tolower(source[i + 1]) -
'0';
1027 char c0 = tolower(source[i + 2]) -
'0';
1030 char decoded = c1 << 4 | c0;
1033 sink = sink + decoded;
1044 sink = sink + source[i];
1060 while (i < source.
Length()) {
1061 if (source[i] ==
'%') {
1062 if (source.
Length() < i+2) {
1074 sink = sink + source[i];
1089 while (i < source.
Length()) {
1090 if (source[i] ==
'%') {
1091 if (source.
Length() < i+2) {
1097 char c1 = tolower(source[i + 1]) -
'0';
1101 char c0 = tolower(source[i + 2]) -
'0';
1104 sink = sink + (char)(c1 << 4 | c0);
1109 sink = sink + source[i];
1190 result = basepath(0, last + 1) + reference.
GetPath();
Ssiz_t Last(char c) const
Find last occurrence of a character c.
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 TString GetScheme() const
const char *const kURI_unreserved
const char *const kURI_pchar
const TString GetFragment() const
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-...
const TString GetHierPart() const
hier-part = "//" authority path-abempty / path-absolute / path-rootless ...
void Normalise()
Syntax based normalisation according to RFC chapter 6.2.2.
const TString GetHost() 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 SetUserInfo(const TString &userinfo)
Set userinfo component of URI: userinfo = *( unreserved / pct-encoded / sub-delims / ":" )...
const TString GetAuthority() const
Returns the authority part of the instance: authority = [ userinfo "@" ] host [ ":" port ]...
Bool_t HasAuthority() const
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.
Bool_t IsReference() const
Returns kTRUE if instance qualifies as URI-reference URI-reference = URI / relative-ref cf...
void Print(Option_t *option="") const
Display function,.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) 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 / "/" / "?" ).
TUri & operator=(const TUri &rhs)
TUri assignment operator.
const char * Data() const
Bool_t IsUri() const
Returns kTRUE if instance qualifies as URI URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] ...
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 HasHierPart() const
Bool_t operator==(const TUri &u1, const TUri &u2)
Implementation of a TUri Equivalence operator that uses syntax-based normalisation see chapter 6...
std::vector< std::vector< double > > Data
TObject & operator=(const TObject &rhs)
TObject assignment operator.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Bool_t IsAbsolute() const
Returns kTRUE if instance qualifies as absolute-URI absolute-URI = scheme ":" hier-part [ "...
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 IsRelative() const
Returns kTRUE if instance qualifies as relative-ref relative-ref = relative-part [ "...
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.
const TString GetPath() const
Bool_t SetScheme(const TString &scheme)
Set scheme component of URI: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ).
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
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 HasFragment() const
const TString GetQuery() const
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 GetRelativePart() const
relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-empty ...
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...
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
Int_t GetEntries() const
Return the number of objects in array (i.e.
Mother of all ROOT objects.
Bool_t SetHost(const TString &host)
Set host component of URI: RFC 3986: host = IP-literal / IPv4address / reg-name implemented: host ...
static Bool_t IsPath(const TString &)
Returns kTRUE if string qualifies as valid path component: path = path-abempty ; begins w...
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.
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 ...
Bool_t HasRelativePart() const
TObject * At(Int_t idx) 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 *( "/"...
ClassImp(TUri) TUri
Constructor that calls SetUri with a complete URI.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
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 ...
static Bool_t IsHierPart(const TString &)
Returns kTRUE if string qualifies as hier-part: hier-part = "//" authority path-abempty ...
static Bool_t IsScheme(const TString &)
Returns kTRUE if string qualifies as URI scheme: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "...