59 #define strtoull _strtoui64 63 namespace std { using ::list; }
121 memcpy(data, s.c_str(),
n);
156 while (n--) data[
n] =
c;
179 fRep.fRaw = s.fRep.fRaw;
190 memcpy(data, substr.
Data(), len);
202 memcpy(data, a1, n1);
203 memcpy(data+n1, a2, n2);
220 if (capacity > MaxSize()) {
221 Error(
"TString::Init",
"capacity too large (%d, max = %d)", capacity, MaxSize());
222 capacity = MaxSize();
223 if (nchar > capacity)
228 if (capacity < kMinCap) {
230 data = GetShortPointer();
232 Ssiz_t cap = Recommend(capacity);
233 data =
new char[cap+1];
236 SetLongPointer(data);
253 return Replace(0, Length(), &c, 1);
266 return Replace(0, Length(), cs, strlen(cs));
279 return Replace(0, Length(), s.c_str(), s.length());
292 return Replace(0, Length(), s.
data(), s.
length());
324 return Replace(0, Length(), substr.
Data(), len);
332 if (!rep)
return *
this;
337 if (tot > MaxSize()) {
338 Error(
"TString::Append",
"rep too large (%d, max = %d)", rep, MaxSize()-len);
343 Ssiz_t capac = Capacity();
344 char *
data, *p = GetPointer();
346 if (capac - tot >= 0) {
350 Ssiz_t cap = AdjustCapacity(capac, tot);
351 data =
new char[cap+1];
352 memcpy(data, p, len);
356 SetLongPointer(data);
390 const char *cs1 =
Data();
394 for (; cs2[i]; ++i) {
395 if (i == len)
return -1;
396 if (cs1[i] != cs2[i])
return ((cs1[i] > cs2[i]) ? 1 : -1);
399 for (; cs2[i]; ++i) {
400 if (i == len)
return -1;
401 char c1 = tolower((
unsigned char)cs1[i]);
402 char c2 = tolower((
unsigned char)cs2[i]);
403 if (c1 != c2)
return ((c1 > c2) ? 1 : -1);
406 return (i < len) ? 1 : 0;
418 const char *s1 =
Data();
419 const char *s2 = str.
Data();
423 if (len < slen) slen = len;
425 int result = memcmp(s1, s2, slen);
426 if (result != 0)
return result;
429 for (; i < slen; ++i) {
430 char c1 = tolower((
unsigned char)s1[i]);
431 char c2 = tolower((
unsigned char)s2[i]);
432 if (c1 != c2)
return ((c1 > c2) ? 1 : -1);
437 if (len == slen)
return 0;
438 return (len > slen) ? 1 : -1;
447 Int_t len = Length();
450 if (data[
n] == c) count++;
469 const char *
f = strchr(
Data(), c);
478 const char *
f = strpbrk(
Data(), cs);
487 return (((x & 0x000000ffU) << 24) | ((x & 0x0000ff00U) << 8) |
488 ((x & 0x00ff0000U) >> 8) | ((x & 0xff000000U) >> 24));
507 UInt_t len = str ? strlen(str) : 0;
525 if ((i = len*
sizeof(
char)%
sizeof(
UInt_t)) != 0) {
527 const char*
c = (
const char*)p;
535 const unsigned char *p = (
const unsigned char*)str;
538 memcpy(&h, p,
sizeof(
UInt_t));
548 if ((i = len*
sizeof(
char)%
sizeof(
UInt_t)) != 0) {
550 const char*
c = (
const char*)p;
578 if ((i = Length()*
sizeof(
char)%
sizeof(
UInt_t)) != 0) {
580 const char*
c = (
const char*)p;
595 const unsigned char *p = (
const unsigned char*)
Data();
597 Mash(hv, toupper(*p));
608 return (cmp == kExact) ? HashCase() : HashFoldCase();
631 #if defined(_MSC_VER) && (_MSC_VER < 1800) 633 typedef unsigned char uint8_t;
634 typedef unsigned long uint32_t;
635 typedef unsigned __int64 uint64_t;
636 #else // defined(_MSC_VER) 639 #endif // !defined(_MSC_VER) 642 #if defined(_MSC_VER) 644 #define FORCE_INLINE __forceinline 646 #define ROTL64(x,y) _rotl64(x,y) 647 #define BIG_CONSTANT(x) (x) 648 #else // defined(_MSC_VER) 652 return (x << r) | (x >> (64 -
r));
655 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) <= 40101 657 #define FORCE_INLINE inline 661 #define FORCE_INLINE __attribute__((always_inline)) inline 663 #define ROTL64(x,y) rotl64(x,y) 664 #define BIG_CONSTANT(x) (x##LLU) 665 #endif // !defined(_MSC_VER) 673 FORCE_INLINE uint64_t getblock(
const uint64_t* p,
int i)
698 static void MurmurHash3_x64_128(
const void * key,
const int len,
699 const uint32_t seed, uint64_t out[2] )
701 const uint8_t *
data = (
const uint8_t*)key;
702 const int nblocks = len / 16;
713 const uint64_t * blocks = (
const uint64_t *)(data);
715 for(
int i = 0; i < nblocks; i++)
717 uint64_t k1 = getblock(blocks,i*2+0);
718 uint64_t k2 = getblock(blocks,i*2+1);
720 k1 *=
c1; k1 =
ROTL64(k1,31); k1 *=
c2; h1 ^= k1;
722 h1 =
ROTL64(h1,27); h1 += h2; h1 = h1*5+0x52dce729;
724 k2 *=
c2; k2 =
ROTL64(k2,33); k2 *=
c1; h2 ^= k2;
726 h2 =
ROTL64(h2,31); h2 +=
h1; h2 = h2*5+0x38495ab5;
732 const uint8_t * tail = (
const uint8_t*)(data + nblocks*16);
738 case 15: k2 ^= uint64_t(tail[14]) << 48;
739 case 14: k2 ^= uint64_t(tail[13]) << 40;
740 case 13: k2 ^= uint64_t(tail[12]) << 32;
741 case 12: k2 ^= uint64_t(tail[11]) << 24;
742 case 11: k2 ^= uint64_t(tail[10]) << 16;
743 case 10: k2 ^= uint64_t(tail[ 9]) << 8;
744 case 9: k2 ^= uint64_t(tail[ 8]) << 0;
745 k2 *=
c2; k2 =
ROTL64(k2,33); k2 *=
c1; h2 ^= k2;
747 case 8: k1 ^= uint64_t(tail[ 7]) << 56;
748 case 7: k1 ^= uint64_t(tail[ 6]) << 48;
749 case 6: k1 ^= uint64_t(tail[ 5]) << 40;
750 case 5: k1 ^= uint64_t(tail[ 4]) << 32;
751 case 4: k1 ^= uint64_t(tail[ 3]) << 24;
752 case 3: k1 ^= uint64_t(tail[ 2]) << 16;
753 case 2: k1 ^= uint64_t(tail[ 1]) << 8;
754 case 1: k1 ^= uint64_t(tail[ 0]) << 0;
755 k1 *=
c1; k1 =
ROTL64(k1,31); k1 *=
c2; h1 ^= k1;
761 h1 ^= len; h2 ^= len;
772 ((uint64_t*)out)[0] =
h1;
773 ((uint64_t*)out)[1] = h2;
790 if (ntxt !=
sizeof(
void*)) {
791 uint64_t buf[2] = {0};
792 MurmurHash3_x64_128(txt, ntxt, 0x6384BA69, buf);
798 if (((
size_t)txt) %
sizeof(
void*)) {
801 if (
sizeof(
void*) >
sizeof(
UInt_t)) {
805 const unsigned char* ctxt = (
const unsigned char*) txt;
806 for (
unsigned int i = 0; i < 4; ++i) {
807 ret ^= ctxt[i] << (i * 8);
809 if (
sizeof(
void*) >
sizeof(
UInt_t)) {
811 for (
unsigned int i = 0; i < 4; ++i) {
812 ret ^= ctxt[i] << (i * 8);
827 if (tolower((
unsigned char)*p) != tolower((
unsigned char)*q))
843 if (slen < startIndex + plen)
return kNPOS;
844 if (plen == 0)
return startIndex;
845 slen -= startIndex + plen;
846 const char *sp =
Data() + startIndex;
849 for (
Ssiz_t i = 0; i <= slen; ++i)
850 if (sp[i] == first && memcmp(sp+i+1, pattern+1, plen-1) == 0)
851 return i + startIndex;
853 int first = tolower((
unsigned char) *pattern);
854 for (
Ssiz_t i = 0; i <= slen; ++i)
855 if (tolower((
unsigned char) sp[i]) == first &&
857 return i + startIndex;
867 const char *
f = strrchr(
Data(), (
unsigned char) c);
888 const char *specials =
"^$.[]*+?";
890 if (First(specials) ==
kNPOS)
900 const char *specials =
"[]*?";
902 if (First(specials) ==
kNPOS)
912 if (!rep)
return *
this;
917 if (tot > MaxSize()) {
918 Error(
"TString::Prepend",
"rep too large (%d, max = %d)", rep, MaxSize()-len);
923 Ssiz_t capac = Capacity();
924 char *
data, *p = GetPointer();
926 if (capac - tot >= 0) {
927 memmove(p + rep, p, len);
931 Ssiz_t cap = AdjustCapacity(capac, tot);
932 data =
new char[cap+1];
933 memcpy(data+rep, p, len);
937 SetLongPointer(data);
954 if (pos <= kNPOS || pos > len) {
955 Error(
"TString::Replace",
956 "first argument out of bounds: pos = %d, Length = %d", pos, len);
963 Ssiz_t tot = len - n1 + n2;
964 Ssiz_t rem = len - n1 - pos;
966 Ssiz_t capac = Capacity();
967 char *p = GetPointer();
969 if (capac - len + n1 >= n2) {
973 if (n2) memmove(p + pos, cs, n2);
974 memmove(p + pos + n2, p + pos + n1, rem);
977 if (p + pos < cs && cs < p + len) {
978 if (p + pos + n1 <= cs)
981 memmove(p + pos, cs, n1);
988 memmove(p + pos + n2, p + pos + n1, rem);
991 if (n2) memmove(p + pos, cs, n2);
996 Ssiz_t cap = AdjustCapacity(capac, tot);
997 char *
data =
new char[cap+1];
998 if (pos) memcpy(data, p, pos);
999 if (n2 ) memcpy(data + pos, cs, n2);
1000 if (rem) memcpy(data + pos + n2, p + pos + n1, rem);
1004 SetLongPointer(data);
1017 if (s1 && ls1 > 0) {
1019 while ((index =
Index(s1, ls1, index, kExact)) !=
kNPOS) {
1020 Replace(index, ls1, s2, ls2);
1035 const char *direct =
Data();
1039 while (start < end && direct[start] == c)
1042 while (start < end && direct[end-1] == c)
1052 Remove(send - start - (send - end), send - end);
1064 Append(
' ', n-Length());
1074 const char *direct =
Data();
1077 while (start < end && direct[start] == c)
1080 while (start < end && direct[end-1] == c)
1082 if (end == start) start = end =
kNPOS;
1092 char *p = GetPointer();
1094 *p = tolower((
unsigned char)*p);
1105 char *p = GetPointer();
1107 *p = toupper((
unsigned char)*p);
1117 if (i ==
kNPOS || i > Length())
1118 Error(
"TString::AssertElement",
1119 "out of bounds: i = %d, Length = %d", i, Length());
1128 if (newCap > ms - 1) {
1129 Error(
"TString::AdjustCapacity",
"capacity too large (%d, max = %d)",
1132 Ssiz_t cap = oldCap < ms / 2 - kAlignment ?
1133 Recommend(
TMath::Max(newCap, 2 * oldCap)) : ms - 1;
1142 Clobber(Capacity());
1150 if (nc > MaxSize()) {
1151 Error(
"TString::Clobber",
"capacity too large (%d, max = %d)", nc, MaxSize());
1159 char *
data = GetLongPointer();
1160 Ssiz_t cap = Recommend(nc);
1161 if (cap != Capacity()) {
1162 data =
new char[cap+1];
1165 SetLongPointer(data);
1179 if (len >= tot)
return;
1181 if (tot > MaxSize()) {
1182 Error(
"TString::Clone",
"tot too large (%d, max = %d)", tot, MaxSize());
1186 Ssiz_t capac = Capacity();
1187 char *
data, *p = GetPointer();
1189 if (capac - tot < 0) {
1190 Ssiz_t cap = Recommend(tot);
1191 data =
new char[cap+1];
1192 memcpy(data, p, len);
1196 SetLongPointer(data);
1210 Int_t nchars = Length();
1215 tobuf(buffer, nchars);
1220 const char *
data = GetPointer();
1221 for (
int i = 0; i < nchars; i++) buffer[i] = data[i];
1243 Error(
"TString::ReadBuffer",
"found case with nwh=%d and nchars=%d", nwh, nchars);
1249 for (
int i = 0; i < nchars; i++)
frombuf(buffer, &data[i]);
1281 ::Error(
"TString::ReadObject",
"could not create object of class %s",
1303 return Length()+
sizeof(
UChar_t);
1355 #if defined(R__TEMPLATE_OVERLOAD_BUG) 1386 for (i = 0; s2[i]; ++i)
1387 if (data[i] != s2[i] || i == len)
return kFALSE;
1398 const char *uc = str.
Data();
1399 char *lc = (
char*)temp.
Data();
1401 while (n--) { *lc++ = tolower((
unsigned char)*uc); uc++; }
1412 const char* uc = str.
Data();
1413 char* lc = (
char*)temp.
Data();
1415 while (n--) { *lc++ = toupper((
unsigned char)*uc); uc++; }
1457 snprintf(si,
sizeof(si),
"%ld", i);
1467 snprintf(si,
sizeof(si),
"%lu", i);
1477 snprintf(si,
sizeof(si),
"%lld", i);
1487 snprintf(si,
sizeof(si),
"%llu", i);
1505 snprintf(si,
sizeof(si),
"%ld", i);
1515 snprintf(si,
sizeof(si),
"%lu", i);
1525 snprintf(si,
sizeof(si),
"%lld", i);
1535 snprintf(si,
sizeof(si),
"%llu", i);
1547 ::Obsolete(
"TString::GetInitialCapacity",
"v5-30-00",
"v5-32-00");
1555 ::Obsolete(
"TString::GetResizeIncrement",
"v5-30-00",
"v5-32-00");
1563 ::Obsolete(
"TString::GetMaxWaste",
"v5-30-00",
"v5-32-00");
1572 ::Obsolete(
"TString::InitialCapacity",
"v5-30-00",
"v5-32-00");
1581 ::Obsolete(
"TString::ResizeIncrement",
"v5-30-00",
"v5-32-00");
1591 ::Obsolete(
"TString::MaxWaste",
"v5-30-00",
"v5-32-00");
1609 : fStr((
TString&)str), fBegin(start), fExtent(nextent)
1618 if (start <
Length() && len > 0) {
1619 if (start+len >
Length())
1637 Ssiz_t len = pattern ? strlen(pattern) : 0;
1686 if (ss.
IsNull())
return *cs ==
'\0';
1690 for (i = 0; cs[i]; ++i)
1724 while (n--) { *p = tolower((
unsigned char)*p); p++;}
1736 while (n--) { *p = toupper((
unsigned char)*p); p++;}
1745 Error(
"TSubString::SubStringError",
1746 "out of bounds: start = %d, n = %d, sr = %d", start, n, sr);
1755 Error(
"TSubString::AssertElement",
1756 "out of bounds: i = %d, Length = %d", i,
Length());
1764 const char *cp =
Data();
1777 const char *cp =
Data();
1779 if (len == 0)
return kFALSE;
1780 for (
Ssiz_t i = 0; i < len; ++i)
1781 if (!isalpha(cp[i]))
1792 const char *cp =
Data();
1794 if (len == 0)
return kFALSE;
1795 for (
Ssiz_t i = 0; i < len; ++i)
1796 if (!isalnum(cp[i]))
1809 const char *cp =
Data();
1811 if (len == 0)
return kFALSE;
1813 for (
Ssiz_t i = 0; i < len; ++i) {
1814 if (cp[i] !=
' ' && !isdigit(cp[i]))
return kFALSE;
1815 if (cp[i] ==
' ') b++;
1816 if (isdigit(cp[i])) d++;
1838 if (IsDigit())
return kTRUE;
1847 pos = tmp.
First(
',');
1849 pos = tmp.
Index(
"e-");
1850 if (pos >= 1) tmp.
Replace(pos, 2,
" ", 1);
1851 pos = tmp.
Index(
"e+");
1852 if (pos >= 1) tmp.
Replace(pos, 2,
" ", 1);
1853 pos = tmp.
Index(
"e");
1854 if (pos >= 1) tmp.
Replace(pos, 1,
" ", 1);
1855 pos = tmp.
First(
'-');
1856 if (pos == 0) tmp.
Replace(pos, 1,
" ", 1);
1857 pos = tmp.
First(
'+');
1858 if (pos == 0) tmp.
Replace(pos, 1,
" ", 1);
1871 const char *cp =
Data();
1873 if (len == 0)
return kFALSE;
1874 for (
Ssiz_t i = 0; i < len; ++i)
1875 if (!isxdigit(cp[i]))
1887 const char *cp =
Data();
1889 if (len == 0)
return kFALSE;
1890 for (
Ssiz_t i = 0; i < len; ++i)
1891 if (cp[i] !=
'0' && cp[i] !=
'1')
1903 const char *cp =
Data();
1905 if (len == 0)
return kFALSE;
1906 for (
Ssiz_t i = 0; i < len; ++i)
1907 if (!isdigit(cp[i]) || cp[i]==
'8' || cp[i]==
'9')
1919 const char *cp =
Data();
1921 if (len == 0)
return kFALSE;
1922 for (
Ssiz_t i = 0; i < len; ++i)
1923 if (!isdigit(cp[i]))
1936 if (base < 2 || base > 36) {
1937 Error(
"TString::IsInBaseN",
"base %d is not supported. Supported bases are {2,3,...,36}.", base);
1941 Error(
"TString::IsInBaseN",
"input string is empty.") ;
1946 TString str_ref0 =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
1970 if (end == -1)
return atoi(
Data());
1976 tmp += (*this)(start, end-start);
1977 start = end+1; end =
Index(
" ", start);
1981 tmp += (*this)(start, end-start);
1982 return atoi(tmp.
Data());
1997 if (end == -1)
return atoll(
Data());
1999 if (end == -1)
return _atoi64(
Data());
2006 tmp += (*this)(start, end-start);
2007 start = end+1; end =
Index(
" ", start);
2011 tmp += (*this)(start, end-start);
2013 return atoll(tmp.
Data());
2015 return _atoi64(tmp.
Data());
2037 if (comma == -1 && end == -1)
return atof(
Data());
2044 if (end == -1)
return atof(tmp.
Data());
2049 tmp2 += tmp(start, end-start);
2050 start = end+1; end = tmp.
Index(
" ", start);
2053 tmp2 += tmp(start, end-start);
2054 return atof(tmp2.
Data());
2073 if (base < 2 || base > 36) {
2074 Error(
"TString::Itoa",
"base %d is not supported. Supported bases are {2,3,...,36}.",base) ;
2078 Int_t quotient = value;
2081 buf +=
"0123456789abcdefghijklmnopqrstuvwxyz"[
TMath::Abs(quotient % base) ];
2085 if (value < 0) buf +=
'-';
2086 std::reverse(buf.begin(), buf.end());
2100 if (base < 2 || base > 36) {
2101 Error(
"TString::UItoa",
"base %d is not supported. Supported bases are {2,3,...,36}.",base);
2108 buf +=
"0123456789abcdefghijklmnopqrstuvwxyz"[ quotient % base ];
2111 std::reverse(buf.begin(), buf.end());
2125 if (base < 2 || base > 36) {
2126 Error(
"TString::LLtoa",
"base %d is not supported. Supported bases are {2,3,...,36}.",base);
2133 buf +=
"0123456789abcdefghijklmnopqrstuvwxyz"[
TMath::Abs(quotient % base) ];
2137 if (value < 0) buf +=
'-';
2138 std::reverse(buf.begin(), buf.end());
2152 if (base < 2 || base > 36) {
2153 Error(
"TString::ULLtoa",
"base %d is not supported. Supported bases are {2,3,...,36}.",base);
2160 buf +=
"0123456789abcdefghijklmnopqrstuvwxyz"[ quotient % base ];
2163 std::reverse(buf.begin(), buf.end());
2175 if (base_in < 2 || base_in > 36 || base_out < 2 || base_out > 36) {
2176 Error(
"TString::BaseConvert",
"only bases 2-36 are supported (base_in=%d, base_out=%d).", base_in, base_out);
2182 if (s_in_[0] ==
'-') {
2186 if (!isSigned && s_in_[0] ==
'+') s_in_.
Remove(0, 1);
2189 if (!s_in_.
Length()) s_in_ +=
'0';
2192 Error(
"TString::BaseConvert",
"s_in=\"%s\" is not in base %d", s_in.
Data(), base_in);
2199 Error(
"TString::BaseConvert",
"s_in=\"%s\" > %s = 2^64-1 in base %d.", s_in.
Data(), s_max.
Data(), base_in);
2204 if (s_in_ > s_max) {
2206 Error(
"TString::BaseConvert",
"s_in=\"%s\" > %s = 2^64-1 in base %d.", s_in.
Data(), s_max.
Data(), base_in);
2214 if (isSigned) s_out.
Prepend(
"-");
2223 if (!s)
return kTRUE;
2230 return strcmp(s, s2) == 0;
2231 return strcasecmp(s, s2) == 0;
2243 std::list<Int_t> splitIndex;
2245 Int_t i, start, nrDiff = 0;
2246 for (i = 0; i < delim.
Length(); i++) {
2248 while (start <
Length()) {
2250 if (pos ==
kNPOS)
break;
2251 splitIndex.push_back(pos);
2254 if (start > 0) nrDiff++;
2256 splitIndex.push_back(
Length());
2265 std::list<Int_t>::const_iterator it;
2267 for (it = splitIndex.begin(); it != splitIndex.end(); it++) {
2269 for (it = splitIndex.begin(); it != (std::list<Int_t>::const_iterator) splitIndex.end(); it++) {
2272 if (stop - 1 >= start + 1) {
2273 TString tok = (*this)(start+1, stop-start-1);
2289 Ssiz_t buflen = 20 + 20 * strlen(fmt);
2297 n = vsnprintf(GetPointer(), buflen, fmt, ap);
2300 if (n == -1 || n >= buflen) {
2315 SetSize(strlen(
Data()));
2325 va_start(ap,
va_(fmt));
2326 FormImp(
va_(fmt), ap);
2338 va_start(ap,
va_(fmt));
2353 static const int fld_size = 2048;
2354 TTHREAD_TLS(
char*) slowBuffer(0);
2355 TTHREAD_TLS(
int) slowBufferSize(0);
2357 if (hint == -1) hint = fld_size;
2358 if (hint > slowBufferSize) {
2359 delete [] slowBuffer;
2360 slowBufferSize = 2 * hint;
2361 if (hint < 0 || slowBufferSize < 0) {
2366 slowBuffer =
new char[slowBufferSize];
2372 int n = vsnprintf(slowBuffer, slowBufferSize, format, ap);
2375 if (n == -1 || n >= slowBufferSize) {
2376 if (n == -1) n = 2 * slowBufferSize;
2377 if (n == slowBufferSize) n++;
2401 static const int cb_size = 4096;
2402 static const int fld_size = 2048;
2405 TTHREAD_TLS_ARRAY(
char,cb_size,gFormbuf);
2406 TTHREAD_TLS(
char*) gBfree(0);
2407 TTHREAD_TLS(
char*) gEndbuf(0);
2411 gEndbuf = &gFormbuf[cb_size-1];
2415 if (buf+fld_size > gEndbuf)
2421 int n = vsnprintf(buf, fld_size, format, ap);
2424 if (n == -1 || n >= fld_size) {
2449 va_start(ap,
va_(fmt));
2463 va_start(ap,
va_(fmt));
2483 char *buf =
new char[l+1];
2496 const char *t2 = s + l - 1;
2497 while (*t2 == c && t2 > s)
2504 strncpy(buf, t1, (
Ssiz_t) (t2-t1+1));
2505 *(buf+(t2-t1+1)) =
'\0';
2518 char *s =
new char[strlen(str)+1];
2519 if (s) strcpy(s, str);
2532 const char *p = str;
2533 char *s, *s1 =
new char[strlen(str)+1];
2549 int EscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
2553 char *
q, *end = dst+dstlen-1;
2555 for (p = src, q = dst; *p && q < end; ) {
2556 if (strchr(specchars, *p)) {
2573 int UnEscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
char)
2576 char *
q, *end = dst+dstlen-1;
2578 for (p = src, q = dst; *p && q < end; ) {
2579 if (strchr(specchars, *p))
2591 #ifdef NEED_STRCASECMP 2595 int strcasecmp(
const char *str1,
const char *str2)
2597 return strncasecmp(str1, str2, str2 ? strlen(str2)+1 : 0);
2603 int strncasecmp(
const char *str1,
const char *str2,
Ssiz_t n)
2646 std::string str(*val);
A zero length substring is legal.
static Ssiz_t GetMaxWaste()
virtual const char * GetName() const
Returns name of object.
void SetBufferOffset(Int_t offset=0)
void frombuf(char *&buf, Bool_t *x)
void ToLower()
Convert sub-string to lower-case.
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.
basic_string_view< char > string_view
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 ...
void ToUpper()
Convert sub-string to upper-case.
Collectable string class.
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY size_type length() const _NOEXCEPT
char * Form(const char *va_(fmt),...)
Formats a string in a circular formatting buffer.
friend Bool_t operator==(const TSubString &s1, const TSubString &s2)
Compare two sub-strings.
TString & ReplaceAll(const TString &s1, const TString &s2)
char * StrDup(const char *str)
Duplicate the string str.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Bool_t IsFloat() const
Returns kTRUE if string contains a floating point or integer number.
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
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Bool_t operator==(const TString &s1, const char *s2)
Compare TString with a char *.
const char * AsString() const
Return message digest as string.
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.
TString Copy() const
Copy a string.
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.
const char * Data() const
static void WriteString(TBuffer &b, const TString *a)
Write TString object to buffer.
void Obsolete(const char *function, const char *asOfVers, const char *removedFromVers)
Use this function to declare a function obsolete.
Bool_t MaybeWildcard() const
Returns true if string contains one of the wildcard characters "[]*?".
char * Init(Ssiz_t capacity, Ssiz_t nchar)
Private member function returning an empty string representation of size capacity and containing ncha...
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
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)
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.
This code implements the MD5 message-digest algorithm.
UInt_t HashFoldCase() const
Return a case-insensitive hash value (endian independent).
Bool_t IsAlnum() const
Returns true if all characters in string are alphanumeric.
void Init(TClassEdit::TInterpreterLookupHelper *helper)
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)
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
std::vector< std::vector< double > > Data
static Ssiz_t GetInitialCapacity()
char * Strip(const char *s, char c)
Strip leading and trailing c (blanks by default) from a string.
void AssertElement(Ssiz_t nc) const
Check to make sure a string index is in range.
Ssiz_t First(char c) const
Find first occurrence of a character c.
void tobuf(char *&buf, Bool_t x)
Long64_t Atoll() const
Return long long value of string.
void Error(const char *location, const char *msgfmt,...)
Bool_t IsAlpha() const
Returns true if all characters in string are alphabetic.
char & operator()(Ssiz_t i)
static UInt_t SwapInt(UInt_t x)
Bool_t IsOct() const
Returns true if all characters in string are octal digits (0-7).
std::string printValue(const TDatime *val)
Print a TDatime at the prompt.
char & operator[](Ssiz_t i)
Return character at pos i from sub-string. Check validity of i.
R__EXTERN Bool_t gPrintViaErrorHandler
#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.
char & operator()(Ssiz_t i)
Return character at pos i from sub-string. No check on i.
UInt_t HashCase() const
Return a case-sensitive hash value (endian independent).
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
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.
TString MD5() const
Return the MD5 digest for this string, in a string representation.
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
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.
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.
void Clobber(Ssiz_t nc)
Clear string and make sure it has a capacity of nc.
TString & Remove(Ssiz_t pos)
RooCmdArg Index(RooCategory &icat)
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.
Bool_t IsDec() const
Returns true if all characters in string are decimal digits (0-9).
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
int EscChar(const char *src, char *dst, int dstlen, char *specchars, char escchar)
Escape specchars in src with escchar and copy to dst.
static char * SlowFormat(const char *format, va_list ap, int hint)
Format a string in a formatting buffer (using a printf style format descriptor).
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Ssiz_t GetLongSize() const
unsigned long long ULong64_t
virtual Int_t Sizeof() const
Returns size string will occupy on I/O buffer.
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 Contains(const char *pat, ECaseCompare cmp=kExact) const
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 CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
virtual void ReadTString(TString &s)=0
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_pointer data() const _NOEXCEPT
Bool_t IsAscii() const
Returns true if all characters in string are ascii.
void SubStringError(Ssiz_t, Ssiz_t, Ssiz_t) const
Output error message.
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 IsHex() const
Returns true if all characters in string are hexadecimal digits (0-9,a-f,A-F).
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
uint64_t rotl64(uint64_t x, int8_t r)
Bool_t IsBin() const
Returns true if all characters in string are binary digits (0,1).
virtual TClass * ReadClass(const TClass *cl=0, UInt_t *objTag=0)=0
Int_t CountChar(Int_t c) const
Return number of times character c occurs in the string.
Int_t Atoi() const
Return integer value of string.
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.
Double_t Atof() const
Return floating-point value contained in string.
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
static void Mash(UInt_t &hash, UInt_t chars)
Utility used by Hash().
virtual void FillBuffer(char *&buffer) const
Copy string into I/O buffer.
UInt_t Hash(const char *str)
Return a case-sensitive hash value (endian independent).
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...
void AssertElement(Ssiz_t i) const
Check to make sure a sub-string index is in range.
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.
Bool_t MaybeRegexp() const
Returns true if string contains one of the regexp characters "^$.[]*+?".
void InitChar(char c)
Initialize a string with a single character.
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
virtual ~TString()
Delete a TString.
static char * Format(const char *format, va_list ap)
Format a string in a circular formatting buffer (using a printf style format descriptor).
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
const char * Data() const