Logo ROOT   6.18/05
Reference Guide
List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
TUrl Class Reference

This class represents a WWW compatible URL.

It provides member functions to return the different parts of an URL. The supported url format is:

[proto://][user[:passwd]@]host[:port]/file.ext[#anchor][?options]
const char * proto
Definition: civetweb.c:16604

Definition at line 35 of file TUrl.h.

Public Member Functions

 TUrl ()
 
 TUrl (const char *url, Bool_t defaultIsFile=kFALSE)
 Parse url character string and split in its different subcomponents. More...
 
 TUrl (const TUrl &url)
 TUrl copy ctor. More...
 
virtual ~TUrl ()
 Cleanup. More...
 
void CleanRelativePath ()
 Recompute the path removing all relative directory jumps via '..'. More...
 
Int_t Compare (const TObject *obj) const
 Compare two urls as strings. More...
 
const char * GetAnchor () const
 
const char * GetFile () const
 
const char * GetFileAndOptions () const
 Return the file and its options (the string specified behind the ?). More...
 
const char * GetHost () const
 
const char * GetHostFQDN () const
 Return fully qualified domain name of url host. More...
 
Int_t GetIntValueFromOptions (const char *key) const
 Return a value for a given key from the URL options as an Int_t, a missing key returns -1. More...
 
const char * GetOptions () const
 
const char * GetPasswd () const
 
Int_t GetPort () const
 
const char * GetProtocol () const
 
const char * GetUrl (Bool_t withDeflt=kFALSE) const
 Return full URL. More...
 
const char * GetUser () const
 
const char * GetValueFromOptions (const char *key) const
 Return a value for a given key from the URL options. More...
 
Bool_t HasOption (const char *key) const
 Returns true if the given key appears in the URL options list. More...
 
Bool_t IsSortable () const
 
Bool_t IsValid () const
 
TUrloperator= (const TUrl &rhs)
 TUrl assignment operator. More...
 
void ParseOptions () const
 Parse URL options into a key/value map. More...
 
void Print (Option_t *option="") const
 Print URL on stdout. More...
 
void SetAnchor (const char *anchor)
 
void SetFile (const char *file)
 
void SetHost (const char *host)
 
void SetOptions (const char *opt)
 
void SetPasswd (const char *pw)
 
void SetPort (Int_t port)
 
void SetProtocol (const char *proto, Bool_t setDefaultPort=kFALSE)
 Set protocol and, optionally, change the port accordingly. More...
 
void SetUrl (const char *url, Bool_t defaultIsFile=kFALSE)
 Parse url character string and split in its different subcomponents. More...
 
void SetUser (const char *user)
 
- Public Member Functions inherited from TObject
 TObject ()
 TObject constructor. More...
 
 TObject (const TObject &object)
 TObject copy ctor. More...
 
virtual ~TObject ()
 TObject destructor. More...
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract. More...
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad. More...
 
virtual void Browse (TBrowser *b)
 Browse object. May be overridden for another default action. More...
 
ULong_t CheckedHash ()
 Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. More...
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs. More...
 
virtual void Clear (Option_t *="")
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility. More...
 
virtual Int_t Compare (const TObject *obj) const
 Compare abstract method. More...
 
virtual void Copy (TObject &object) const
 Copy this to obj. More...
 
virtual void Delete (Option_t *option="")
 Delete this object. More...
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Computes distance from point (px,py) to the object. More...
 
virtual void Draw (Option_t *option="")
 Default Draw method for all objects. More...
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs. More...
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad). More...
 
virtual void Dump () const
 Dump contents of object on stdout. More...
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message. More...
 
virtual void Execute (const char *method, const char *params, Int_t *error=0)
 Execute method on this object with the given parameter string, e.g. More...
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 Execute method on this object with parameters stored in the TObjArray. More...
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute action corresponding to an event at (px,py). More...
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message. More...
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes. More...
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes. More...
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object. More...
 
virtual const char * GetIconName () const
 Returns mime type name of object. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py). More...
 
virtual Option_tGetOption () const
 
virtual const char * GetTitle () const
 Returns title of object. More...
 
virtual UInt_t GetUniqueID () const
 Return the unique object id. More...
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out. More...
 
virtual ULong_t Hash () const
 Return hash value for this object. More...
 
