Logo ROOT  
Reference Guide
TUrl.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Fons Rademakers 17/01/97
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TUrl
13 \ingroup Base
14 
15 This class represents a WWW compatible URL.
16 It provides member functions to return the different parts of
17 an URL. The supported url format is:
18 ~~~ {.cpp}
19  [proto://][user[:passwd]@]host[:port]/file.ext[#anchor][?options]
20 ~~~
21 */
22 
23 #include <stdlib.h>
24 #include "TUrl.h"
25 #include "THashList.h"
26 #include "TObjArray.h"
27 #include "TObjString.h"
28 #include "TEnv.h"
29 #include "TSystem.h"
30 #include "TMap.h"
31 #include "TROOT.h"
32 
34 THashList *TUrl::fgHostFQDNs = nullptr;
35 
36 #ifdef R__COMPLETE_MEM_TERMINATION
37 namespace {
38  class TUrlCleanup {
39  TObjArray **fSpecialProtocols;
40  THashList **fHostFQDNs;
41  public:
42  TUrlCleanup(TObjArray **protocols, THashList **hosts) : fSpecialProtocols(protocols),fHostFQDNs(hosts) {}
43  ~TUrlCleanup() {
44  if (*fSpecialProtocols) (*fSpecialProtocols)->Delete();
45  delete *fSpecialProtocols;
46  *fSpecialProtocols = 0;
47  if (*fHostFQDNs) (*fHostFQDNs)->Delete();
48  delete *fHostFQDNs;
49  *fHostFQDNs = 0;
50  }
51  };
52 }
53 #endif
54 
55 ClassImp(TUrl);
56 
57 ////////////////////////////////////////////////////////////////////////////////
58 /// Parse url character string and split in its different subcomponents.
59 /// Use IsValid() to check if URL is legal.
60 /// ~~~ {.cpp}
61 /// url: [proto://][user[:passwd]@]host[:port]/file.ext[?options][#anchor]
62 /// ~~~
63 /// Known protocols: http, root, proof, ftp, news and any special protocols
64 /// defined in the rootrc Url.Special key.
65 /// The default protocol is "http", unless defaultIsFile is true in which
66 /// case the url is assumed to be of type "file".
67 /// If a passwd contains a @ it must be escaped by a \\, e.g.
68 /// "pip@" becomes "pip\\@".
69 ///
70 /// Default ports: http=80, root=1094, proof=1093, ftp=20, news=119.
71 /// Port #1093 has been assigned by IANA (www.iana.org) to proofd.
72 /// Port #1094 has been assigned by IANA (www.iana.org) to rootd.
73 
74 TUrl::TUrl(const char *url, Bool_t defaultIsFile)
75 {
76  SetUrl(url, defaultIsFile);
77 
78 #ifdef R__COMPLETE_MEM_TERMINATION
79  static TUrlCleanup cleanup(&fgSpecialProtocols,&fgHostFQDNs);
80 #endif
81 }
82 
83 ////////////////////////////////////////////////////////////////////////////////
84 /// Cleanup.
85 
87 {
88  delete fOptionsMap;
89 }
90 
91 ////////////////////////////////////////////////////////////////////////////////
92 /// Parse url character string and split in its different subcomponents.
93 /// Use IsValid() to check if URL is legal.
94 ///~~~ {.cpp}
95 /// url: [proto://][user[:passwd]@]host[:port]/file.ext[?options][#anchor]
96 ///~~~
97 /// Known protocols: http, root, proof, ftp, news and any special protocols
98 /// defined in the rootrc Url.Special key.
99 /// The default protocol is "http", unless defaultIsFile is true in which
100 /// case the url is assumed to be of type "file".
101 /// If a passwd contains a @ it must be escaped by a \\, e.g.
102 /// "pip@" becomes "pip\\@".
103 ///
104 /// Default ports: http=80, root=1094, proof=1093, ftp=20, news=119.
105 /// Port #1093 has been assigned by IANA (www.iana.org) to proofd.
106 /// Port #1094 has been assigned by IANA (www.iana.org) to rootd.
107 
108 void TUrl::SetUrl(const char *url, Bool_t defaultIsFile)
109 {
110  delete fOptionsMap;
111  fOptionsMap = nullptr;
112 
113  if (!url || !url[0]) {
114  fPort = -1;
115  return;
116  }
117 
118  // Set defaults
119  fUrl = "";
120  fProtocol = "http";
121  fUser = "";
122  fPasswd = "";
123  fHost = "";
124  fPort = 80;
125  fFile = "";
126  fAnchor = "";
127  fOptions = "";
128  fFileOA = "";
129  fHostFQ = "";
130 
131  // if url starts with a / consider it as a file url
132  if (url[0] == '/')
133  defaultIsFile = kTRUE;
134 
135  // Find protocol
136  char *s, sav;
137 
138  char *u, *u0 = Strip(url);
139 tryfile:
140  u = u0;
141 
142  // Handle special protocol cases: "file:", etc.
143  for (int i = 0; i < GetSpecialProtocols()->GetEntriesFast(); i++) {
145  TString s1 = os->GetString();
146  int l = s1.Length();
147  Bool_t stripoff = kFALSE;
148  if (s1.EndsWith("/-")) {
149  stripoff = kTRUE;
150  s1 = s1.Strip(TString::kTrailing, '-');
151  l--;
152  }
153  if (!strncmp(u, s1, l)) {
154  if (s1(0) == '/' && s1(l-1) == '/') {
155  // case with file namespace like: /alien/user/file.root
156  fProtocol = s1(1, l-2);
157  if (stripoff)
158  l--; // strip off namespace prefix from file name
159  else
160  l = 0; // leave namespace prefix as part of file name
161  } else {
162  // case with protocol, like: file:/data/file.root
163  fProtocol = s1(0, l-1);
164  }
165  if (!strncmp(u+l, "//", 2))
166  u += l+2;
167  else
168  u += l;
169  fPort = 0;
170 
171  FindFile(u, kFALSE);
172 
173  delete [] u0;
174  return;
175  }
176  }
177 
178  u = u0;
179 
180  char *x, *t, *s2;
181  // allow x:/path as Windows filename
182  if ((s = strstr(u, ":/")) && u+1 != s) {
183  if (*(s+2) != '/') {
184  Error("TUrl", "%s malformed, URL must contain \"://\"", u0);
185  fPort = -1;
186  goto cleanup;
187  }
188  sav = *s;
189  *s = 0;
190  SetProtocol(u, kTRUE);
191  *s = sav;
192  s += 3;
193  // allow url of form: "proto://"
194  } else {
195  if (defaultIsFile) {
196  char *newu = new char [strlen("file:") + strlen(u0) + 1];
197  sprintf(newu, "file:%s", u0);
198  delete [] u0;
199  u0 = newu;
200  goto tryfile;
201  }
202  s = u;
203  }
204 
205  // Find user and passwd
206  u = s;
207  t = s;
208 again:
209  if ((s = strchr(t, '@')) && (
210  ((x = strchr(t, '/')) && s < x) ||
211  ((x = strchr(t, '?')) && s < x) ||
212  ((x = strchr(t, '#')) && s < x) ||
213  (!strchr(t, '/'))
214  )) {
215  if (*(s-1) == '\\') {
216  t = s+1;
217  goto again;
218  }
219  sav = *s;
220  *s = 0;
221  if ((s2 = strchr(u, ':'))) {
222  *s2 = 0;
223  fUser = u;
224  *s2 = ':';
225  s2++;
226  if (*s2) {
227  fPasswd = s2;
228  fPasswd.ReplaceAll("\\@", "@");
229  }
230  } else
231  fUser = u;
232  *s = sav;
233  s++;
234  } else
235  s = u;
236 
237  // Find host
238  u = s;
239  if ((s = strchr(u, ':')) || (s = strchr(u, '/')) || (s = strchr(u, '?')) || (s = strchr(u, '#'))) {
240  if ((strchr (u, ':') > strchr(u, '/')) && (strchr (u, '/')))
241  s = strchr(u, '/');
242  sav = *s;
243  *s = 0;
244  fHost = u;
245  *s = sav;
246  if (sav == ':') {
247  s++;
248  // Get port #
249  if (!*s) {
250  fPort = -1;
251  goto cleanup;
252  }
253  u = s;
254  if ((s = strchr(u, '/')) || (s = strchr(u, '?')) || (s = strchr(u, '#'))) {
255  sav = *s;
256  *s = 0;
257  fPort = atoi(u);
258  *s = sav;
259  } else {
260  fPort = atoi(u);
261  goto cleanup;
262  }
263  }
264  } else {
265  fHost = u;
266  goto cleanup;
267  }
268 
269  if (!*s) goto cleanup;
270 
271  // Find file
272  u = s;
273  if (*u == '/' && fHost.Length())
274  u++;
275 
276  FindFile(u);
277 
278 cleanup:
279  delete [] u0;
280 }
281 
282 ////////////////////////////////////////////////////////////////////////////////
283 /// Find file and optionally anchor and options.
284 
285 void TUrl::FindFile(char *u, Bool_t stripDoubleSlash)
286 {
287  char *s, sav;
288 
289  // Locate anchor and options, if any
290  char *opt = strchr(u, '?');
291  char *anc = strchr(u, '#');
292 
293  // URL invalid if anchor is coming before the options
294  if (opt && anc && opt > anc) {
295  fPort = -1;
296  return;
297  }
298 
299  if ((s = opt) || (s = anc)) {
300  sav = *s;
301  *s = 0;
302  fFile = u;
303  if (stripDoubleSlash)
304  fFile.ReplaceAll("//", "/");
305  *s = sav;
306  s++;
307  if (sav == '?') {
308  // Get options
309  if (!*s) {
310  // options string is empty
311  return;
312  }
313  u = s;
314  if ((s = strchr(u, '#'))) {
315  sav = *s;
316  *s = 0;
317  fOptions = u;
318  *s = sav;
319  s++;
320  } else {
321  fOptions = u;
322  return;
323  }
324  }
325  if (!*s) {
326  // anchor string is empty
327  return;
328  }
329  } else {
330  fFile = u;
331  if (stripDoubleSlash)
332  fFile.ReplaceAll("//", "/");
333  return;
334  }
335 
336  // Set anchor
337  fAnchor = s;
338 }
339 
340 ////////////////////////////////////////////////////////////////////////////////
341 /// TUrl copy ctor.
342 
343 TUrl::TUrl(const TUrl &url) : TObject(url)
344 {
345  fUrl = url.fUrl;
346  fProtocol = url.fProtocol;
347  fUser = url.fUser;
348  fPasswd = url.fPasswd;
349  fHost = url.fHost;
350  fFile = url.fFile;
351  fAnchor = url.fAnchor;
352  fOptions = url.fOptions;
353  fPort = url.fPort;
354  fFileOA = url.fFileOA;
355  fHostFQ = url.fHostFQ;
356  fOptionsMap = nullptr;
357 }
358 
359 ////////////////////////////////////////////////////////////////////////////////
360 /// TUrl assignment operator.
361 
363 {
364  if (this != &rhs) {
365  TObject::operator=(rhs);
366  fUrl = rhs.fUrl;
367  fProtocol = rhs.fProtocol;
368  fUser = rhs.fUser;
369  fPasswd = rhs.fPasswd;
370  fHost = rhs.fHost;
371  fFile = rhs.fFile;
372  fAnchor = rhs.fAnchor;
373  fOptions = rhs.fOptions;
374  fPort = rhs.fPort;
375  fFileOA = rhs.fFileOA;
376  fHostFQ = rhs.fHostFQ;
377  delete fOptionsMap;
378  fOptionsMap = nullptr;
379  }
380  return *this;
381 }
382 
383 ////////////////////////////////////////////////////////////////////////////////
384 /// Return full URL. If withDflt is kTRUE, explicitly add the port even
385 /// if it matches the default value for the URL protocol.
386 
387 const char *TUrl::GetUrl(Bool_t withDeflt) const
388 {
389  if (((TestBit(kUrlWithDefaultPort) && !withDeflt) ||
390  (!TestBit(kUrlWithDefaultPort) && withDeflt)) &&
392  fUrl = "";
393 
394  if (IsValid() && fUrl == "") {
395  // Handle special protocol cases: file:, etc.
396  for (int i = 0; i < GetSpecialProtocols()->GetEntriesFast(); i++) {
398  TString &s = os->String();
399  int l = s.Length();
400  if (fProtocol == s(0, l-1)) {
401  if (fFile[0] == '/')
402  fUrl = fProtocol + "://" + fFile;
403  else
404  fUrl = fProtocol + ":" + fFile;
405  if (fOptions != "") {
406  fUrl += "?";
407  fUrl += fOptions;
408  }
409  if (fAnchor != "") {
410  fUrl += "#";
411  fUrl += fAnchor;
412  }
413  return fUrl;
414  }
415  }
416 
417  Bool_t deflt = kFALSE;
418  if ((!fProtocol.CompareTo("http") && fPort == 80) ||
419  (fProtocol.BeginsWith("proof") && fPort == 1093) ||
420  (fProtocol.BeginsWith("root") && fPort == 1094) ||
421  (!fProtocol.CompareTo("ftp") && fPort == 20) ||
422  (!fProtocol.CompareTo("news") && fPort == 119) ||
423  (!fProtocol.CompareTo("https") && fPort == 443) ||
424  fPort == 0) {
425  deflt = kTRUE;
426  ((TUrl *)this)->SetBit(kUrlHasDefaultPort);
427  }
428 
429  fUrl = fProtocol + "://";
430  if (fUser != "") {
431  fUrl += fUser;
432  if (fPasswd != "") {
433  fUrl += ":";
435  passwd.ReplaceAll("@", "\\@");
436  fUrl += passwd;
437  }
438  fUrl += "@";
439  }
440  if (withDeflt)
441  ((TUrl*)this)->SetBit(kUrlWithDefaultPort);
442  else
443  ((TUrl*)this)->ResetBit(kUrlWithDefaultPort);
444 
445  if (!deflt || withDeflt) {
446  char p[10];
447  sprintf(p, "%d", fPort);
448  fUrl = fUrl + fHost + ":" + p + "/" + fFile;
449  } else
450  fUrl = fUrl + fHost + "/" + fFile;
451  if (fOptions != "") {
452  fUrl += "?";
453  fUrl += fOptions;
454  }
455  if (fAnchor != "") {
456  fUrl += "#";
457  fUrl += fAnchor;
458  }
459  }
460 
461  fUrl.ReplaceAll("////", "///");
462  return fUrl;
463 }
464 
465 ////////////////////////////////////////////////////////////////////////////////
466 /// Return fully qualified domain name of url host. If host cannot be
467 /// resolved or not valid return the host name as originally specified.
468 
469 const char *TUrl::GetHostFQDN() const
470 {
471  if (fHostFQ == "") {
472  // Check if we already resolved it
473  TNamed *fqdn = fgHostFQDNs ? (TNamed *) fgHostFQDNs->FindObject(fHost) : 0;
474  if (!fqdn) {
476  if (adr.IsValid()) {
477  fHostFQ = adr.GetHostName();
478  } else
479  fHostFQ = "-";
481  if (!fgHostFQDNs) {
482  fgHostFQDNs = new THashList;
484  }
487  } else {
488  fHostFQ = fqdn->GetTitle();
489  }
490  }
491  if (fHostFQ == "-")
492  return fHost;
493  return fHostFQ;
494 }
495 
496 ////////////////////////////////////////////////////////////////////////////////
497 /// Return the file and its options (the string specified behind the ?).
498 /// Convenience function useful when the option is used to pass
499 /// authentication/access information for the specified file.
500 
501 const char *TUrl::GetFileAndOptions() const
502 {
503  if (fFileOA == "") {
504  fFileOA = fFile;
505  if (fOptions != "") {
506  fFileOA += "?";
507  fFileOA += fOptions;
508  }
509  if (fAnchor != "") {
510  fFileOA += "#";
511  fFileOA += fAnchor;
512  }
513  }
514  return fFileOA;
515 }
516 
517 ////////////////////////////////////////////////////////////////////////////////
518 /// Set protocol and, optionally, change the port accordingly.
519 
520 void TUrl::SetProtocol(const char *proto, Bool_t setDefaultPort)
521 {
522  fProtocol = proto;
523  if (setDefaultPort) {
524  if (!fProtocol.CompareTo("http"))
525  fPort = 80;
526  else if (!fProtocol.CompareTo("https"))
527  fPort = 443;
528  else if (fProtocol.BeginsWith("proof")) // can also be proofs or proofk
529  fPort = 1093;
530  else if (fProtocol.BeginsWith("root")) // can also be roots or rootk
531  fPort = 1094;
532  else if (!fProtocol.CompareTo("ftp"))
533  fPort = 20;
534  else if (!fProtocol.CompareTo("news"))
535  fPort = 119;
536  else {
537  // generic protocol (no default port)
538  fPort = 0;
539  }
540  }
541  fUrl = "";
542 }
543 
544 ////////////////////////////////////////////////////////////////////////////////
545 /// Compare two urls as strings.
546 
547 Int_t TUrl::Compare(const TObject *obj) const
548 {
549  if (this == obj) return 0;
550  if (TUrl::Class() != obj->IsA()) return -1;
551  return TString(GetUrl()).CompareTo(((TUrl*)obj)->GetUrl(), TString::kExact);
552 }
553 
554 ////////////////////////////////////////////////////////////////////////////////
555 /// Print URL on stdout.
556 
557 void TUrl::Print(Option_t *) const
558 {
559  if (fPort == -1)
560  Printf("Illegal URL");
561 
562  Printf("%s", GetUrl());
563 }
564 
565 ////////////////////////////////////////////////////////////////////////////////
566 /// Read the list of special protocols from the rootrc files.
567 /// These protocols will be parsed in a protocol and a file part,
568 /// no host or other info will be determined. This is typically
569 /// used for legacy file descriptions like: file:/path/file.root.
570 
572 {
574  static Bool_t usedEnv = kFALSE;
575 
576  if (!gEnv) {
577  if (!fgSpecialProtocols)
580  fgSpecialProtocols->Add(new TObjString("file:"));
581  return fgSpecialProtocols;
582  }
583 
584  if (usedEnv)
585  return fgSpecialProtocols;
586 
587  if (fgSpecialProtocols)
589 
590  if (!fgSpecialProtocols)
592 
593  const char *protos = gEnv->GetValue("Url.Special", "file: hpss: dcache: dcap:");
594  usedEnv = kTRUE;
595 
596  if (protos) {
597  Int_t cnt = 0;
598  char *p = StrDup(protos);
599  while (1) {
600  TObjString *proto = new TObjString(strtok(!cnt ? p : 0, " "));
601  if (proto->String().IsNull()) {
602  delete proto;
603  break;
604  }
606  cnt++;
607  }
608  delete [] p;
609  }
610  return fgSpecialProtocols;
611 }
612 
613 
614 ////////////////////////////////////////////////////////////////////////////////
615 /// Parse URL options into a key/value map.
616 
617 void TUrl::ParseOptions() const
618 {
619  if (fOptionsMap) return;
620 
621  TString urloptions = GetOptions();
622  if (urloptions.IsNull())
623  return;
624 
625  TObjArray *objOptions = urloptions.Tokenize("&");
626  for (Int_t n = 0; n < objOptions->GetEntries(); n++) {
627  TString loption = ((TObjString *) objOptions->At(n))->GetName();
628  TObjArray *objTags = loption.Tokenize("=");
629  if (!fOptionsMap) {
630  fOptionsMap = new TMap;
632  }
633  if (objTags->GetEntries() == 2) {
634  TString key = ((TObjString *) objTags->At(0))->GetName();
635  TString value = ((TObjString *) objTags->At(1))->GetName();
636  fOptionsMap->Add(new TObjString(key), new TObjString(value));
637  } else {
638  TString key = ((TObjString *) objTags->At(0))->GetName();
639  fOptionsMap->Add(new TObjString(key), nullptr);
640  }
641  delete objTags;
642  }
643  delete objOptions;
644 }
645 
646 
647 ////////////////////////////////////////////////////////////////////////////////
648 /// Return a value for a given key from the URL options.
649 /// Returns 0 in case key is not found.
650 
651 const char *TUrl::GetValueFromOptions(const char *key) const
652 {
653  if (!key) return nullptr;
654  ParseOptions();
655  TObject *option = fOptionsMap ? fOptionsMap->GetValue(key) : nullptr;
656  return option ? option->GetName() : nullptr;
657 }
658 
659 ////////////////////////////////////////////////////////////////////////////////
660 /// Return a value for a given key from the URL options as an Int_t,
661 /// a missing key returns -1.
662 
663 Int_t TUrl::GetIntValueFromOptions(const char *key) const
664 {
665  if (!key) return -1;
666  ParseOptions();
667  TObject *option = fOptionsMap ? fOptionsMap->GetValue(key) : nullptr;
668  return option ? atoi(option->GetName()) : -1;
669 }
670 
671 ////////////////////////////////////////////////////////////////////////////////
672 /// Returns true if the given key appears in the URL options list.
673 
674 Bool_t TUrl::HasOption(const char *key) const
675 {
676  if (!key) return kFALSE;
677  ParseOptions();
678 
679  return fOptionsMap && fOptionsMap->FindObject(key);
680 }
681 
682 ////////////////////////////////////////////////////////////////////////////////
683 /// Recompute the path removing all relative directory jumps via '..'.
684 
686 {
687  Ssiz_t slash = 0;
688  while ( (slash = fFile.Index("/..") ) != kNPOS) {
689  // find backwards the next '/'
690  Bool_t found = kFALSE;
691  for (int l = slash-1; l >=0; l--) {
692  if (fFile[l] == '/') {
693  // found previous '/'
694  fFile.Remove(l, slash+3-l);
695  found = kTRUE;
696  break;
697  }
698  }
699  if (!found)
700  break;
701  }
702 }
l
auto * l
Definition: textangle.C:4
n
const Int_t n
Definition: legend1.C:16
TUrl::fUser
TString fUser
Definition: TUrl.h:38
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TObjArray::Delete
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
Definition: TObjArray.cxx:356
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
TUrl::fPort
Int_t fPort
fully qualified host name
Definition: TUrl.h:46
TObjArray
Definition: TObjArray.h:37
TUrl::GetValueFromOptions
const char * GetValueFromOptions(const char *key) const
Return a value for a given key from the URL options.
Definition: TUrl.cxx:651
TUrl::fFileOA
TString fFileOA
Definition: TUrl.h:44
kNPOS
const Ssiz_t kNPOS
Definition: RtypesCore.h:115
gEnv
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
TSystem::GetHostByName
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
Definition: TSystem.cxx:2329
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:54
TObjString.h
TInetAddress::GetHostName
const char * GetHostName() const
Definition: TInetAddress.h:77
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:890
TCollection::SetOwner
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Definition: TCollection.cxx:746
TUrl::fgSpecialProtocols
static TObjArray * fgSpecialProtocols
map containing options key/value pairs
Definition: TUrl.h:49
TUrl::Compare
Int_t Compare(const TObject *obj) const
Compare two urls as strings.
Definition: TUrl.cxx:547
TUrl::fProtocol
TString fProtocol
Definition: TUrl.h:37
TMap::GetValue
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
Definition: TMap.cxx:236
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:168
TObjString::GetString
const TString & GetString() const
Definition: TObjString.h:52
TMap::SetOwnerKeyValue
virtual void SetOwnerKeyValue(Bool_t ownkeys=kTRUE, Bool_t ownvals=kTRUE)
Set ownership for keys and values.
Definition: TMap.cxx:352
TObjArray::GetEntries
Int_t GetEntries() const
Return the number of objects in array (i.e.
Definition: TObjArray.cxx:523
x
Double_t x[n]
Definition: legend1.C:17
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TString::kExact
@ kExact
Definition: TString.h:268
TEnv::GetValue
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:492
passwd
Definition: TWinNTSystem.h:47
TObjArray::UncheckedAt
TObject * UncheckedAt(Int_t i) const
Definition: TObjArray.h:90
TObjArray::At
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
TMap::Add
void Add(TObject *obj)
This function may not be used (but we need to provide it since it is a pure virtual in TCollection).
Definition: TMap.cxx:54
TEnv.h
TUrl::ParseOptions
void ParseOptions() const
Parse URL options into a key/value map.
Definition: TUrl.cxx:617
TString
Definition: TString.h:136
TUrl::CleanRelativePath
void CleanRelativePath()
Recompute the path removing all relative directory jumps via '..'.
Definition: TUrl.cxx:685
TUrl::FindFile
void FindFile(char *u, Bool_t stripDoubleSlash=kTRUE)
Find file and optionally anchor and options.
Definition: TUrl.cxx:285
bool
TString::ReplaceAll
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:692
TObjArray::Add
void Add(TObject *obj)
Definition: TObjArray.h:74
TObjString::String
TString & String()
Definition: TObjString.h:54
TUrl::HasOption
Bool_t HasOption(const char *key) const
Returns true if the given key appears in the URL options list.
Definition: TUrl.cxx:674
TROOT.h
TUrl::fAnchor
TString fAnchor
Definition: TUrl.h:42
TObjString
Definition: TObjString.h:28
TUrl::kUrlWithDefaultPort
@ kUrlWithDefaultPort
Definition: TUrl.h:54
TObject::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:359
TUrl::fgHostFQDNs
static THashList * fgHostFQDNs
Definition: TUrl.h:50
TUrl::fOptions
TString fOptions
Definition: TUrl.h:43
TUrl::GetIntValueFromOptions
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.
Definition: TUrl.cxx:663
TString::Tokenize
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Definition: TString.cxx:2197
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TObject::ResetBit
void ResetBit(UInt_t f)
Definition: TObject.h:171
slash
TCanvas * slash()
Definition: slash.C:1
TSystem.h
TString::kTrailing
@ kTrailing
Definition: TString.h:267
THashList
Definition: THashList.h:34
gROOTMutex
R__EXTERN TVirtualMutex * gROOTMutex
Definition: TROOT.h:61
THashList::FindObject
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashList.cxx:262
TObjArray::GetEntriesFast
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
TString::Remove
TString & Remove(Ssiz_t pos)
Definition: TString.h:673
TNamed
Definition: TNamed.h:29
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
s1
#define s1(x)
Definition: RSha256.hxx:109
TMap::FindObject
TObject * FindObject(const char *keyname) const
Check if a (key,value) pair exists with keyname as name of the key.
Definition: TMap.cxx:215
TUrl::fOptionsMap
TMap * fOptionsMap
Definition: TUrl.h:47
StrDup
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2490
R__LOCKGUARD
#define R__LOCKGUARD(mutex)
Definition: TVirtualMutex.h:104
TUrl::fFile
TString fFile
Definition: TUrl.h:41
TString::BeginsWith
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:615
TUrl::SetUrl
void SetUrl(const char *url, Bool_t defaultIsFile=kFALSE)
Parse url character string and split in its different subcomponents.
Definition: TUrl.cxx:108
TUrl::SetProtocol
void SetProtocol(const char *proto, Bool_t setDefaultPort=kFALSE)
Set protocol and, optionally, change the port accordingly.
Definition: TUrl.cxx:520
TUrl::GetUrl
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
Definition: TUrl.cxx:387
TUrl
Definition: TUrl.h:33
THashList.h
THashList::Delete
void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: THashList.cxx:207
TString::Index
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:639
Printf
void Printf(const char *fmt,...)
gSystem
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
proto
const char * proto
Definition: civetweb.c:16604
TUrl::IsValid
Bool_t IsValid() const
Definition: TUrl.h:79
TUrl::fUrl
TString fUrl
Definition: TUrl.h:36
TString::CompareTo
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Definition: TString.cxx:418
TString::IsNull
Bool_t IsNull() const
Definition: TString.h:407
TObject::operator=
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Definition: TObject.h:268
TObjArray.h
TUrl::fHost
TString fHost
Definition: TUrl.h:40
TList::Add
virtual void Add(TObject *obj)
Definition: TList.h:87
TObject
Definition: TObject.h:37
TMap.h
TUrl::TUrl
TUrl()
Definition: TUrl.h:57
TUrl::kUrlHasDefaultPort
@ kUrlHasDefaultPort
Definition: TUrl.h:54
TUrl::GetFileAndOptions
const char * GetFileAndOptions() const
Return the file and its options (the string specified behind the ?).
Definition: TUrl.cxx:501
TUrl::GetOptions
const char * GetOptions() const
Definition: TUrl.h:71
xmlio::cnt
const char * cnt
Definition: TXMLSetup.cxx:81
Class
void Class()
Definition: Class.C:29
TUrl::operator=
TUrl & operator=(const TUrl &rhs)
TUrl assignment operator.
Definition: TUrl.cxx:362
TInetAddress
Definition: TInetAddress.h:36
TInetAddress::IsValid
Bool_t IsValid() const
Definition: TInetAddress.h:82
TUrl::Print
void Print(Option_t *option="") const
Print URL on stdout.
Definition: TUrl.cxx:557
TUrl::GetHostFQDN
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
Definition: TUrl.cxx:469
TUrl.h
TUrl::fHostFQ
TString fHostFQ
file with option and anchor
Definition: TUrl.h:45
TUrl::fPasswd
TString fPasswd
Definition: TUrl.h:39
Strip
char * Strip(const char *str, char c=' ')
Strip leading and trailing c (blanks by default) from a string.
Definition: TString.cxx:2454
TUrl::~TUrl
virtual ~TUrl()
Cleanup.
Definition: TUrl.cxx:86
TUrl::GetSpecialProtocols
static TObjArray * GetSpecialProtocols()
Read the list of special protocols from the rootrc files.
Definition: TUrl.cxx:571
int
TMap
Definition: TMap.h:40