38#if (__cplusplus >= 202002L)
118 operator std::string_view()
const {
return std::string_view(
Data(),
fExtent); }
119 operator std::string()
const {
return std::string(
Data(),
fExtent); }
121 const char *
Data()
const;
152friend typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type
155friend typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type
158friend typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type
161friend typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type
164friend typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type
167friend typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type
172#if __cplusplus >= 202002L
173friend std::strong_ordering operator<=>(
const TString &
s1,
const TString &s2) {
174 const int cmp =
s1.CompareTo(s2);
175 if (cmp == 0)
return std::strong_ordering::equal;
176 if (cmp < 0)
return std::strong_ordering::less;
177 return std::strong_ordering::greater;
195 enum { kMinCap = (
sizeof(
LongStr_t) - 1)/
sizeof(char) > 2 ?
196 (
sizeof(
LongStr_t) - 1)/
sizeof(
char) : 2 };
273 void FormImp(
const char *fmt, va_list ap);
291 explicit TString(
const std::string_view &sub);
312#if (__cplusplus >= 201700L) && !defined(_MSC_VER) && (!defined(__clang_major__) || __clang_major__ > 5)
315 explicit operator std::string()
const {
return std::string(
GetPointer(),
Length()); }
317 operator std::string_view()
const {
return std::string_view(
GetPointer(),
Length()); }
335 typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type
338 typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type
341 typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type
386 void Form(
const char *fmt, ...)
387#if defined(__GNUC__) && !defined(__CINT__)
388 __attribute__((
format(printf, 2, 3)))
430 std::istream &
ReadFile(std::istream &str);
431 std::istream &
ReadLine(std::istream &str,
434 std::istream &
ReadToDelim(std::istream &str,
char delim =
'\n');
435 std::istream &
ReadToken(std::istream &str);
472#if defined(__GNUC__) && !defined(__CINT__)
473 __attribute__((
format(printf, 1, 2)))
483#if defined(R__TEMPLATE_OVERLOAD_BUG)
492 return left.append(right.
Data());
502extern char *
Form(
const char *fmt, ...)
503#if defined(__GNUC__) && !defined(__CINT__)
504__attribute__((
format(printf, 1, 2)))
507extern void Printf(
const char *fmt, ...)
508#if defined(__GNUC__) && !defined(__CINT__)
509__attribute__((
format(printf, 1, 2)))
512extern char *
Strip(
const char *str,
char c =
' ');
513extern char *
StrDup(
const char *str);
514extern char *
Compress(
const char *str);
515extern int EscChar(
const char *
src,
char *dst,
int dstlen,
char *specchars,
517extern int UnEscChar(
const char *
src,
char *dst,
int dstlen,
char *specchars,
520#ifdef NEED_STRCASECMP
521extern int strcasecmp(
const char *str1,
const char *str2);
522extern int strncasecmp(
const char *str1,
const char *str2,
Ssiz_t n);
532inline typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type
537inline typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type
542inline typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type
547inline typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type
557inline typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type
567inline typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type
598inline typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type
608inline typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type
618inline typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type
652{
return Index(s, s ? (
Ssiz_t)strlen(s) : 0, i, cmp); }
659{
return Index(pat.
Data(), patlen, i, cmp); }
689{
return Replace(pos,
n,
nullptr, 0); }
771 return ((
s1.Length() == s2.
Length()) &&
772 !memcmp(
s1.Data(), s2.
Data(),
s1.Length()));
776{
return !(
s1 == s2); }
779{
return s1.CompareTo(s2) < 0; }
782{
return s1.CompareTo(s2) > 0; }
785{
return s1.CompareTo(s2) <= 0; }
788{
return s1.CompareTo(s2) >= 0; }
792{
return !(
s1 == s2); }
795{
return s1.CompareTo(s2) < 0; }
798{
return s1.CompareTo(s2) > 0; }
801{
return s1.CompareTo(s2) <= 0; }
804{
return s1.CompareTo(s2) >= 0; }
807{
return (s2 ==
s1); }
810{
return !(s2 ==
s1); }
829{
return (s2 ==
s1); }
832{
return (s2 ==
s1); }
835{
return !(
s1 == s2); }
838{
return !(
s1 == s2); }
841{
return !(
s1 == s2); }
844{
return !(s2 ==
s1); }
847{
return !(s2 ==
s1); }
854 std::string printValue(
const TString* val);
855 std::string printValue(
const TSubString* val);
856 std::string printValue(
const std::string_view* val);
unsigned long long ULong64_t
#define ClassDef(name, id)
TBuffer & operator<<(TBuffer &buf, const Tmpl *obj)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t nchar
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
TString ToUpper(const TString &s)
Return an upper-case version of str.
Bool_t operator!=(const TString &s1, const TString &s2)
TString ToLower(const TString &s)
Return a lower-case version of str.
Bool_t operator>(const TString &s1, const TString &s2)
Bool_t operator>=(const TString &s1, const TString &s2)
char * Compress(const char *str)
Remove all blanks from the string str.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
UInt_t Hash(const TString &s)
int UnEscChar(const char *src, char *dst, int dstlen, char *specchars, char escchar)
Un-escape specchars in src from escchar and copy to dst.
Bool_t operator<(const TString &s1, const TString &s2)
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
char * Strip(const char *str, char c=' ')
Strip leading and trailing c (blanks by default) from a string.
Bool_t operator<=(const TString &s1, const TString &s2)
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Bool_t operator==(const TString &s1, const TString &s2)
char * StrDup(const char *str)
Duplicate the string str.
int EscChar(const char *src, char *dst, int dstlen, char *specchars, char escchar)
Escape specchars in src with escchar and copy to dst.
std::istream & operator>>(std::istream &str, TString &s)
Read string from stream.
std::string & operator+=(std::string &left, const TString &right)
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
Buffer base class used for serializing objects.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Regular expression class.
ATTENTION: this class is obsolete.
TString Copy() const
Copy a string.
static TString UItoa(UInt_t value, Int_t base)
Converts a UInt_t (twice the range of an Int_t) to a TString with respect to the base specified (2-36...
const char * GetPointer() const
char & operator[](Ssiz_t i)
static TString LLtoa(Long64_t value, Int_t base)
Converts a Long64_t to a TString with respect to the base specified (2-36).
std::enable_if< ROOT::TypeTraits::IsFloatNumeral< T >::value, TString >::type & operator+=(T f)
void SetShortSize(Ssiz_t s)
char & operator()(Ssiz_t i)
Bool_t IsDec() const
Returns true if all characters in string are decimal digits (0-9).
void ToLower()
Change string to lower-case.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
TString & Insert(Ssiz_t pos, const char *s)
static Ssiz_t MaxWaste(Ssiz_t mw=15)
Set maximum space that may be wasted in a string before doing a resize.
Int_t Atoi() const
Return integer value of string.
static Ssiz_t Align(Ssiz_t s)
void SetLongSize(Ssiz_t s)
Bool_t Gets(FILE *fp, Bool_t chop=kTRUE)
Read one line from the stream, including the \n, or until EOF.
std::istream & ReadToDelim(std::istream &str, char delim='\n')
Read up to an EOF, or a delimiting character, whichever comes first.
static constexpr Ssiz_t kNPOS
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
TString()
TString default ctor.
Bool_t IsHex() const
Returns true if all characters in string are hexadecimal digits (0-9,a-f,A-F).
Double_t Atof() const
Return floating-point value contained in string.
TString & ReplaceSpecialCppChars()
Find special characters which are typically used in printf() calls and replace them by appropriate es...
Bool_t IsFloat() const
Returns kTRUE if string contains a floating point or integer number.
void Clear()
Clear string without changing its capacity.
TSubString SubString(const char *pat, Ssiz_t start=0, ECaseCompare cmp=kExact) const
Returns a substring matching "pattern", or the null substring if there is no such match.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
static TString * ReadString(TBuffer &b, const TClass *clReq)
Read TString object from buffer.
Bool_t EqualTo(const char *cs, ECaseCompare cmp=kExact) const
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
Bool_t MaybeRegexp() const
Returns true if string contains one of the regexp characters "^$.[]*+?".
static Ssiz_t ResizeIncrement(Ssiz_t ri=16)
Set default resize increment for all TStrings. Default is 16.
UInt_t HashCase() const
Return a case-sensitive hash value (endian independent).
Bool_t IsOct() const
Returns true if all characters in string are octal digits (0-7).
virtual ~TString()
Delete a TString.
static Ssiz_t GetMaxWaste()
TString & ReplaceAll(const TString &s1, const TString &s2)
static Ssiz_t AdjustCapacity(Ssiz_t oldCap, Ssiz_t newCap)
Calculate a nice capacity greater than or equal to newCap.
TString MD5() const
Return the MD5 digest for this string, in a string representation.
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
Bool_t IsAlpha() const
Returns true if all characters in string are alphabetic.
UInt_t HashFoldCase() const
Return a case-insensitive hash value (endian independent).
Ssiz_t Last(char c) const
Find last occurrence of a character c.
void ToUpper()
Change string to upper case.
Bool_t IsAscii() const
Returns true if all characters in string are ascii.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
static Ssiz_t GetResizeIncrement()
void Puts(FILE *fp)
Write string to the stream.
void SetLongCap(Ssiz_t s)
friend TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
std::string_view View() const
TString & Prepend(const char *cs)
TString & Swap(TString &other)
Bool_t IsBin() const
Returns true if all characters in string are binary digits (0,1).
static TString BaseConvert(const TString &s_in, Int_t base_in, Int_t base_out)
Converts string from base base_in to base base_out.
static TString ULLtoa(ULong64_t value, Int_t base)
Converts a ULong64_t (twice the range of an Long64_t) to a TString with respect to the base specified...
Int_t CountChar(Int_t c) const
Return number of times character c occurs in the string.
friend Bool_t operator==(const TString &s1, const TString &s2)
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
static void WriteString(TBuffer &b, const TString *a)
Write TString object to buffer.
virtual void FillBuffer(char *&buffer) const
Copy string into I/O buffer.
TString & operator=(char s)
Assign character c to TString.
std::istream & ReadFile(std::istream &str)
Replace string with the contents of strm, stopping at an EOF.
TString & Remove(Ssiz_t pos)
static Ssiz_t InitialCapacity(Ssiz_t ic=15)
Set default initial capacity for all TStrings. Default is 15.
TString & Append(const char *cs)
Bool_t IsInBaseN(Int_t base) const
Returns true if all characters in string are expressed in the base specified (range=2-36),...
char * Init(Ssiz_t capacity, Ssiz_t nchar)
Private member function returning an empty string representation of size capacity and containing ncha...
Bool_t MaybeWildcard() const
Returns true if string contains one of the wildcard characters "[]*?".
void InitChar(char c)
Initialize a string with a single character.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
static TString Itoa(Int_t value, Int_t base)
Converts an Int_t to a TString with respect to the base specified (2-36).
virtual Int_t Sizeof() const
Returns size string will occupy on I/O buffer.
TString & operator+=(const char *s)
Ssiz_t GetShortSize() const
Bool_t IsWhitespace() const
void Clone(Ssiz_t nc)
Make self a distinct copy with capacity of at least tot, where tot cannot be smaller than the current...
const char * GetLongPointer() const
std::enable_if< ROOT::TypeTraits::IsUnsignedNumeral< T >::value, TString >::type & operator+=(T u)
const char * GetShortPointer() const
Ssiz_t GetLongCap() const
void SetLongPointer(char *p)
std::istream & ReadToken(std::istream &str)
Read a token, delimited by whitespace, from the input stream.
Ssiz_t GetLongSize() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
friend TBuffer & operator<<(TBuffer &b, const TString *obj)
Write TString or derived to TBuffer.
static Ssiz_t GetInitialCapacity()
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
void AssertElement(Ssiz_t nc) const
Check to make sure a string index is in range.
virtual void ReadBuffer(char *&buffer)
Read string from I/O buffer.
Bool_t IsAlnum() const
Returns true if all characters in string are alphanumeric.
void FormImp(const char *fmt, va_list ap)
Formats a string using a printf style format descriptor.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
void Clobber(Ssiz_t nc)
Clear string and make sure it has a capacity of nc.
static Ssiz_t Recommend(Ssiz_t s)
std::istream & ReadLine(std::istream &str, Bool_t skipWhite=kTRUE)
Read a line from stream upto newline skipping any whitespace.
Long64_t Atoll() const
Return long long value of string.
A zero length substring is legal.
TSubString & operator=(const char *s)
Assign char* to sub-string.
void ToUpper()
Convert sub-string to upper-case.
void SubStringError(Ssiz_t, Ssiz_t, Ssiz_t) const
Output error message.
char & operator[](Ssiz_t i)
Return character at pos i from sub-string. Check validity of i.
friend Bool_t operator==(const TSubString &s1, const TSubString &s2)
Compare two sub-strings.
void AssertElement(Ssiz_t i) const
Check to make sure a sub-string index is in range.
void ToLower()
Convert sub-string to lower-case.
TSubString(const TSubString &s)
const char * Data() const
char & operator()(Ssiz_t i)
Return character at pos i from sub-string. No check on i.
This class implements a mutex interface.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.