35 #ifndef ROOT_TMathBase 44 namespace std { using ::string; }
106 : fStr(s.fStr), fBegin(s.fBegin), fExtent(s.fExtent) { }
119 const char *
Data()
const;
161 enum { kShortMask = 0x01, kLongMask = 0x1 };
163 enum { kShortMask = 0x80, kLongMask = 0x80000000 };
173 enum { kMinCap = (
sizeof(
LongStr_t) - 1)/
sizeof(char) > 2 ?
174 (
sizeof(
LongStr_t) - 1)/
sizeof(
char) : 2 };
208 void AssertElement(
Ssiz_t nc)
const;
210 void InitChar(
char c);
212 enum { kAlignment = 16 };
236 char *
GetPointer() {
return IsLong() ? GetLongPointer() : GetShortPointer(); }
237 const char *
GetPointer()
const {
return IsLong() ? GetLongPointer() : GetShortPointer(); }
246 for (
UInt_t i = 0; i < kNwords; ++i)
251 void FormImp(
const char *fmt, va_list ap);
253 UInt_t HashFoldCase()
const;
256 enum EStripType { kLeading = 0x1, kTrailing = 0x2, kBoth = 0x3 };
275 virtual void FillBuffer(
char *&buffer)
const;
277 virtual Int_t Sizeof()
const;
289 operator const char*()
const {
return GetPointer(); }
294 TString &operator=(
const char *s);
296 TString &operator=(
const std::string &s);
299 TString &operator+=(
const char *s);
314 char &operator[](
Ssiz_t i);
315 char &operator()(
Ssiz_t i);
316 char operator[](
Ssiz_t i)
const;
317 char operator()(
Ssiz_t i)
const;
327 TString &Append(
const char *cs);
341 int CompareTo(
const char *cs,
ECaseCompare cmp = kExact)
const;
349 const char *
Data()
const {
return GetPointer(); }
353 Ssiz_t First(
char c)
const;
354 Ssiz_t First(
const char *cs)
const;
355 void Form(
const char *fmt, ...)
356 #if defined(__GNUC__) && !defined(__CINT__) 357 __attribute__((
format(printf, 2, 3)))
389 Ssiz_t Last(
char c)
const;
390 Ssiz_t Length()
const {
return IsLong() ? GetLongSize() : GetShortSize(); }
391 Bool_t MaybeRegexp()
const;
392 Bool_t MaybeWildcard()
const;
394 TString &Prepend(
const char *cs);
399 std::istream &ReadFile(std::istream &str);
400 std::istream &ReadLine(std::istream &str,
402 std::istream &ReadString(std::istream &str);
403 std::istream &ReadToDelim(std::istream &str,
char delim =
'\n');
404 std::istream &ReadToken(std::istream &str);
430 static Ssiz_t GetInitialCapacity();
431 static Ssiz_t GetResizeIncrement();
432 static Ssiz_t GetMaxWaste();
439 #if defined(__GNUC__) && !defined(__CINT__) 440 __attribute__((
format(printf, 1, 2)))
450 #if defined(R__TEMPLATE_OVERLOAD_BUG) 463 extern char *
Form(
const char *fmt, ...)
464 #if defined(__GNUC__) && !defined(__CINT__) 465 __attribute__((
format(printf, 1, 2)))
468 extern void Printf(
const char *fmt, ...)
469 #if defined(__GNUC__) && !defined(__CINT__) 470 __attribute__((
format(printf, 1, 2)))
473 extern char *
Strip(
const char *str,
char c =
' ');
474 extern char *
StrDup(
const char *str);
475 extern char *
Compress(
const char *str);
476 extern int EscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
478 extern int UnEscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
481 #ifdef NEED_STRCASECMP 482 extern int strcasecmp(
const char *str1,
const char *str2);
483 extern int strncasecmp(
const char *str1,
const char *str2,
Ssiz_t n);
493 {
return Replace(Length(), 0, cs, cs ? strlen(cs) : 0); }
496 {
return Replace(Length(), 0, cs, n); }
499 {
return Replace(Length(), 0, s.
Data(), s.
Length()); }
505 {
return Append(cs, cs ? strlen(cs) : 0); }
511 {
return Append(c); }
514 {
char s[32]; sprintf(s,
"%ld", i);
return operator+=(s); }
517 {
char s[32]; sprintf(s,
"%lu", i);
return operator+=(s); }
520 {
return operator+=((
Long_t) i); }
523 {
return operator+=((
ULong_t) i); }
526 {
return operator+=((
Long_t) i); }
529 {
return operator+=((
ULong_t) i); }
535 sprintf(s,
"%.17g", f);
536 return operator+=(s);
540 {
return operator+=((
Double_t) f); }
546 sprintf(s,
"%lld", l);
547 return operator+=(s);
554 sprintf(s,
"%llu", ul);
555 return operator+=(s);
577 {
return (CompareTo(cs, cmp) == 0) ?
kTRUE :
kFALSE; }
580 {
return (CompareTo(st, cmp) == 0) ?
kTRUE :
kFALSE; }
583 {
return Index(s, s ? strlen(s) : 0, i, cmp); }
590 {
return Index(pat.
Data(), patlen, i, cmp); }
593 {
return Replace(pos, 0, cs, cs ? strlen(cs) : 0); }
596 {
return Replace(pos, 0, cs, n); }
599 {
return Replace(pos, 0, s.
Data(), s.
Length()); }
605 {
return Replace(0, 0, cs, cs ? strlen(cs) : 0); }
608 {
return Replace(0, 0, cs, n); }
611 {
return Replace(0, 0, s.
Data(), s.
Length()); }
617 {
return Replace(pos,
TMath::Max(0, Length()-pos), 0, 0); }
620 {
return Replace(pos, n, 0, 0); }
626 {
return Replace(pos, n, cs, cs ? strlen(cs) : 0); }
629 {
return Replace(pos, n, s.
Data(), s.
Length()); }
645 {
return ReplaceAll(s1, s1 ? strlen(s1) : 0, s2, s2 ? strlen(s2) : 0); }
658 {
return GetPointer()[i]; }
661 {
return GetPointer()[i]; }
664 { AssertElement(i);
return GetPointer()[i]; }
667 { AssertElement(i);
return GetPointer()[i]; }
685 return fStr.Data() + fBegin;
690 { AssertElement(i);
return fStr.GetPointer()[fBegin+i]; }
693 {
return fStr.GetPointer()[fBegin+i]; }
707 {
return !(s1 == s2); }
723 {
return !(s1 == s2); }
738 {
return (s2 == s1); }
741 {
return !(s2 == s1); }
760 {
return (s2 == s1); }
763 {
return (s2 == s1); }
766 {
return !(s1 == s2); }
769 {
return !(s1 == s2); }
772 {
return !(s1 == s2); }
775 {
return !(s2 == s1); }
778 {
return !(s2 == s1); }
A zero length substring is legal.
TSubString & operator=(const char *s)
Assign char* to sub-string.
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
UInt_t Hash(const TString &s)
char * Compress(const char *str)
Remove all blanks from the string str.
std::ostream & operator<<(std::ostream &str, const TString &s)
Write string to stream.
ATTENTION: this class is obsolete.
T ReadBuffer(TBufferFile *buf)
One of the template functions used to read objects from messages.
TString & ReplaceAll(const TString &s1, const TString &s2)
char & operator[](Ssiz_t i)
int UnEscChar(const char *src, char *dst, int dstlen, char *specchars, char escchar)
Un-escape specchars in src from escchar and copy to dst.
Buffer base class used for serializing objects.
Regular expression class.
This class implements a mutex interface.
Short_t Min(Short_t a, Short_t b)
TString & operator=(char s)
Assign character c to TString.
_LIBCPP_INLINE_VISIBILITY basic_string< _CharT, _Traits, _Allocator > to_string(const _Allocator &__a=_Allocator()) const
TString & operator+=(const char *s)
std::istream & operator>>(std::istream &str, TString &s)
Read string from stream.
std::string printValue(const std::string_view *val)
Print a TString in the cling interpreter:
TString & Prepend(const char *cs)
static std::string format(double x, double y, int digits, int width)
TSubString(const TSubString &s)
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Insert(Ssiz_t pos, const char *s)
Bool_t operator>=(const TString &s1, const TString &s2)
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
const char * Data() const
const char * GetShortPointer() const
#define ClassDef(name, id)
Ssiz_t GetShortSize() const
void Init(TClassEdit::TInterpreterLookupHelper *helper)
TString & Append(const char *cs)
std::vector< std::vector< double > > Data
static Ssiz_t Recommend(Ssiz_t s)
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
void AssertElement(Ssiz_t nc) const
Check to make sure a string index is in range.
basic_string_view< char > string_view
Bool_t operator!=(const TString &s1, const TString &s2)
char & operator()(Ssiz_t i)
Bool_t operator<=(const TString &s1, const TString &s2)
char & operator[](Ssiz_t i)
Return character at pos i from sub-string. Check validity of i.
Ssiz_t GetLongSize() const
Bool_t EqualTo(const char *cs, ECaseCompare cmp=kExact) const
char & operator()(Ssiz_t i)
Return character at pos i from sub-string. No check on i.
char * Strip(const char *str, char c= ' ')
Strip leading and trailing c (blanks by default) from a string.
char * Form(const char *fmt,...)
void SetLongCap(Ssiz_t s)
Bool_t IsWhitespace() const
The ROOT global object gROOT contains a list of all defined classes.
void SetLongPointer(char *p)
TString ToLower(const TString &s)
Return a lower-case version of str.
char * StrDup(const char *str)
Duplicate the string str.
TString & Remove(Ssiz_t pos)
RooCmdArg Index(RooCategory &icat)
void Copy(void *source, void *dest)
TString & Swap(TString &other)
void SetLongSize(Ssiz_t s)
void Printf(const char *fmt,...)
unsigned long long ULong64_t
Print a TSeq at the prompt:
void SetShortSize(Ssiz_t s)
int EscChar(const char *src, char *dst, int dstlen, char *specchars, char escchar)
Escape specchars in src with escchar and copy to dst.
Bool_t operator>(const TString &s1, const TString &s2)
Bool_t operator==(const TString &s1, const TString &s2)
const char * GetPointer() const
static Ssiz_t Align(Ssiz_t s)
Short_t Max(Short_t a, Short_t b)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
TString ToUpper(const TString &s)
Return an upper-case version of str.
const char * Data() const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Bool_t operator<(const TString &s1, const TString &s2)
Ssiz_t GetLongCap() const
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
const char * GetLongPointer() const
static char * Format(const char *format, va_list ap)
Format a string in a circular formatting buffer (using a printf style format descriptor).
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.