94 : fStr(s.fStr), fBegin(s.fBegin), fExtent(s.fExtent) { }
105 operator std::string()
const {
return std::string(
Data(),fExtent); }
107 const char *
Data()
const;
149 enum { kShortMask = 0x01, kLongMask = 0x1 };
151 enum { kShortMask = 0x80, kLongMask = 0x80000000 };
161 enum { kMinCap = (
sizeof(
LongStr_t) - 1)/
sizeof(char) > 2 ?
162 (
sizeof(
LongStr_t) - 1)/
sizeof(
char) : 2 };
198 void InitChar(
char c);
200 enum { kAlignment = 16 };
224 char *
GetPointer() {
return IsLong() ? GetLongPointer() : GetShortPointer(); }
225 const char *
GetPointer()
const {
return IsLong() ? GetLongPointer() : GetShortPointer(); }
234 for (
UInt_t i = 0; i < kNwords; ++i)
239 void FormImp(
const char *fmt, va_list ap);
241 UInt_t HashFoldCase()
const;
244 enum EStripType { kLeading = 0x1, kTrailing = 0x2, kBoth = 0x3 };
263 virtual void FillBuffer(
char *&buffer)
const;
265 virtual Int_t Sizeof()
const;
277 operator const char*()
const {
return GetPointer(); }
278 #if (__cplusplus >= 201700L) && (!defined(__clang_major__) || __clang_major__ > 5) 281 explicit operator std::string()
const {
return std::string(GetPointer(),
Length()); }
323 TString &Append(
const char *cs);
337 int CompareTo(
const char *cs,
ECaseCompare cmp = kExact)
const;
345 const char *
Data()
const {
return GetPointer(); }
349 Ssiz_t First(
char c)
const;
350 Ssiz_t First(
const char *cs)
const;
351 void Form(
const char *fmt, ...)
352 #if defined(__GNUC__) && !defined(__CINT__) 353 __attribute__((format(printf, 2, 3)))
385 Ssiz_t Last(
char c)
const;
386 Ssiz_t Length()
const {
return IsLong() ? GetLongSize() : GetShortSize(); }
387 Bool_t MaybeRegexp()
const;
388 Bool_t MaybeWildcard()
const;
390 TString &Prepend(
const char *cs);
395 std::istream &ReadFile(std::istream &str);
396 std::istream &ReadLine(std::istream &str,
398 std::istream &ReadString(std::istream &str);
399 std::istream &ReadToDelim(std::istream &str,
char delim =
'\n');
400 std::istream &ReadToken(std::istream &str);
411 TString &ReplaceAll(
const char *s1,
const char *s2);
427 static Ssiz_t GetInitialCapacity();
428 static Ssiz_t GetResizeIncrement();
429 static Ssiz_t GetMaxWaste();
436 #if defined(__GNUC__) && !defined(__CINT__) 437 __attribute__((format(printf, 1, 2)))
447 #if defined(R__TEMPLATE_OVERLOAD_BUG) 456 return left.append(right.
Data());
466 extern char *
Form(
const char *fmt, ...)
467 #if defined(__GNUC__) && !defined(__CINT__) 468 __attribute__((format(printf, 1, 2)))
471 extern void Printf(
const char *fmt, ...)
472 #if defined(__GNUC__) && !defined(__CINT__) 473 __attribute__((format(printf, 1, 2)))
476 extern char *
Strip(
const char *str,
char c =
' ');
477 extern char *
StrDup(
const char *str);
478 extern char *
Compress(
const char *str);
479 extern int EscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
481 extern int UnEscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
484 #ifdef NEED_STRCASECMP 485 extern int strcasecmp(
const char *str1,
const char *str2);
486 extern int strncasecmp(
const char *str1,
const char *str2,
Ssiz_t n);
496 {
return Replace(
Length(), 0, cs, cs ? strlen(cs) : 0); }
499 {
return Replace(
Length(), 0, cs, n); }
508 {
return Append(cs, cs ? strlen(cs) : 0); }
514 {
return Append(c); }
517 {
char s[32]; sprintf(s,
"%ld", i);
return operator+=(s); }
520 {
char s[32]; sprintf(s,
"%lu", i);
return operator+=(s); }
538 sprintf(s,
"%.17g", f);
549 sprintf(s,
"%lld", l);
557 sprintf(s,
"%llu", ul);
580 {
return (CompareTo(cs, cmp) == 0) ?
kTRUE :
kFALSE; }
583 {
return (CompareTo(st, cmp) == 0) ?
kTRUE :
kFALSE; }
586 {
return Index(s, s ? strlen(s) : 0, i, cmp); }
593 {
return Index(pat.
Data(), patlen, i, cmp); }
596 {
return Replace(pos, 0, cs, cs ? strlen(cs) : 0); }
599 {
return Replace(pos, 0, cs, n); }
602 {
return Replace(pos, 0, s.
Data(), s.
Length()); }
608 {
return Replace(0, 0, cs, cs ? strlen(cs) : 0); }
611 {
return Replace(0, 0, cs, n); }
614 {
return Replace(0, 0, s.
Data(), s.
Length()); }
623 {
return Replace(pos, n, 0, 0); }
629 {
return Replace(pos, n, cs, cs ? strlen(cs) : 0); }
632 {
return Replace(pos, n, s.
Data(), s.
Length()); }
642 {
return ReplaceAll(s1.
Data(), s1.
Length(), s2, s2 ? strlen(s2) : 0); }
645 {
return ReplaceAll(s1, s1 ? strlen(s1) : 0, s2.
Data(), s2.
Length()); }
648 {
return ReplaceAll(s1, s1 ? strlen(s1) : 0, s2, s2 ? strlen(s2) : 0); }
661 {
return GetPointer()[i]; }
664 {
return GetPointer()[i]; }
710 {
return !(s1 == s2); }
726 {
return !(s1 == s2); }
741 {
return (s2 == s1); }
744 {
return !(s2 == s1); }
763 {
return (s2 == s1); }
766 {
return (s2 == s1); }
769 {
return !(s1 == s2); }
772 {
return !(s1 == s2); }
775 {
return !(s1 == s2); }
778 {
return !(s2 == s1); }
781 {
return !(s2 == s1); }
A zero length substring is legal.
void ToLower()
Convert sub-string to lower-case.
TSubString & operator=(const char *s)
Assign char* to sub-string.
const char * GetShortPointer() const
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
UInt_t Hash(const TString &s)
basic_string_view< char > string_view
char * Compress(const char *str)
Remove all blanks from the string str.
Bool_t EqualTo(const char *cs, ECaseCompare cmp=kExact) const
void ToUpper()
Convert sub-string to upper-case.
std::ostream & operator<<(std::ostream &str, const TString &s)
Write string to stream.
friend Bool_t operator==(const TSubString &s1, const TSubString &s2)
Compare two sub-strings.
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.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Short_t Min(Short_t a, Short_t b)
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)
const char * Data() const
TSubString(const TSubString &s)
TString & Insert(Ssiz_t pos, const char *s)
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Bool_t operator>=(const TString &s1, const TString &s2)
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
#define ClassDef(name, id)
void Init(TClassEdit::TInterpreterLookupHelper *helper)
Ssiz_t GetLongCap() const
TString & Append(const char *cs)
static Ssiz_t Recommend(Ssiz_t s)
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
std::string_view View() const
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 GetShortSize() const
char & operator()(Ssiz_t i)
Return character at pos i from sub-string. No check on i.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
char * Form(const char *fmt,...)
void SetLongCap(Ssiz_t s)
The ROOT global object gROOT contains a list of all defined classes.
char * Strip(const char *str, char c=' ')
Strip leading and trailing c (blanks by default) from a string.
void SetLongPointer(char *p)
char * StrDup(const char *str)
Duplicate the string str.
const char * GetPointer() const
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,...)
Ssiz_t GetLongSize() const
unsigned long long ULong64_t
Print a TSeq at the prompt:
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static constexpr double s
void SetShortSize(Ssiz_t s)
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
int EscChar(const char *src, char *dst, int dstlen, char *specchars, char escchar)
Escape specchars in src with escchar and copy to dst.
void SubStringError(Ssiz_t, Ssiz_t, Ssiz_t) const
Output error message.
Bool_t operator>(const TString &s1, const TString &s2)
Bool_t operator==(const TString &s1, const TString &s2)
static Ssiz_t Align(Ssiz_t s)
TSubString(const TString &s, Ssiz_t start, Ssiz_t len)
Private constructor.
Short_t Max(Short_t a, Short_t b)
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
const char * GetLongPointer() const
Bool_t IsWhitespace() const
Bool_t operator<(const TString &s1, const TString &s2)
void AssertElement(Ssiz_t i) const
Check to make sure a sub-string index is in range.
static constexpr double ns
static char * Format(const char *format, va_list ap)
Format a string in a circular formatting buffer (using a printf style format descriptor).
std::string & operator+=(std::string &left, const TString &right)
const char * Data() const