Bool_t HasInconsistentHash () const
 Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. More...
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message. More...
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname". More...
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl. More...
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas. More...
 
void InvertBit (UInt_t f)
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory). More...
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More...
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
virtual Bool_t IsSortable () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
virtual void ls (Option_t *option="") const
 The ls function lists the contents of a class on stdout. More...
 
void MayNotUse (const char *method) const
 Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More...
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification. More...
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete. More...
 
void operator delete (void *ptr)
 Operator delete. More...
 
void operator delete[] (void *ptr)
 Operator delete []. More...
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, void *vp)
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator. More...
 
virtual void Paint (Option_t *option="")
 This method must be overridden if a class wants to paint itself. More...
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list. More...
 
virtual void Print (Option_t *option="") const
 This method must be overridden when a class wants to print itself. More...
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory. More...
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove this object from a list. More...
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename. More...
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save a primitive as a C++ statement(s) on output stream "out". More...
 
void SetBit (UInt_t f)
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f. More...
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object. More...
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id. More...
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message. More...
 
R__ALWAYS_INLINE Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
virtual void UseCurrentStyle ()
 Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More...
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory. More...
 

Static Public Member Functions

static TObjArrayGetSpecialProtocols ()
 Read the list of special protocols from the rootrc files. More...
 
- Static Public Member Functions inherited from TObject
static Long_t GetDtorOnly ()
 Return destructor only flag. More...
 
static Bool_t GetObjectStat ()
 Get status of object stat flag. More...
 
static void SetDtorOnly (void *obj)
 Set destructor only flag. More...
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable. More...
 

Private Types

enum  EStatusBits { kUrlWithDefaultPort = BIT(14) , kUrlHasDefaultPort = BIT(15) }
 

Private Member Functions

void FindFile (char *u, Bool_t stripDoubleSlash=kTRUE)
 Find file and optionally anchor and options. More...
 

Private Attributes

TString fAnchor
 
TString fFile
 
TString fFileOA
 
TString fHost
 
TString fHostFQ
 file with option and anchor More...
 
TString fOptions
 
TMapfOptionsMap
 
TString fPasswd
 
Int_t fPort
 fully qualified host name More...
 
TString fProtocol
 
TString fUrl
 
TString fUser
 

Static Private Attributes

static THashListfgHostFQDNs = 0
 
static TObjArrayfgSpecialProtocols = 0
 map containing options key/value pairs More...
 

Additional Inherited Members

- Public Types inherited from TObject
enum  {
  kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 ,
  kBitMask = 0x00ffffff
}
 
enum  { kSingleKey = BIT(0) , kOverwrite = BIT(1) , kWriteDelete = BIT(2) }
 
enum  EDeprecatedStatusBits { kObjInCanvas = BIT(3) }
 
enum  EStatusBits {
  kCanDelete = BIT(0) , kMustCleanup = BIT(3) , kIsReferenced = BIT(4) , kHasUUID = BIT(5) ,
  kCannotPick = BIT(6) , kNoContextMenu = BIT(8) , kInvalidObject = BIT(13)
}
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 Interface to ErrorHandler (protected). More...
 
void MakeZombie ()
 

#include <TUrl.h>

Inheritance diagram for TUrl:
[legend]

Member Enumeration Documentation

◆ EStatusBits

enum TUrl::EStatusBits
private
Enumerator
kUrlWithDefaultPort 
kUrlHasDefaultPort 

Definition at line 56 of file TUrl.h.

Constructor & Destructor Documentation

◆ TUrl() [1/3]

TUrl::TUrl ( )
inline

Definition at line 59 of file TUrl.h.

◆ TUrl() [2/3]

TUrl::TUrl ( const char *  url,
Bool_t  defaultIsFile = kFALSE 
)

Parse url character string and split in its different subcomponents.

Use IsValid() to check if URL is legal.

