100 : fStr(s.fStr), fBegin(s.fBegin), fExtent(s.fExtent) { }
111 operator std::string()
const {
return std::string(
Data(),fExtent); }
113 const char *
Data()
const;
144 friend typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type 147 friend typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type 150 friend typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type 153 friend typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type 156 friend typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type 159 friend typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type 167 enum { kShortMask = 0x01, kLongMask = 0x1 };
169 enum { kShortMask = 0x80, kLongMask = 0x80000000 };
179 enum { kMinCap = (
sizeof(
LongStr_t) - 1)/
sizeof(char) > 2 ?
180 (
sizeof(
LongStr_t) - 1)/
sizeof(
char) : 2 };
216 void InitChar(
char c);
218 enum { kAlignment = 16 };
242 char *
GetPointer() {
return IsLong() ? GetLongPointer() : GetShortPointer(); }
243 const char *
GetPointer()
const {
return IsLong() ? GetLongPointer() : GetShortPointer(); }
252 for (
UInt_t i = 0; i < kNwords; ++i)
257 void FormImp(
const char *fmt, va_list ap);
259 UInt_t HashFoldCase()
const;
262 enum EStripType { kLeading = 0x1, kTrailing = 0x2, kBoth = 0x3 };
281 virtual void FillBuffer(
char *&buffer)
const;
283 virtual Int_t Sizeof()
const;
295 operator const char*()
const {
return GetPointer(); }
296 #if (__cplusplus >= 201700L) && (!defined(__clang_major__) || __clang_major__ > 5) 299 explicit operator std::string()
const {
return std::string(GetPointer(),
Length()); }
319 typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type 322 typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type 325 typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type 342 TString &Append(
const char *cs);
356 int CompareTo(
const char *cs,
ECaseCompare cmp = kExact)
const;
364 const char *
Data()
const {
return GetPointer(); }
368 Ssiz_t First(
char c)
const;
369 Ssiz_t First(
const char *cs)
const;
370 void Form(
const char *fmt, ...)
371 #if defined(__GNUC__) && !defined(__CINT__) 372 __attribute__((format(printf, 2, 3)))
404 Ssiz_t Last(
char c)
const;
405 Ssiz_t Length()
const {
return IsLong() ? GetLongSize() : GetShortSize(); }
406 Bool_t MaybeRegexp()
const;
407 Bool_t MaybeWildcard()
const;
409 TString &Prepend(
const char *cs);
414 std::istream &ReadFile(std::istream &str);
415 std::istream &ReadLine(std::istream &str,
417 std::istream &ReadString(std::istream &str);
418 std::istream &ReadToDelim(std::istream &str,
char delim =
'\n');
419 std::istream &ReadToken(std::istream &str);
430 TString &ReplaceAll(
const char *s1,
const char *s2);
446 static Ssiz_t GetInitialCapacity();
447 static Ssiz_t GetResizeIncrement();
448 static Ssiz_t GetMaxWaste();
455 #if defined(__GNUC__) && !defined(__CINT__) 456 __attribute__((format(printf, 1, 2)))
466 #if defined(R__TEMPLATE_OVERLOAD_BUG) 475 return left.append(right.
Data());
485 extern char *
Form(
const char *fmt, ...)
486 #if defined(__GNUC__) && !defined(__CINT__) 487 __attribute__((format(printf, 1, 2)))
490 extern void Printf(
const char *fmt, ...)
491 #if defined(__GNUC__) && !defined(__CINT__) 492 __attribute__((format(printf, 1, 2)))
495 extern char *
Strip(
const char *str,
char c =
' ');
496 extern char *
StrDup(
const char *str);
497 extern char *
Compress(
const char *str);
498 extern int EscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
500 extern int UnEscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
503 #ifdef NEED_STRCASECMP 504 extern int strcasecmp(
const char *str1,
const char *str2);
505 extern int strncasecmp(
const char *str1,
const char *str2,
Ssiz_t n);
515 inline typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type 520 inline typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type 525 inline typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type 530 inline typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type 535 snprintf(buffer,
sizeof(buffer),
"%lld", static_cast<Long64_t>(i));
540 inline typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type 545 snprintf(buffer,
sizeof(buffer),
"%llu", static_cast<ULong64_t>(u));
550 inline typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type 555 snprintf(buffer,
sizeof(buffer),
"%.17Lg", static_cast<LongDouble_t>(f));
572 {
return Append(cs, cs ? strlen(cs) : 0); }
578 {
return Append(c); }
581 inline typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type 586 snprintf(buffer,
sizeof(buffer),
"%lld", static_cast<Long64_t>(i));
591 inline typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type 596 snprintf(buffer,
sizeof(buffer),
"%llu", static_cast<ULong64_t>(u));
601 inline typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type 606 snprintf(buffer,
sizeof(buffer),
"%.17Lg", static_cast<LongDouble_t>(f));
629 {
return (CompareTo(cs, cmp) == 0) ?
kTRUE :
kFALSE; }
632 {
return (CompareTo(st, cmp) == 0) ?
kTRUE :
kFALSE; }
635 {
return Index(s, s ? strlen(s) : 0, i, cmp); }
642 {
return Index(pat.
Data(), patlen, i, cmp); }
645 {
return Replace(pos, 0, cs, cs ? strlen(cs) : 0); }
648 {
return Replace(pos, 0, cs, n); }
657 {
return Replace(0, 0, cs, cs ? strlen(cs) : 0); }
660 {
return Replace(0, 0, cs, n); }
672 {
return Replace(pos, n, 0, 0); }
678 {
return Replace(pos, n, cs, cs ? strlen(cs) : 0); }
691 {
return ReplaceAll(s1.
Data(), s1.
Length(), s2, s2 ? strlen(s2) : 0); }
694 {
return ReplaceAll(s1, s1 ? strlen(s1) : 0, s2.
Data(), s2.
Length()); }
697 {
return ReplaceAll(s1, s1 ? strlen(s1) : 0, s2, s2 ? strlen(s2) : 0); }
710 {
return GetPointer()[i]; }
713 {
return GetPointer()[i]; }
759 {
return !(s1 == s2); }
775 {
return !(s1 == s2); }
790 {
return (s2 == s1); }
793 {
return !(s2 ==
s1); }
812 {
return (s2 == s1); }
815 {
return (s2 == s1); }
818 {
return !(s1 == s2); }
821 {
return !(s1 == s2); }
824 {
return !(s1 == s2); }
827 {
return !(s2 ==
s1); }
830 {
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)
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)
unsigned int Replace(std::string &s, const std::string what, const std::string withWhat)
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:
basic_string_view< char > string_view
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