58 #define strtoull _strtoui64
62 namespace std { using ::list; }
68 const
UInt_t kHashShift = 5;
107 char *data =
Init(n, n);
119 char *data =
Init(n, n);
120 memcpy(data, s.c_str(),
n);
128 char *data =
Init(n, n);
137 char *data =
Init(1, 1);
154 char *data =
Init(n, n);
155 while (n--) data[
n] =
c;
167 char *data =
Init(n, n);
188 char *data =
Init(len, len);
189 memcpy(data, substr.
Data(), len);
200 char *data =
Init(tot, tot);
201 memcpy(data, a1, n1);
202 memcpy(data+n1, a2, n2);
220 Error(
"TString::Init",
"capacity too large (%d, max = %d)", capacity,
MaxSize());
222 if (nchar > capacity)
227 if (capacity < kMinCap) {
232 data =
new char[cap+1];
292 char *data =
Init(n, n);
318 if (!rep)
return *
this;
324 Error(
"TString::Append",
"rep too large (%d, max = %d)", rep,
MaxSize()-len);
332 if (capac - tot >= 0) {
337 data =
new char[cap+1];
338 memcpy(data, p, len);
376 const char *cs1 =
Data();
380 for (; cs2[i]; ++i) {
381 if (i == len)
return -1;
382 if (cs1[i] != cs2[i])
return ((cs1[i] > cs2[i]) ? 1 : -1);
385 for (; cs2[i]; ++i) {
386 if (i == len)
return -1;
387 char c1 = tolower((
unsigned char)cs1[i]);
388 char c2 = tolower((
unsigned char)cs2[i]);
389 if (c1 != c2)
return ((c1 > c2) ? 1 : -1);
392 return (i < len) ? 1 : 0;
405 const char *
s2 = str.
Data();
409 if (len < slen) slen = len;
411 int result = memcmp(s1, s2, slen);
412 if (result != 0)
return result;
415 for (; i < slen; ++i) {
416 char c1 = tolower((
unsigned char)s1[i]);
417 char c2 = tolower((
unsigned char)s2[i]);
418 if (c1 != c2)
return ((c1 > c2) ? 1 : -1);
423 if (len == slen)
return 0;
424 return (len > slen) ? 1 : -1;
434 const char *data =
Data();
435 for (
Int_t n = 0; n < len; n++)
436 if (data[n] == c) count++;
455 const char *
f = strchr(
Data(), c);
464 const char *
f = strpbrk(
Data(), cs);
473 return (((x & 0x000000ffU) << 24) | ((x & 0x0000ff00U) << 8) |
474 ((x & 0x00ff0000U) >> 8) | ((x & 0xff000000U) >> 24));
484 ((hash << kHashShift) |
493 UInt_t len = str ? strlen(str) : 0;
511 if ((i = len*
sizeof(
char)%
sizeof(
UInt_t)) != 0) {
513 const char*
c = (
const char*)p;
521 const unsigned char *p = (
const unsigned char*)str;
524 memcpy(&h, p,
sizeof(
UInt_t));
534 if ((i = len*
sizeof(
char)%
sizeof(
UInt_t)) != 0) {
536 const char*
c = (
const char*)p;
566 const char*
c = (
const char*)p;
581 const unsigned char *p = (
const unsigned char*)
Data();
583 Mash(hv, toupper(*p));
617 #if defined(_MSC_VER) && (_MSC_VER < 1800)
619 typedef unsigned char uint8_t;
620 typedef unsigned long uint32_t;
621 typedef unsigned __int64 uint64_t;
622 #else // defined(_MSC_VER)
625 #endif // !defined(_MSC_VER)
628 #if defined(_MSC_VER)
630 #define FORCE_INLINE __forceinline
632 #define ROTL64(x,y) _rotl64(x,y)
633 #define BIG_CONSTANT(x) (x)
634 #else // defined(_MSC_VER)
638 return (x << r) | (x >> (64 -
r));
641 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) <= 40101
643 #define FORCE_INLINE inline
647 #define FORCE_INLINE __attribute__((always_inline)) inline
649 #define ROTL64(x,y) rotl64(x,y)
650 #define BIG_CONSTANT(x) (x##LLU)
651 #endif // !defined(_MSC_VER)
659 FORCE_INLINE uint64_t getblock(
const uint64_t* p,
int i)
684 static void MurmurHash3_x64_128(
const void * key,
const int len,
685 const uint32_t seed, uint64_t
out[2] )
687 const uint8_t * data = (
const uint8_t*)key;
688 const int nblocks = len / 16;
699 const uint64_t * blocks = (
const uint64_t *)(data);
701 for(
int i = 0; i < nblocks; i++)
703 uint64_t k1 = getblock(blocks,i*2+0);
704 uint64_t k2 = getblock(blocks,i*2+1);
706 k1 *=
c1; k1 =
ROTL64(k1,31); k1 *=
c2; h1 ^= k1;
708 h1 =
ROTL64(h1,27); h1 +=
h2; h1 = h1*5+0x52dce729;
710 k2 *=
c2; k2 =
ROTL64(k2,33); k2 *=
c1; h2 ^= k2;
712 h2 =
ROTL64(h2,31); h2 +=
h1; h2 = h2*5+0x38495ab5;
718 const uint8_t * tail = (
const uint8_t*)(data + nblocks*16);
724 case 15: k2 ^= uint64_t(tail[14]) << 48;
725 case 14: k2 ^= uint64_t(tail[13]) << 40;
726 case 13: k2 ^= uint64_t(tail[12]) << 32;
727 case 12: k2 ^= uint64_t(tail[11]) << 24;
728 case 11: k2 ^= uint64_t(tail[10]) << 16;
729 case 10: k2 ^= uint64_t(tail[ 9]) << 8;
730 case 9: k2 ^= uint64_t(tail[ 8]) << 0;
731 k2 *=
c2; k2 =
ROTL64(k2,33); k2 *=
c1; h2 ^= k2;
733 case 8: k1 ^= uint64_t(tail[ 7]) << 56;
734 case 7: k1 ^= uint64_t(tail[ 6]) << 48;
735 case 6: k1 ^= uint64_t(tail[ 5]) << 40;
736 case 5: k1 ^= uint64_t(tail[ 4]) << 32;
737 case 4: k1 ^= uint64_t(tail[ 3]) << 24;
738 case 3: k1 ^= uint64_t(tail[ 2]) << 16;
739 case 2: k1 ^= uint64_t(tail[ 1]) << 8;
740 case 1: k1 ^= uint64_t(tail[ 0]) << 0;
741 k1 *=
c1; k1 =
ROTL64(k1,31); k1 *=
c2; h1 ^= k1;
747 h1 ^= len; h2 ^= len;
758 ((uint64_t*)out)[0] =
h1;
759 ((uint64_t*)out)[1] =
h2;
776 if (ntxt !=
sizeof(
void*)) {
777 uint64_t buf[2] = {0};
778 MurmurHash3_x64_128(txt, ntxt, 0x6384BA69, buf);
784 if (((
size_t)txt) %
sizeof(
void*)) {
787 if (
sizeof(
void*) >
sizeof(
UInt_t)) {
791 const unsigned char* ctxt = (
const unsigned char*) txt;
792 for (
unsigned int i = 0; i < 4; ++i) {
793 ret ^= ctxt[i] << (i * 8);
795 if (
sizeof(
void*) >
sizeof(
UInt_t)) {
797 for (
unsigned int i = 0; i < 4; ++i) {
798 ret ^= ctxt[i] << (i * 8);
813 if (tolower((
unsigned char)*p) != tolower((
unsigned char)*q))
829 if (slen < startIndex + plen)
return kNPOS;
830 if (plen == 0)
return startIndex;
831 slen -= startIndex + plen;
832 const char *sp =
Data() + startIndex;
835 for (
Ssiz_t i = 0; i <= slen; ++i)
836 if (sp[i] == first && memcmp(sp+i+1, pattern+1, plen-1) == 0)
837 return i + startIndex;
839 int first = tolower((
unsigned char) *pattern);
840 for (
Ssiz_t i = 0; i <= slen; ++i)
841 if (tolower((
unsigned char) sp[i]) == first &&
843 return i + startIndex;
853 const char *
f = strrchr(
Data(), (
unsigned char) c);
874 const char *specials =
"^$.[]*+?";
886 const char *specials =
"[]*?";
898 if (!rep)
return *
this;
904 Error(
"TString::Prepend",
"rep too large (%d, max = %d)", rep,
MaxSize()-len);
912 if (capac - tot >= 0) {
913 memmove(p + rep, p, len);
918 data =
new char[cap+1];
919 memcpy(data+rep, p, len);
940 if (pos <= kNPOS || pos > len) {
941 Error(
"TString::Replace",
942 "first argument out of bounds: pos = %d, Length = %d", pos, len);
949 Ssiz_t tot = len - n1 + n2;
950 Ssiz_t rem = len - n1 - pos;
955 if (capac - len + n1 >= n2) {
959 if (n2) memmove(p + pos, cs, n2);
960 memmove(p + pos + n2, p + pos + n1, rem);
963 if (p + pos < cs && cs < p + len) {
964 if (p + pos + n1 <= cs)
967 memmove(p + pos, cs, n1);
974 memmove(p + pos + n2, p + pos + n1, rem);
977 if (n2) memmove(p + pos, cs, n2);
983 char *data =
new char[cap+1];
984 if (pos) memcpy(data, p, pos);
985 if (n2 ) memcpy(data + pos, cs, n2);
986 if (rem) memcpy(data + pos + n2, p + pos + n1, rem);
1003 if (s1 && ls1 > 0) {
1021 const char *direct =
Data();
1025 while (start < end && direct[start] == c)
1028 while (start < end && direct[end-1] == c)
1038 Remove(send - start - (send - end), send - end);
1060 const char *direct =
Data();
1063 while (start < end && direct[start] == c)
1066 while (start < end && direct[end-1] == c)
1068 if (end == start) start = end =
kNPOS;
1080 *p = tolower((
unsigned char)*p);
1093 *p = toupper((
unsigned char)*p);
1104 Error(
"TString::AssertElement",
1105 "out of bounds: i = %d, Length = %d", i,
Length());
1114 if (newCap > ms - 1) {
1115 Error(
"TString::AdjustCapacity",
"capacity too large (%d, max = %d)",
1137 Error(
"TString::Clobber",
"capacity too large (%d, max = %d)", nc,
MaxSize());
1148 data =
new char[cap+1];
1165 if (len >= tot)
return;
1168 Error(
"TString::Clone",
"tot too large (%d, max = %d)", tot,
MaxSize());
1175 if (capac - tot < 0) {
1177 data =
new char[cap+1];
1178 memcpy(data, p, len);
1201 tobuf(buffer, nchars);
1207 for (
int i = 0; i < nchars; i++) buffer[i] = data[i];
1229 Error(
"TString::ReadBuffer",
"found case with nwh=%d and nchars=%d", nwh, nchars);
1233 char *data =
Init(nchars, nchars);
1235 for (
int i = 0; i < nchars; i++)
frombuf(buffer, &data[i]);
1267 ::Error(
"TString::ReadObject",
"could not create object of class %s",
1295 void TString::Streamer(
TBuffer &b)
1341 #if defined(R__TEMPLATE_OVERLOAD_BUG)
1369 const char *data = s1.
Data();
1372 for (i = 0; s2[i]; ++i)
1373 if (data[i] != s2[i] || i == len)
return kFALSE;
1384 const char *uc = str.
Data();
1385 char *lc = (
char*)temp.
Data();
1387 while (n--) { *lc++ = tolower((
unsigned char)*uc); uc++; }
1398 const char* uc = str.
Data();
1399 char* lc = (
char*)temp.
Data();
1401 while (n--) { *lc++ = toupper((
unsigned char)*uc); uc++; }
1443 snprintf(si,
sizeof(si),
"%ld", i);
1453 snprintf(si,
sizeof(si),
"%lu", i);
1463 snprintf(si,
sizeof(si),
"%lld", i);
1473 snprintf(si,
sizeof(si),
"%llu", i);
1491 snprintf(si,
sizeof(si),
"%ld", i);
1501 snprintf(si,
sizeof(si),
"%lu", i);
1511 snprintf(si,
sizeof(si),
"%lld", i);
1521 snprintf(si,
sizeof(si),
"%llu", i);
1533 ::Obsolete(
"TString::GetInitialCapacity",
"v5-30-00",
"v5-32-00");
1541 ::Obsolete(
"TString::GetResizeIncrement",
"v5-30-00",
"v5-32-00");
1549 ::Obsolete(
"TString::GetMaxWaste",
"v5-30-00",
"v5-32-00");
1558 ::Obsolete(
"TString::InitialCapacity",
"v5-30-00",
"v5-32-00");
1567 ::Obsolete(
"TString::ResizeIncrement",
"v5-30-00",
"v5-32-00");
1577 ::Obsolete(
"TString::MaxWaste",
"v5-30-00",
"v5-32-00");
1595 : fStr((
TString&)str), fBegin(start), fExtent(nextent)
1604 if (start <
Length() && len > 0) {
1605 if (start+len >
Length())
1623 Ssiz_t len = pattern ? strlen(pattern) : 0;
1672 if (ss.
IsNull())
return *cs ==
'\0';
1676 for (i = 0; cs[i]; ++i)
1710 while (n--) { *p = tolower((
unsigned char)*p); p++;}
1722 while (n--) { *p = toupper((
unsigned char)*p); p++;}
1731 Error(
"TSubString::SubStringError",
1732 "out of bounds: start = %d, n = %d, sr = %d", start, n, sr);
1741 Error(
"TSubString::AssertElement",
1742 "out of bounds: i = %d, Length = %d", i,
Length());
1750 const char *cp =
Data();
1763 const char *cp =
Data();
1765 if (len == 0)
return kFALSE;
1766 for (
Ssiz_t i = 0; i < len; ++i)
1767 if (!isalpha(cp[i]))
1778 const char *cp =
Data();
1780 if (len == 0)
return kFALSE;
1781 for (
Ssiz_t i = 0; i < len; ++i)
1782 if (!isalnum(cp[i]))
1795 const char *cp =
Data();
1797 if (len == 0)
return kFALSE;
1799 for (
Ssiz_t i = 0; i < len; ++i) {
1800 if (cp[i] !=
' ' && !isdigit(cp[i]))
return kFALSE;
1801 if (cp[i] ==
' ') b++;
1802 if (isdigit(cp[i]))
d++;
1833 pos = tmp.
First(
',');
1835 pos = tmp.
Index(
"e-");
1836 if (pos >= 1) tmp.
Replace(pos, 2,
" ", 1);
1837 pos = tmp.
Index(
"e+");
1838 if (pos >= 1) tmp.
Replace(pos, 2,
" ", 1);
1839 pos = tmp.
Index(
"e");
1840 if (pos >= 1) tmp.
Replace(pos, 1,
" ", 1);
1841 pos = tmp.
First(
'-');
1842 if (pos == 0) tmp.
Replace(pos, 1,
" ", 1);
1843 pos = tmp.
First(
'+');
1844 if (pos == 0) tmp.
Replace(pos, 1,
" ", 1);
1857 const char *cp =
Data();
1859 if (len == 0)
return kFALSE;
1860 for (
Ssiz_t i = 0; i < len; ++i)
1861 if (!isxdigit(cp[i]))
1873 const char *cp =
Data();
1875 if (len == 0)
return kFALSE;
1876 for (
Ssiz_t i = 0; i < len; ++i)
1877 if (cp[i] !=
'0' && cp[i] !=
'1')
1889 const char *cp =
Data();
1891 if (len == 0)
return kFALSE;
1892 for (
Ssiz_t i = 0; i < len; ++i)
1893 if (!isdigit(cp[i]) || cp[i]==
'8' || cp[i]==
'9')
1905 const char *cp =
Data();
1907 if (len == 0)
return kFALSE;
1908 for (
Ssiz_t i = 0; i < len; ++i)
1909 if (!isdigit(cp[i]))
1922 if (base < 2 || base > 36) {
1923 Error(
"TString::IsInBaseN",
"base %d is not supported. Supported bases are {2,3,...,36}.", base);
1927 Error(
"TString::IsInBaseN",
"input string is empty.") ;
1932 TString str_ref0 =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
1956 if (end == -1)
return atoi(
Data());
1963 start = end+1; end =
Index(
" ", start);
1968 return atoi(tmp.
Data());
1983 if (end == -1)
return atoll(
Data());
1985 if (end == -1)
return _atoi64(
Data());
1993 start = end+1; end =
Index(
" ", start);
1999 return atoll(tmp.
Data());
2001 return _atoi64(tmp.
Data());
2023 if (comma == -1 && end == -1)
return atof(
Data());
2030 if (end == -1)
return atof(tmp.
Data());
2035 tmp2 += tmp(start, end-start);
2036 start = end+1; end = tmp.
Index(
" ", start);
2039 tmp2 += tmp(start, end-start);
2040 return atof(tmp2.
Data());
2059 if (base < 2 || base > 36) {
2060 Error(
"TString::Itoa",
"base %d is not supported. Supported bases are {2,3,...,36}.",base) ;
2067 buf +=
"0123456789abcdefghijklmnopqrstuvwxyz"[
TMath::Abs(quotient % base) ];
2071 if (value < 0) buf +=
'-';
2072 std::reverse(buf.begin(), buf.end());
2086 if (base < 2 || base > 36) {
2087 Error(
"TString::UItoa",
"base %d is not supported. Supported bases are {2,3,...,36}.",base);
2094 buf +=
"0123456789abcdefghijklmnopqrstuvwxyz"[ quotient % base ];
2097 std::reverse(buf.begin(), buf.end());
2111 if (base < 2 || base > 36) {
2112 Error(
"TString::LLtoa",
"base %d is not supported. Supported bases are {2,3,...,36}.",base);
2119 buf +=
"0123456789abcdefghijklmnopqrstuvwxyz"[
TMath::Abs(quotient % base) ];
2123 if (value < 0) buf +=
'-';
2124 std::reverse(buf.begin(), buf.end());
2138 if (base < 2 || base > 36) {
2139 Error(
"TString::ULLtoa",
"base %d is not supported. Supported bases are {2,3,...,36}.",base);
2146 buf +=
"0123456789abcdefghijklmnopqrstuvwxyz"[ quotient % base ];
2149 std::reverse(buf.begin(), buf.end());
2161 if (base_in < 2 || base_in > 36 || base_out < 2 || base_out > 36) {
2162 Error(
"TString::BaseConvert",
"only bases 2-36 are supported (base_in=%d, base_out=%d).", base_in, base_out);
2168 if (s_in_[0] ==
'-') {
2172 if (!isSigned && s_in_[0] ==
'+') s_in_.
Remove(0, 1);
2175 if (!s_in_.
Length()) s_in_ +=
'0';
2178 Error(
"TString::BaseConvert",
"s_in=\"%s\" is not in base %d", s_in.
Data(), base_in);
2185 Error(
"TString::BaseConvert",
"s_in=\"%s\" > %s = 2^64-1 in base %d.", s_in.
Data(), s_max.
Data(), base_in);
2190 if (s_in_ > s_max) {
2192 Error(
"TString::BaseConvert",
"s_in=\"%s\" > %s = 2^64-1 in base %d.", s_in.
Data(), s_max.
Data(), base_in);
2200 if (isSigned) s_out.
Prepend(
"-");
2209 if (!s)
return kTRUE;
2216 return strcmp(s, s2) == 0;
2217 return strcasecmp(s, s2) == 0;
2229 std::list<Int_t> splitIndex;
2232 for (i = 0; i < delim.
Length(); i++) {
2234 while (start <
Length()) {
2236 if (pos ==
kNPOS)
break;
2237 splitIndex.push_back(pos);
2240 if (start > 0) nrDiff++;
2242 splitIndex.push_back(
Length());
2251 std::list<Int_t>::const_iterator it;
2253 for (it = splitIndex.begin(); it != splitIndex.end(); it++) {
2255 for (it = splitIndex.begin(); it != (std::list<Int_t>::const_iterator) splitIndex.end(); it++) {
2258 if (stop - 1 >= start + 1) {
2259 TString tok = (*this)(start+1, stop-start-1);
2275 Ssiz_t buflen = 20 + 20 * strlen(fmt);
2283 n = vsnprintf(
GetPointer(), buflen, fmt, ap);
2286 if (n == -1 || n >= buflen) {
2311 va_start(ap,
va_(fmt));
2324 va_start(ap,
va_(fmt));
2339 static const int fld_size = 2048;
2340 TTHREAD_TLS(
char*) slowBuffer(0);
2341 TTHREAD_TLS(
int) slowBufferSize(0);
2343 if (hint == -1) hint = fld_size;
2344 if (hint > slowBufferSize) {
2345 delete [] slowBuffer;
2346 slowBufferSize = 2 * hint;
2347 if (hint < 0 || slowBufferSize < 0) {
2352 slowBuffer =
new char[slowBufferSize];
2358 int n = vsnprintf(slowBuffer, slowBufferSize, format, ap);
2361 if (n == -1 || n >= slowBufferSize) {
2362 if (n == -1) n = 2 * slowBufferSize;
2363 if (n == slowBufferSize) n++;
2387 static const int cb_size = 4096;
2388 static const int fld_size = 2048;
2391 TTHREAD_TLS_ARRAY(
char,cb_size,gFormbuf);
2392 TTHREAD_TLS(
char*) gBfree(0);
2393 TTHREAD_TLS(
char*) gEndbuf(0);
2397 gEndbuf = &gFormbuf[cb_size-1];
2401 if (buf+fld_size > gEndbuf)
2407 int n = vsnprintf(buf, fld_size, format, ap);
2410 if (n == -1 || n >= fld_size) {
2435 va_start(ap,
va_(fmt));
2449 va_start(ap,
va_(fmt));
2469 char *buf =
new char[l+1];
2482 const char *
t2 = s + l - 1;
2483 while (*t2 == c && t2 > s)
2490 strncpy(buf, t1, (
Ssiz_t) (t2-t1+1));
2491 *(buf+(t2-t1+1)) =
'\0';
2504 char *s =
new char[strlen(str)+1];
2505 if (s) strcpy(s, str);
2518 const char *p = str;
2519 char *s, *
s1 =
new char[strlen(str)+1];
2535 int EscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
2539 char *
q, *end = dst+dstlen-1;
2541 for (p = src, q = dst; *p && q < end; ) {
2542 if (strchr(specchars, *p)) {
2559 int UnEscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
char)
2562 char *
q, *end = dst+dstlen-1;
2564 for (p = src, q = dst; *p && q < end; ) {
2565 if (strchr(specchars, *p))
2577 #ifdef NEED_STRCASECMP
2581 int strcasecmp(
const char *str1,
const char *str2)
2583 return strncasecmp(str1, str2, str2 ? strlen(str2)+1 : 0);
2589 int strncasecmp(
const char *str1,
const char *str2,
Ssiz_t n)
2632 std::string str(val);
A zero length substring is legal.
static Ssiz_t GetMaxWaste()
TString MD5() const
Return the MD5 digest for this string, in a string representation.
void SetBufferOffset(Int_t offset=0)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
void frombuf(char *&buf, Bool_t *x)
void ToLower()
Convert sub-string to lower-case.
virtual void FillBuffer(char *&buffer) const
Copy string into I/O buffer.
TSubString & operator=(const char *s)
Assign char* to sub-string.
static TString Itoa(Int_t value, Int_t base)
Converts an Int_t to a TString with respect to the base specified (2-36).
TString operator+(const TString &s, const char *cs)
Use the special concatenation constructor.
static Ssiz_t MaxWaste(Ssiz_t mw=15)
Set maximum space that may be wasted in a string before doing a resize.
char * Compress(const char *str)
Remove all blanks from the string str.
void Final()
MD5 finalization, ends an MD5 message-digest operation, writing the the message digest and zeroizing ...
Bool_t MaybeRegexp() const
Returns true if string contains one of the regexp characters "^$.[]*+?".
void ToUpper()
Convert sub-string to upper-case.
Collectable string class.
Bool_t IsOct() const
Returns true if all characters in string are octal digits (0-7).
TString & ReplaceAll(const TString &s1, const TString &s2)
void SubStringError(Ssiz_t, Ssiz_t, Ssiz_t) const
Output error message.
char * StrDup(const char *str)
Duplicate the string str.
Bool_t IsInBaseN(Int_t base) const
Returns true if all characters in string are expressed in the base specified (range=2-36), i.e.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Double_t Atof() const
Return floating-point value contained in string.
Bool_t IsAlnum() const
Returns true if all characters in string are alphanumeric.
void Clone(Ssiz_t nc)
Make self a distinct copy with capacity of at least tot, where tot cannot be smaller than the current...
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...
void ToUpper()
Change string to upper case.
Buffer base class used for serializing objects.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
Bool_t operator==(const TString &s1, const char *s2)
Compare TString with a char *.
TString ToUpper(const TString &str)
Return an upper-case version of str.
Short_t Min(Short_t a, Short_t b)
void ToLower()
Change string to lower-case.
TString & operator=(char s)
Assign character c to TString.
virtual void WriteClass(const TClass *cl)=0
static Ssiz_t ResizeIncrement(Ssiz_t ri=16)
Set default resize increment for all TStrings. Default is 16.
virtual void WriteTString(const TString &s)=0
TString ToLower(const TString &str)
Return a lower-case version of str.
TString & Prepend(const char *cs)
static std::string format(double x, double y, int digits, int width)
TBuffer & operator<<(TBuffer &buf, const TString *s)
Write TString or derived to TBuffer.
static void WriteString(TBuffer &b, const TString *a)
Write TString object to buffer.
TString Copy() const
Copy a string.
void Obsolete(const char *function, const char *asOfVers, const char *removedFromVers)
Use this function to declare a function obsolete.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
char * Init(Ssiz_t capacity, Ssiz_t nchar)
Private member function returning an empty string representation of size capacity and containing ncha...
static int MemIsEqual(const char *p, const char *q, Ssiz_t n)
Returns false if strings are not equal.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
const char * Data() const
Bool_t IsBin() const
Returns true if all characters in string are binary digits (0,1).
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
virtual void ReadBuffer(char *&buffer)
Read string from I/O buffer.
const char * AsString() const
Return message digest as string.
This code implements the MD5 message-digest algorithm.
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
static TString * ReadString(TBuffer &b, const TClass *clReq)
Read TString object from buffer.
void Clear()
Clear string without changing its capacity.
TString & Append(const char *cs)
static Ssiz_t Recommend(Ssiz_t s)
static Ssiz_t GetInitialCapacity()
Int_t Atoi() const
Return integer value of string.
void tobuf(char *&buf, Bool_t x)
void Error(const char *location, const char *msgfmt,...)
void AssertElement(Ssiz_t nc) const
Check to make sure a string index is in range.
char & operator()(Ssiz_t i)
static UInt_t SwapInt(UInt_t x)
std::string printValue(const TDatime &val)
Print a TDatime at the prompt.
void AssertElement(Ssiz_t i) const
Check to make sure a sub-string index is in range.
char & operator[](Ssiz_t i)
Return character at pos i from sub-string. Check validity of i.
R__EXTERN Bool_t gPrintViaErrorHandler
Bool_t IsDec() const
Returns true if all characters in string are decimal digits (0-9).
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
#define R__VA_COPY(to, from)
void Update(const UChar_t *buf, UInt_t len)
Update TMD5 object to reflect the concatenation of another buffer full of bytes.
Ssiz_t GetLongSize() const
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...
char & operator()(Ssiz_t i)
Return character at pos i from sub-string. No check on i.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
TBuffer & operator>>(TBuffer &buf, TString *&s)
Read string from TBuffer. Function declared in ClassDef.
void SetLongCap(Ssiz_t s)
virtual const char * GetName() const
Returns name of object.
TSubString Strip(EStripType s=kTrailing, char c= ' ') const
Return a substring of self stripped at beginning and/or end.
The ROOT global object gROOT contains a list of all defined classes.
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
UInt_t HashFoldCase() const
Return a case-insensitive hash value (endian independent).
void SetLongPointer(char *p)
Int_t CountChar(Int_t c) const
Return number of times character c occurs in the string.
static Ssiz_t GetResizeIncrement()
int UnEscChar(const char *src, char *dst, int dstlen, char *specchars, char)
Un-escape specchars in src from escchar and copy to dst.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
static Ssiz_t InitialCapacity(Ssiz_t ic=15)
Set default initial capacity for all TStrings. Default is 15.
void FormImp(const char *fmt, va_list ap)
Formats a string using a printf style format descriptor.
static const Ssiz_t kNPOS
void Clobber(Ssiz_t nc)
Clear string and make sure it has a capacity of nc.
TString & Remove(Ssiz_t pos)
int EscChar(const char *src, char *dst, int dstlen, char *specchars, char escchar)
Escape specchars in src with escchar and copy to dst.
void SetLongSize(Ssiz_t s)
static char * SlowFormat(const char *format, va_list ap, int hint)
Format a string in a formatting buffer (using a printf style format descriptor).
Long64_t Atoll() const
Return long long value of string.
unsigned long long ULong64_t
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
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.
Bool_t IsFloat() const
Returns kTRUE if string contains a floating point or integer number.
Bool_t MaybeWildcard() const
Returns true if string contains one of the wildcard characters "[]*?".
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...
UInt_t HashCase() const
Return a case-sensitive hash value (endian independent).
void SetShortSize(Ssiz_t s)
virtual void ReadTString(TString &s)=0
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
void ErrorHandler(int level, const char *location, const char *fmt, va_list va)
General error handler function. It calls the user set error handler.
TSubString(const TString &s, Ssiz_t start, Ssiz_t len)
Private constructor.
const size_t kBitsPerByte
Short_t Max(Short_t a, Short_t b)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
uint64_t rotl64(uint64_t x, int8_t r)
virtual Int_t Sizeof() const
Returns size string will occupy on I/O buffer.
virtual TClass * ReadClass(const TClass *cl=0, UInt_t *objTag=0)=0
ClassImp(TSlaveInfo) Int_t TSlaveInfo const TSlaveInfo * si
Used to sort slaveinfos by ordinal.
static TString LLtoa(Long64_t value, Int_t base)
Converts a Long64_t to a TString with respect to the base specified (2-36).
TString()
TString default ctor.
const char * Data() const
static void Mash(UInt_t &hash, UInt_t chars)
Utility used by Hash().
UInt_t Hash(const char *str)
Return a case-sensitive hash value (endian independent).
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Bool_t IsAlpha() const
Returns true if all characters in string are alphabetic.
Bool_t IsHex() const
Returns true if all characters in string are hexadecimal digits (0-9,a-f,A-F).
void Printf(const char *va_(fmt),...)
Formats a string in a circular formatting buffer and prints the string.
static Ssiz_t AdjustCapacity(Ssiz_t oldCap, Ssiz_t newCap)
Calculate a nice capacity greater than or equal to newCap.
Ssiz_t First(char c) const
Find first occurrence of a character c.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Bool_t IsAscii() const
Returns true if all characters in string are ascii.
void InitChar(char c)
Initialize a string with a single character.
ClassImp(TString) const UInt_t kHashShift
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
virtual ~TString()
Delete a TString.
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.