url: [proto://][user[:passwd]@]host[:port]/file.ext[?options][#anchor]

Known protocols: http, root, proof, ftp, news and any special protocols defined in the rootrc Url.Special key. The default protocol is "http", unless defaultIsFile is true in which case the url is assumed to be of type "file". If a passwd contains a @ it must be escaped by a \, e.g. "pip@" becomes "pip\\@".

Default ports: http=80, root=1094, proof=1093, ftp=20, news=119. Port #1093 has been assigned by IANA (www.iana.org) to proofd. Port #1094 has been assigned by IANA (www.iana.org) to rootd.

Definition at line 74 of file TUrl.cxx.

◆ TUrl() [3/3]

TUrl::TUrl ( const TUrl url)

TUrl copy ctor.

Definition at line 342 of file TUrl.cxx.

◆ ~TUrl()

TUrl::~TUrl ( )
virtual

Cleanup.

Definition at line 86 of file TUrl.cxx.

Member Function Documentation

◆ CleanRelativePath()

void TUrl::CleanRelativePath ( )

Recompute the path removing all relative directory jumps via '..'.

Definition at line 682 of file TUrl.cxx.

◆ Compare()

Int_t TUrl::Compare ( const TObject obj) const
virtual

Compare two urls as strings.

Reimplemented from TObject.

Definition at line 545 of file TUrl.cxx.

◆ FindFile()

void TUrl::FindFile ( char *  u,
Bool_t  stripDoubleSlash = kTRUE 
)
private

Find file and optionally anchor and options.

Definition at line 284 of file TUrl.cxx.

◆ GetAnchor()

const char * TUrl::GetAnchor ( ) const
inline

Definition at line 73 of file TUrl.h.

◆ GetFile()

const char * TUrl::GetFile ( ) const
inline

Definition at line 72 of file TUrl.h.

◆ GetFileAndOptions()

const char * TUrl::GetFileAndOptions ( ) const

Return the file and its options (the string specified behind the ?).

Convenience function useful when the option is used to pass authentication/access information for the specified file.

Definition at line 499 of file TUrl.cxx.

◆ GetHost()

const char * TUrl::GetHost ( ) const
inline

Definition at line 70 of file TUrl.h.

◆ GetHostFQDN()

const char * TUrl::GetHostFQDN ( ) const

Return fully qualified domain name of url host.

If host cannot be resolved or not valid return the host name as originally specified.

Definition at line 467 of file TUrl.cxx.

◆ GetIntValueFromOptions()

Int_t TUrl::GetIntValueFromOptions ( const char *  key) const

Return a value for a given key from the URL options as an Int_t, a missing key returns -1.

Definition at line 658 of file TUrl.cxx.

◆ GetOptions()

const char * TUrl::GetOptions ( ) const
inline

Definition at line 74 of file TUrl.h.

◆ GetPasswd()

const char * TUrl::GetPasswd ( ) const
inline

Definition at line 69 of file TUrl.h.

◆ GetPort()

Int_t TUrl::GetPort ( ) const
inline

Definition at line 81 of file TUrl.h.

◆ GetProtocol()

const char * TUrl::GetProtocol ( ) const
inline

Definition at line 67 of file TUrl.h.

◆ GetSpecialProtocols()

TObjArray * TUrl::GetSpecialProtocols ( )
static

Read the list of special protocols from the rootrc files.

These protocols will be parsed in a protocol and a file part, no host or other info will be determined. This is typically used for legacy file descriptions like: file:/path/file.root.

Definition at line 569 of file TUrl.cxx.

◆ GetUrl()

const char * TUrl::GetUrl ( Bool_t  withDeflt = kFALSE) const

Return full URL.

If withDflt is kTRUE, explicitly add the port even if it matches the default value for the URL protocol.

Definition at line 385 of file TUrl.cxx.

◆ GetUser()

const char * TUrl::GetUser ( ) const
inline

Definition at line 68 of file TUrl.h.

◆ GetValueFromOptions()

const char * TUrl::GetValueFromOptions ( const char *  key) const

Return a value for a given key from the URL options.

Returns 0 in case key is not found.

Definition at line 646 of file TUrl.cxx.

◆ HasOption()

Bool_t TUrl::HasOption ( const char *  key) const

Returns true if the given key appears in the URL options list.

Definition at line 669 of file TUrl.cxx.

◆ IsSortable()

Bool_t TUrl::IsSortable ( ) const
inlinevirtual

Reimplemented from TObject.

Definition at line 94 of file TUrl.h.

◆ IsValid()

Bool_t TUrl::IsValid ( ) const
inline

Definition at line 82 of file TUrl.h.

◆ operator=()

TUrl & TUrl::operator= ( const TUrl rhs)

TUrl assignment operator.

Definition at line 361 of file TUrl.cxx.

◆ ParseOptions()

void TUrl::ParseOptions ( ) const

Parse URL options into a key/value map.

Definition at line 615 of file TUrl.cxx.

◆ Print()

void TUrl::Print ( Option_t option = "") const
virtual

Print URL on stdout.

Reimplemented from TObject.

Definition at line 555 of file TUrl.cxx.

◆ SetAnchor()

void TUrl::SetAnchor ( const char *  anchor)
inline

Definition at line 89 of file TUrl.h.

◆ SetFile()

void TUrl::SetFile ( const char *  file)
inline

Definition at line 88 of file TUrl.h.

◆ SetHost()

void TUrl::SetHost ( const char *  host)
inline

Definition at line 87 of file TUrl.h.

◆ SetOptions()

void TUrl::SetOptions ( const char *  opt)
inline

Definition at line 90 of file TUrl.h.

◆ SetPasswd()

void TUrl::SetPasswd ( const char *  pw)
inline

Definition at line 86 of file TUrl.h.

◆ SetPort()

void TUrl::SetPort ( Int_t  port)
inline

Definition at line 91 of file TUrl.h.

◆ SetProtocol()

void TUrl::SetProtocol ( const char *  proto,
Bool_t  setDefaultPort = kFALSE 
)

Set protocol and, optionally, change the port accordingly.

Definition at line 518 of file TUrl.cxx.

◆ SetUrl()

void TUrl::SetUrl ( const char *  url,
Bool_t  defaultIsFile = kFALSE 
)

Parse url character string and split in its different subcomponents.

Use IsValid() to check if URL is legal.

url: [proto://][user[:passwd]@]host[:port]/file.ext[?options][#anchor]

Known protocols: http, root, proof, ftp, news and any special protocols defined in the rootrc Url.Special key. The default protocol is "http", unless defaultIsFile is true in which case the url is assumed to be of type "file". If a passwd contains a @ it must be escaped by a \, e.g. "pip@" becomes "pip\\@".

Default ports: http=80, root=1094, proof=1093, ftp=20, news=119. Port #1093 has been assigned by IANA (www.iana.org) to proofd. Port #1094 has been assigned by IANA (www.iana.org) to rootd.

Definition at line 108 of file TUrl.cxx.

◆ SetUser()

void TUrl::SetUser ( const char *  user)
inline

Definition at line 85 of file TUrl.h.

Member Data Documentation

◆ fAnchor

TString TUrl::fAnchor
private

Definition at line 44 of file TUrl.h.

◆ fFile

TString TUrl::fFile
private

Definition at line 43 of file TUrl.h.

◆ fFileOA

TString TUrl::fFileOA
mutableprivate

Definition at line 46 of file TUrl.h.

◆ fgHostFQDNs

THashList * TUrl::fgHostFQDNs = 0
staticprivate

Definition at line 52 of file TUrl.h.

◆ fgSpecialProtocols

TObjArray * TUrl::fgSpecialProtocols = 0
staticprivate

map containing options key/value pairs

Definition at line 51 of file TUrl.h.

◆ fHost

TString TUrl::fHost
private

Definition at line 42 of file TUrl.h.

◆ fHostFQ

TString TUrl::fHostFQ
mutableprivate

file with option and anchor

Definition at line 47 of file TUrl.h.

◆ fOptions

TString TUrl::fOptions
private

Definition at line 45 of file TUrl.h.

◆ fOptionsMap

TMap* TUrl::fOptionsMap
mutableprivate

Definition at line 49 of file TUrl.h.

◆ fPasswd

TString TUrl::fPasswd
private

Definition at line 41 of file TUrl.h.

◆ fPort

Int_t TUrl::fPort
private

fully qualified host name

Definition at line 48 of file TUrl.h.

◆ fProtocol

TString TUrl::fProtocol
private

Definition at line 39 of file TUrl.h.

◆ fUrl

TString TUrl::fUrl
mutableprivate

Definition at line 38 of file TUrl.h.

◆ fUser

TString TUrl::fUser
private

Definition at line 40 of file TUrl.h.

Libraries for TUrl:
[legend]

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