ROOT logo
ROOT » CORE » BASE » TUri

class TUri: public TObject


TUri

This class represents a RFC 3986 compatible URI.
See http://rfc.net/rfc3986.html.
It provides member functions to set and return the different
the different parts of an URI. The functionality is that of
a validating parser.


Function Members (Methods)

public:
TUri()
TUri(const TUri& uri)
TUri(const TString& uri)
TUri(const char* uri)
virtual~TUri()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
const TStringGetAuthority() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
const TStringGetFragment() const
const TStringGetHierPart() const
const TStringGetHost() const
virtual const char*TObject::GetIconName() const
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
const TStringGetPath() const
const TStringGetPort() const
const TStringGetQuery() const
const TStringGetRelativePart() const
const TStringGetScheme() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
const TStringGetUri() const
const TStringGetUserInfo() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
Bool_tHasAuthority() const
Bool_tHasFragment() const
virtual ULong_tTObject::Hash() const
Bool_tHasHierPart() const
Bool_tHasHost() const
Bool_tHasPath() const
Bool_tHasPort() const
Bool_tHasQuery() const
Bool_tHasRelativePart() const
Bool_tHasScheme() const
Bool_tHasUserInfo() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
Bool_tIsAbsolute() const
static Bool_tIsAuthority(const TString&)
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
static Bool_tIsFragment(const TString&)
static Bool_tIsHierPart(const TString&)
static Bool_tIsHost(const TString&)
static Bool_tIsIpv4(const TString&)
Bool_tTObject::IsOnHeap() const
static Bool_tIsPath(const TString&)
static Bool_tIsPathAbempty(const TString&)
static Bool_tIsPathAbsolute(const TString&)
static Bool_tIsPathEmpty(const TString&)
static Bool_tIsPathNoscheme(const TString&)
static Bool_tIsPathRootless(const TString&)
static Bool_tIsPort(const TString&)
static Bool_tIsQuery(const TString&)
Bool_tIsReference() const
static Bool_tIsRegName(const TString&)
Bool_tIsRelative() const
static Bool_tIsRelativePart(const TString&)
static Bool_tIsScheme(const TString&)
virtual Bool_tIsSortable() const
static Bool_tIsUnreserved(const TString& string)
Bool_tIsUri() const
static Bool_tIsUserInfo(const TString&)
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
static const TStringMergePaths(const TUri& reference, const TUri& base)
voidNormalise()
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TUri&operator=(const TUri& rhs)
virtual voidTObject::Paint(Option_t* option = "")
static const TStringPctDecode(const TString& source)
static const TStringPctDecodeUnreserved(const TString& source)
static const TStringPctEncode(const TString& source)
static const TStringPctNormalise(const TString& source)
virtual voidTObject::Pop()
virtual voidPrint(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
static const TStringRemoveDotSegments(const TString&)
voidReset()
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
Bool_tSetAuthority(const TString& authority)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
Bool_tSetFragment(const TString& fragment)
Bool_tSetHierPart(const TString& hier)
Bool_tSetHost(const TString& host)
static voidTObject::SetObjectStat(Bool_t stat)
Bool_tSetPath(const TString& path)
Bool_tSetPort(const TString& port)
Bool_tSetQuery(const TString& path)
Bool_tSetRelativePart(const TString&)
Bool_tSetScheme(const TString& scheme)
virtual voidTObject::SetUniqueID(UInt_t uid)
Bool_tSetUri(const TString& uri)
Bool_tSetUserInfo(const TString& userinfo)
virtual voidShowMembers(TMemberInspector& insp)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
static TUriTransform(const TUri& reference, const TUri& base)
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

private:
TStringfFragment
Bool_tfHasFragment
Bool_tfHasHost
Bool_tfHasPath
Bool_tfHasPort
Bool_tfHasQuery
Bool_tfHasScheme
Bool_tfHasUserinfo
TStringfHostauthority/host: hostname or ip-address
TStringfPath
TStringfPortauthority/port: port number, normally 1-65535
TStringfQuery
TStringfScheme
TStringfUserinfoauthority/userinfo: user@password, ...

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TUri(const TString& uri)
 Constructor that calls SetUri with a complete URI.
TUri(const char* uri)
 Constructor that calls SetUri with a complete URI.
TUri(const TUri& uri)
 TUri copy ctor.
TUri & operator=(const TUri& rhs)
 TUri assignment operator.
const TString GetUri() const
 Returns the whole URI -
 an implementation of chapter 5.3 component recomposition.
 The result URI is composed out of the five basic parts.

 URI         = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
 hier-part   = "//" authority path-abempty
             / path-absolute
             / path-rootless
             / path-empty
const TString RemoveDotSegments(const TString& )
 This functions implements the "remove_dot_segments" routine
 of chapter 5.2.4 "for interpreting and removing the
 special '.' and '..' complete path segments from a
 referenced path".
Bool_t IsAbsolute() const
 Returns kTRUE if instance qualifies as absolute-URI
 absolute-URI  = scheme ":" hier-part [ "?" query ]
 cf. Appendix A.
Bool_t IsRelative() const
 Returns kTRUE if instance qualifies as relative-ref
 relative-ref  = relative-part [ "?" query ] [ "#" fragment ]
 cf. Appendix A.
Bool_t IsUri() const
 Returns kTRUE if instance qualifies as URI
 URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
 cf. Appendix A.
Bool_t IsReference() const
 Returns kTRUE if instance qualifies as URI-reference
 URI-reference = URI / relative-ref
 cf. Appendix A.
Bool_t SetScheme(const TString& scheme)
 Set scheme component of URI:
 scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
Bool_t IsScheme(const TString& )
 Returns kTRUE if string qualifies as URI scheme:
 scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
const TString GetAuthority() const
 Returns the authority part of the instance:
 authority   = [ userinfo "@" ] host [ ":" port ]
Bool_t SetQuery(const TString& path)
 Set query component of URI:
 query       = *( pchar / "/" / "?" )
Bool_t IsQuery(const TString& )
 Returns kTRUE if string qualifies as URI query:
 query       = *( pchar / "/" / "?" )
Bool_t SetAuthority(const TString& authority)
 Set authority part of URI:
 authority   = [ userinfo "@" ] host [ ":" port ]

 Split into components {userinfo@, host, :port},
 remember that according to the RFC, it is necessary to
 distinguish between missing component (no delimiter)
 and empty component (delimiter present).
Bool_t IsAuthority(const TString& )
 Returns kTRUE if string qualifies as valid URI authority:
 authority   = [ userinfo "@" ] host [ ":" port ]
Bool_t SetUserInfo(const TString& userinfo)
 Set userinfo component of URI:
 userinfo    = *( unreserved / pct-encoded / sub-delims / ":" )
Bool_t IsUserInfo(const TString& )
 Return kTRUE is string qualifies as valid URI userinfo:
 userinfo    = *( unreserved / pct-encoded / sub-delims / ":" )
 this equals to pchar without the '@' character
Bool_t SetHost(const TString& host)
 Set host component of URI:
 RFC 3986:    host = IP-literal / IPv4address / reg-name
 implemented: host =  IPv4address / reg-name
Bool_t SetPort(const TString& port)
 Set port component of URI:
 port        = *DIGIT
Bool_t SetPath(const TString& path)
 Set path component of URI:
 path          = path-abempty    ; begins with "/" or is empty
               / path-absolute   ; begins with "/" but not "//"
               / path-noscheme   ; begins with a non-colon segment
               / path-rootless   ; begins with a segment
               / path-empty      ; zero characters
Bool_t SetFragment(const TString& fragment)
 Set fragment component of URI:
 fragment    = *( pchar / "/" / "?" )
Bool_t IsFragment(const TString& )
 Returns kTRUE if string qualifies as valid fragment component
 fragment    = *( pchar / "/" / "?" )
void Print(Option_t* option = "") const
 Display function,
 option "d" .. debug output
 anything else .. simply print URI.
void Reset()
 Initialize this URI object.
 Set all TString members to empty string,
 set all Bool_t members to kFALSE.
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

const TString GetHierPart() const
 hier-part   = "//" authority path-abempty
             / path-absolute
             / path-rootless
             / path-empty
const TString GetRelativePart() const
 relative-part = "//" authority path-abempty
               / path-absolute
               / path-noscheme
               / path-empty
Bool_t SetHierPart(const TString& hier)
 returns hier-part component of URI
 hier-part   = "//" authority path-abempty
             / path-absolute
             / path-rootless
             / path-empty

Bool_t IsHierPart(const TString& )
 Returns kTRUE if string qualifies as hier-part:

 hier-part   = "//" authority path-abempty
             / path-absolute
             / path-rootless
             / path-empty
Bool_t IsRelativePart(const TString& )
 Returns kTRUE is string qualifies as relative-part:
 relative-part = "//" authority path-abempty
               / path-absolute
               / path-noscheme
               / path-empty
Bool_t SetRelativePart(const TString& )
 Returns kTRUE is string qualifies as relative-part:
 relative-part = "//" authority path-abempty
               / path-absolute
               / path-noscheme
               / path-empty
const TString PctEncode(const TString& source)
 Percent-encode and return the given string according to RFC 3986
 in principle, this function cannot fail or produce an error.
Bool_t IsHost(const TString& )
 Returns kTRUE if string qualifies as valid host component:
 host = IP-literal / IPv4address / reg-name
 implemented: host =  IPv4address / reg-name
Bool_t IsPath(const TString& )
 Retruns kTRUE if string qualifies as valid path component:
 path          = path-abempty    ; begins with "/" or is empty
               / path-absolute   ; begins with "/" but not "//"
               / path-noscheme   ; begins with a non-colon segment
               / path-rootless   ; begins with a segment
               / path-empty      ; zero characters
Bool_t IsPathAbempty(const TString& )
 Returns kTRUE if string qualifies as valid path-abempty component:
    path-abempty  = *( "/" segment )
    segment       = *pchar
Bool_t IsPathAbsolute(const TString& )
 Returns kTRUE if string qualifies as valid path-absolute component
    path-absolute = "/" [ segment-nz *( "/" segment ) ]
    segment-nz    = 1*pchar
    segment       = *pchar
Bool_t IsPathNoscheme(const TString& )
 Returns kTRUE if string qualifies as valid path-noscheme component:
 path-noscheme = segment-nz-nc *( "/" segment )
 segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
 segment       = *pchar
Bool_t IsPathRootless(const TString& )
 Returns kTRUE if string qualifies as valid path-rootless component:
 path-rootless = segment-nz *( "/" segment )
Bool_t IsPathEmpty(const TString& )
 Returns kTRUE if string qualifies as valid path-empty component:
 path-empty    = 0<pchar>
Bool_t IsPort(const TString& )
 Returns kTRUE if string qualifies as valid port component:
 RFC 3986: port        = *DIGIT
Bool_t IsRegName(const TString& )
 Returns kTRUE if string qualifies as valid reg-name:

  reg-name    = *( unreserved / pct-encoded / sub-delims )
  sub-delims  = "!" / "$" / "&" / "'" / "(" / ")"
                  / "*" / "+" / "," / ";" / "="

Bool_t IsIpv4(const TString& )
 Returns kTRUE, if string holds a valid IPv4 address
 currently only decimal variant supported.
 Existence of leadig 0s or numeric range remains unchecked
 IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet.

Bool_t IsUnreserved(const TString& string)
 Returns kTRUE, if the given string does not contain
 RFC 3986 reserved characters
 unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"
void Normalise()
 Syntax based normalisation according to
 RFC chapter 6.2.2.
TString const PctDecodeUnreserved(const TString& source)
 Percent-decode the given string according to chapter 2.1
 we assume a valid pct-encoded string.
TString const PctNormalise(const TString& source)
 Normalise the percent-encoded parts of the string
 i.e. uppercase the hexadecimal digits
 %[:alpha:][:alpha:] -> %[:ALPHA:][:ALPHA:]
TString const PctDecode(const TString& source)
 Percent-decode the given string according to chapter 2.1
 we assume a valid pct-encoded string.
TUri Transform(const TUri& reference, const TUri& base)
 Transform a URI reference into its target URI using
 given a base URI.
 This is an implementation of the pseudocode in chapter 5.2.2.
const TString MergePaths(const TUri& reference, const TUri& base)
 RFC 3986, 5.3.2.
 If the base URI has a defined authority component and an empty
 path, then return a string consisting of "/" concatenated with the
 reference's path; otherwise,
 return a string consisting of the reference's path component
 appended to all but the last segment of the base URI's path (i.e.,
 excluding any characters after the right-most "/" in the base URI
 path, or excluding the entire base URI path if it does not contain
 any "/" characters).
TUri(const TUri& uri)
virtual ~TUri()
{ }
const TString GetScheme() const
{ return fScheme; }
const TString GetUserInfo() const
{ return fUserinfo; }
const TString GetHost() const
{ return fHost; }
const TString GetPort() const
{ return fPort; }
const TString GetPath() const
{ return fPath; }
const TString GetQuery() const
{ return fQuery; }
const TString GetFragment() const
{ return fFragment; }
Bool_t HasScheme() const
{ return fHasScheme; }
Bool_t HasHierPart() const
{ return IsHierPart(GetHierPart()); }
Bool_t HasAuthority() const
{ return fHasHost; }
Bool_t HasUserInfo() const
{ return fHasUserinfo; }
Bool_t HasHost() const
{ return fHasHost; }
Bool_t HasPort() const
{ return fHasPort; }
Bool_t HasPath() const
{ return fHasPath; }
Bool_t HasQuery() const
{ return fHasQuery; }
Bool_t HasFragment() const
{ return fHasFragment; }
Bool_t HasRelativePart() const
Bool_t IsSortable() const
{ return kTRUE; }