15 static const int a,
m,
q,
r;
20 TRnd(
const int& _Seed=1,
const int& Steps=0){
39 const double& Mean,
const double& SDev,
const double& Mn,
const double& Mx);
46 return 1+(int)floor(log(1.0-
GetUniDev())/log(1.0-Prb));}
49 return pow(1.0-
GetUniDev(), -1.0/(AlphaSlope-1.0));}
52 return Sigma*sqrt(-2*log(1-
GetUniDev()));}
53 double GetWeibull(
const double& K,
const double& Lambda) {
55 return Lambda*pow(-log(1-
GetUniDev()), 1.0/K);}
61 void Move(
const int& Steps);
81 void Resize(const
int& _MxBfL);
82 bool DoFitLen(const
int& LBfL)
const {
return BfL+LBfL<=MxBfL;}
85 MxBfL(_MxBfL), BfL(0), Bf(NULL){
IAssert(BfL>=0);
86 if (MxBfL>0){Bf=
new char[MxBfL];
IAssert(Bf!=NULL);}}
88 TMem(
const void* _Bf,
const int& _BfL):
89 MxBfL(_BfL), BfL(_BfL), Bf(NULL){
IAssert(BfL>=0);
90 if (BfL>0){Bf=
new char[BfL];
IAssert(Bf!=NULL); memcpy(Bf, _Bf, BfL);}}
91 static PMem New(
const void* Bf,
const int& BfL){
return new TMem(Bf, BfL);}
93 MxBfL(Mem.MxBfL), BfL(Mem.BfL), Bf(NULL){
94 if (MxBfL>0){Bf=
new char[MxBfL]; memcpy(Bf, Mem.
Bf, BfL);}}
99 ~TMem(){
if (Bf!=NULL){
delete[] Bf;}}
102 Bf=
new char[MxBfL=BfL]; SIn.
LoadBf(Bf, BfL);}
105 void LoadXml(
const PXmlTok& XmlTok,
const TStr& Nm);
106 void SaveXml(
TSOut& SOut,
const TStr& Nm)
const;
110 if (Bf!=NULL){
delete[] Bf;}
111 MxBfL=Mem.
MxBfL; BfL=Mem.
BfL; Bf=NULL;
112 if (MxBfL>0){Bf=
new char[MxBfL]; memcpy(Bf, Mem.
Bf, BfL);}}
115 TMem& operator+=(
const char& Ch);
120 Assert((0<=ChN)&&(ChN<BfL));
return Bf[ChN];}
121 int GetMemUsed()
const {
return int(2*
sizeof(
int)+
sizeof(
char*)+MxBfL);}
123 void Gen(
const int& _BfL){
124 Clr(); Resize(_BfL); BfL=_BfL;}
126 Clr(
false); Resize(_BfL); BfL=_BfL;
127 if (BfL > 0) memset(Bf, 0, BfL);}
128 void Reserve(
const int& _MxBfL,
const bool& DoClr =
true){
129 if (DoClr){ Clr(); } Resize(_MxBfL);}
130 void Del(
const int& BChN,
const int& EChN);
131 void Clr(
const bool& DoDel=
true){
132 if (DoDel){
if (Bf!=NULL){
delete[] Bf;} MxBfL=0; BfL=0; Bf=NULL;}
134 int Len()
const {
return BfL;}
137 if ((0<=_BfL)&&(_BfL<=BfL)){BfL=_BfL;}}
138 void Push(
const char& Ch){operator+=(Ch);}
141 bool DoFitStr(
const TStr& Str)
const;
143 void AddBf(
const void* Bf,
const int& BfL);
145 TStr GetAsStr(
const char& NewNullCh=
'\0')
const;
175 int GetBf(
const void* LBf,
const TSize& LBfL);
194 Mem->operator+=(Ch);
return Ch;}
195 int PutBf(
const void* LBf,
const TSize& LBfL);
205 void Resize(
const int& _MxBfL);
207 explicit TChA(
const int& _MxBfL=256){
210 Bf=
new char[(
MxBfL=
BfL=int(strlen(CStr)))+1]; strcpy(
Bf, CStr);}
212 Bf=
new char[StrLen+1]; strncpy(
Bf, CStr, StrLen);
Bf[StrLen]=0;}
218 memcpy(
CStr(), Mem(), Mem.
Len());}
224 void Save(
TSOut& SOut,
const bool& SaveCompact=
true)
const {
261 void Ins(
const int& BChN,
const char*
CStr);
262 void Del(
const int& ChN);
268 if ((0<=_BfL)&&(_BfL<=
BfL)){
Bf[
BfL=_BfL]=0;}}
271 void AddCh(
const char& Ch,
const int& MxLen=-1){
273 void AddChTo(
const char& Ch,
const int& ToChN){
275 void AddBf(
char *NewBf,
const int& BfS){
278 void PutCh(
const int& ChN,
const char& Ch){
286 int CountCh(
const char& Ch,
const int& BChN=0)
const;
287 int SearchCh(
const char& Ch,
const int& BChN=0)
const;
293 bool IsPrefix(
const char*
CStr,
const int& BChN=0)
const;
301 void ChangeCh(
const char& SrcCh,
const char& DstCh);
306 void Swap(
const int& ChN1,
const int& ChN2);
339 int GetBf(
const void* LBf,
const TSize& LBfL);
355 Refs=0;
Bf=
new char[strlen(CStr)+1]; strcpy(
Bf, CStr);}
357 Refs=0;
Bf=
new char[MxLen+1]; strncpy(
Bf, CStr, MxLen);
Bf[MxLen]=0;}
358 TRStr(
const char* CStr1,
const char* CStr2){
359 Refs=0;
int CStr1Len=int(strlen(CStr1));
Bf=
new char[CStr1Len+int(strlen(CStr2))+1];
360 strcpy(
Bf, CStr1); strcpy(
Bf+CStr1Len, CStr2);}
363 TRStr(
const char& Ch1,
const char& Ch2){
364 Refs=0;
Bf=
new char[2+1];
Bf[0]=Ch1;
Bf[1]=Ch2;
Bf[2]=0;}
372 if (IsSmall){SOut.
Save(
Bf);}
373 else {
int BfL=int(strlen(
Bf)); SOut.
Save(BfL); SOut.
Save(
Bf, BfL);}}
384 int Len()
const {
return int(strlen(
Bf));}
386 void PutCh(
const int& ChN,
const char& Ch){
397 static int CmpI(
const char* CStr1,
const char* CStr2);
403 static TRStr NullRStr;
Assert(NullRStr.
Bf!=NULL);
return &NullRStr;}
409 template <
class TVal,
class TSizeTy>
class TVec;
418 TStr(
const char& Ch1,
const char& Ch2,
bool){
436 explicit TStr(
TSIn& SIn,
const bool& IsSmall=
false):
439 *
this=
TStr(SIn, IsSmall);}
440 void Save(
TSOut& SOut,
const bool& IsSmall=
false)
const {
479 void PutCh(
const int& ChN,
const char& Ch){
518 void InsStr(
const int& BChN,
const TStr& Str);
520 void DelSubStr(
const int& BChN,
const int& EChN);
529 const char& SplitCh,
TStrV& StrV,
const bool& SkipEmpty=
true)
const;
531 const TStr& SplitChStr,
TStrV& StrV,
const bool& SkipEmpty=
true)
const;
546 TStr Slice(
int BChN,
int EChNP1)
const {
if(BChN<0){BChN=
Len()+BChN;}
if(EChNP1<=0){EChNP1=
Len()+EChNP1;}
return GetSubStr(BChN, EChNP1-1); }
549 int CountCh(
const char& Ch,
const int& BChN=0)
const;
550 int SearchCh(
const char& Ch,
const int& BChN=0)
const;
555 bool IsPrefix(
const char *Str)
const;
558 bool IsSuffix(
const char *Str)
const;
562 int ChangeCh(
const char& SrcCh,
const char& DstCh,
const int& BChN=0);
563 int ChangeChAll(
const char& SrcCh,
const char& DstCh);
572 bool IsBool(
bool& Val)
const;
575 const bool& Check,
const int& MnVal,
const int& MxVal,
int& Val)
const;
577 bool IsInt()
const {
int Val;
return IsInt(
false, 0, 0, Val);}
580 int Val;
if (
IsInt(
false, 0, 0, Val)){
return Val;}
else {
return DfVal;}}
583 const bool& Check,
const uint& MnVal,
const uint& MxVal,
uint& Val)
const;
588 uint Val;
if (
IsUInt(
false, 0, 0, Val)){
return Val;}
else {
return DfVal;}}
591 const bool& Check,
const int64& MnVal,
const int64& MxVal,
int64& Val)
const;
597 int64 Val;
if (
IsInt64(
false, 0, 0, Val)){
return Val;}
else {
return DfVal;}}
606 uint64 Val;
if (
IsUInt64(
false, 0, 0, Val)){
return Val;}
else {
return DfVal;}}
608 bool IsHexInt(
const bool& Check,
const int& MnVal,
const int& MxVal,
int& Val)
const;
614 int Val;
if (
IsHexInt(
false, 0, 0, Val)){
return Val;}
else {
return DfVal;}}
622 int64 Val;
if (
IsHexInt64(
false, 0, 0, Val)){
return Val;}
else {
return DfVal;}}
624 bool IsFlt(
const bool& Check,
const double& MnVal,
const double& MxVal,
625 double& Val,
const char& DecDelimCh=
'.')
const;
626 bool IsFlt(
double& Val)
const {
return IsFlt(
false, 0, 0, Val);}
627 bool IsFlt()
const {
double Val;
return IsFlt(
false, 0, 0, Val);}
629 double Val;
IAssert(
IsFlt(
false, 0, 0, Val));
return Val;}
630 double GetFlt(
const double& DfVal)
const {
631 double Val;
if (
IsFlt(
false, 0, 0, Val)){
return Val;}
else {
return DfVal;}}
633 bool IsWord(
const bool& WsPrefixP=
true,
const bool& FirstUcAllowedP=
true)
const;
637 const int& StrBChN,
const TStr& WcStr,
const int& WcStrBChN,
TStrV& StarStrV,
638 const char& StarCh=
'*',
const char& QuestCh=
'?')
const;
641 const char& StarCh=
'*',
const char& QuestCh=
'?')
const;
642 bool IsWcMatch(
const TStr& WcStr,
const char& StarCh,
const char& QuestCh)
const;
683 static TStr Fmt(
const char *FmtStr, ...);
686 char* Bf=
new char[
Len()+1]; strcpy(Bf,
CStr());
return Bf;}
715 int GetBf(
const void* LBf,
const TSize& LBfL);
783 void Resize(const
uint& _MxBfL);
788 Bf = (
char *) malloc(Pool.MxBfL);
IAssertR(Bf,
TStr::Fmt(
"Can not resize buffer to %u bytes. [Program failed to allocate more memory. Solution: Get a bigger machine.]", MxBfL).CStr()); memcpy(Bf, Pool.Bf, Pool.BfL); }
789 ~TStrPool() {
if (Bf) free(Bf);
else IAssertR(MxBfL == 0,
TStr::Fmt(
"size: %u, expected size: 0", MxBfL).CStr()); Bf = 0; MxBfL = 0; BfL = 0; }
795 void Save(
TSOut& SOut)
const;
800 bool Empty()
const {
return ! Len(); }
801 char* operator () ()
const {
return Bf; }
805 uint AddStr(
const char *Str,
const uint& Len);
816 void Clr(
bool DoDel =
false) { BfL = 0;
if (DoDel && Bf) { free(Bf); Bf = 0; MxBfL = 0; } }
818 if (Offset != 0)
return strcmp(Bf + Offset, Str);
else return strcmp(
"", Str); }
820 static int GetPrimHashCd(
const char *CStr);
821 static int GetSecHashCd(
const char *CStr);
823 if (Offset != 0)
return GetPrimHashCd(Bf + Offset);
else return GetPrimHashCd(
""); }
825 if (Offset != 0)
return GetSecHashCd(Bf + Offset);
else return GetSecHashCd(
""); }
836 void Resize(const ::
TSize& _MxBfL);
842 void Save(
TSOut& SOut)
const;
853 bool Empty()
const {
return (BfL == 0); }
856 void Clr(
bool DoDel =
false);
858 if (Offset != 0)
return strcmp(Bf + Offset, Str);
else return strcmp(
"", Str); }
866 template <
class Base>
class TNum{
871 operator Base()
const {
return Val; }
925 if (Val>100 * 1000){
return GetStr(Val / 1000) +
"K"; }
926 else if (Val>1000){
return GetStr(Val / 1000) +
"." + GetStr((Val % 1000) / 100) +
"K"; }
927 else {
return GetStr(Val); }
930 if (Val>100 * 1000000){
return GetStr(Val / 1000000) +
"M"; }
931 else if (Val>1000000){
932 return GetStr(Val / 1000000) +
"." + GetStr((Val % 1000000) / 100000) +
"M";
934 else {
return GetKiloStr(Val); }
945 memcpy(&Val, Bf,
sizeof(
int64));
948 return *((
int64*)Bf);
975 static const bool Mn;
976 static const bool Mx;
989 operator bool()
const {
return Val;}
999 return (
Val==
false)&&(Bool.
Val==
true);}
1013 if (Val){
return YStr;}
else {
return NStr;}}
1017 if (Val){
return "1";}
else {
return "0";}}
1042 operator char()
const {
return Val;}
1063 return ((
'A'<=Ch)&&(Ch<=
'Z'))||((
'a'<=Ch)&&(Ch<=
'z'));}
1064 static bool IsNum(
const char& Ch){
return (
'0'<=Ch)&&(Ch<=
'9');}
1067 static bool IsHex(
const char& Ch){
return
1068 ((
'0'<=Ch)&&(Ch<=
'9'))||((
'A'<=Ch)&&(Ch<=
'F'))||((
'a'<=Ch)&&(Ch<=
'f'));}
1070 if ((
'0'<=Ch)&&(Ch<=
'9')){
return Ch-
'0';}
1071 else if ((
'A'<=Ch)&&(Ch<=
'F')){
return Ch-
'A'+10;}
1072 else if ((
'a'<=Ch)&&(Ch<=
'f')){
return Ch-
'a'+10;}
1073 else Fail;
return 0;}
1075 if ((0<=Val)&&(Val<=9)){
return char(
'0'+
char(Val));}
1076 else if ((10<=Val)&&(Val<=15)){
return char(
'A'+
char(Val-10));}
1077 else Fail;
return 0;}
1079 return (
'A'<=Ch)&&(Ch<=
'Z');}
1081 if ((
'a'<=Ch)&&(Ch<=
'z')){
return Ch-
'a'+
'A';}
else {
return Ch;}}
1147 operator int()
const {
return Val;}
1171 static int Abs(
const int& Int){
return Int<0?-Int:Int;}
1172 static int Sign(
const int& Int){
return Int<0?-1:(Int>0?1:0);}
1173 static void Swap(
int& Int1,
int& Int2){
1174 int SwapInt1=Int1; Int1=Int2; Int2=SwapInt1;}
1177 static bool IsOdd(
const int& Int){
return ((Int%2)==1);}
1178 static bool IsEven(
const int& Int){
return ((Int%2)==0);}
1180 static int GetMn(
const int& Int1,
const int& Int2){
1181 return Int1<Int2?Int1:Int2;}
1182 static int GetMx(
const int& Int1,
const int& Int2){
1183 return Int1>Int2?Int1:Int2;}
1184 static int GetMn(
const int& Int1,
const int& Int2,
const int& Int3){
1186 static int GetMn(
const int& Int1,
const int& Int2,
1187 const int& Int3,
const int& Int4){
1189 static int GetMx(
const int& Int1,
const int& Int2,
const int& Int3){
1191 static int GetMx(
const int& Int1,
const int& Int2,
1192 const int& Int3,
const int& Int4){
1195 IAssert(Mn<=Mx);
return Val<Mn?Mn:(Val>Mx?Mx:
Val);}
1215 char Bf[255]; sprintf(Bf,
"%X", Val);
return TStr(Bf);}
1220 if (Val>=100*1000){
return GetStr(Val/1000)+
"K";}
1221 else if (Val>=1000){
return GetStr(Val/1000)+
"."+
GetStr((Val%1000)/100)+
"K";}
1222 else {
return GetStr(Val);}}
1224 if (Val>=100*1000000){
return GetStr(Val/1000000)+
"M";}
1225 else if (Val>=1000000){
1226 return GetStr(Val/1000000)+
"."+
GetStr((Val%1000000)/100000)+
"M";}
1281 char Bf[255]; sprintf(Bf,
"%u", Val);
return TStr(Bf);}
1289 if (Val>100*1000){
return GetStr(Val/1000)+
"K";}
1290 else if (Val>1000){
return GetStr(Val/1000)+
"."+
GetStr((Val%1000)/100)+
"K";}
1291 else {
return GetStr(Val);}}
1293 if (Val>100*1000000){
return GetStr(Val/1000000)+
"M";}
1294 else if (Val>1000000){
1295 return GetStr(Val/1000000)+
"."+
GetStr((Val%1000000)/100000)+
"M";}
1299 uint B1=(JavaUInt & 0xFF000000) >> 24;
1300 uint B2=(JavaUInt & 0x00FF0000) >> 16;
1301 uint B3=(JavaUInt & 0x0000FF00) >> 8;
1302 uint B4=(JavaUInt & 0x000000FF) >> 0;
1303 uint CppUInt=(B4<<24)+(B3<<16)+(B2<<8)+(B1<<0);
1306 static bool IsIpStr(
const TStr& IpStr,
uint& Ip,
const char& SplitCh =
'.');
1310 static bool IsIpv6Str(
const TStr& IpStr,
const char& SplitCh =
':');
1350 return (
uint)(
Val & 0xffffffff);}
1366 if (Val>100*1000){
return GetStr(Val/1000)+
"K";}
1367 else if (Val>1000){
return GetStr(Val/1000)+
"."+
GetStr((Val%1000)/100)+
"K";}
1368 else {
return GetStr(Val);}}
1370 if (Val>100*1000000){
return GetStr(Val/1000000)+
"M";}
1371 else if (Val>1000000){
1372 return GetStr(Val/1000000)+
"."+
GetStr((Val%1000000)/100000)+
"M";}
1397 operator double()
const {
return Val;}
1423 int Expn;
return int((frexp(
Val, &Expn)-0.5)*
double(
TInt::Mx));}
1425 int Expn; frexp(
Val, &Expn);
return Expn;}
1427 static double Abs(
const double& Flt){
return Flt<0?-Flt:Flt;}
1428 static int Sign(
const double& Flt){
return Flt<0?-1:(Flt>0?1:0);}
1429 static int Round(
const double& Flt){
return int(floor(Flt+0.5));}
1431 static bool Eq6(
const double& LFlt,
const double& RFlt){
1432 return fabs(LFlt-RFlt)<0.000001;}
1434 static double GetMn(
const double& Flt1,
const double& Flt2){
1435 return Flt1<Flt2?Flt1:Flt2;}
1436 static double GetMn(
const double& Flt1,
const double& Flt2,
const double& Flt3){
1438 static double GetMn(
const double& Flt1,
const double& Flt2,
const double& Flt3,
const double& Flt4){
1441 static double GetMx(
const double& Flt1,
const double& Flt2){
1442 return Flt1>Flt2?Flt1:Flt2;}
1443 static double GetMx(
const double& Flt1,
const double& Flt2,
const double Flt3){
1445 static double GetMx(
const double& Flt1,
const double& Flt2,
const double Flt3,
const double& Flt4){
1449 IAssert(Mn<=Mx);
return Val<Mn?Mn:(Val>Mx?Mx:
Val);}
1452 return (
Mn<=Val)&&(Val<=
Mx);}
1460 static TStr GetStr(
const double&
Val,
const int& Width=-1,
const int& Prec=-1);
1467 return GetStr(100*RelVal/FullVal,
"%3.0f%%");}
1470 if (fabs(Val)>100*1000){
return TStr::Fmt(
"%.0fK", Val/1000);}
1471 else if (fabs(Val)>1000){
return TStr::Fmt(
"%.1fK", Val/1000);}
1474 if (fabs(Val)>100*1000000){
return TStr::Fmt(
"%.0fM", Val/1000000);}
1475 else if (fabs(Val)>1000000){
return TStr::Fmt(
"%.1fM", Val/1000000);}
1478 if (fabs(Val)>100*1000000000.0){
return TStr::Fmt(
"%.0fG", Val/1000000000.0);}
1479 else if (fabs(Val)>1000000000.0){
return TStr::Fmt(
"%.1fG", Val/1000000000.0);}
1527 int Expn;
return int((frexp(
Val, &Expn)-0.5)*
double(
TInt::Mx));}
1529 int Expn; frexp(
Val, &Expn);
return Expn;}
1581 const double& _MnX,
const double& _MnY,
1582 const double& _MxX,
const double& _MxY):
1610 bool IsXYIn(
const double& X,
const double& Y)
const {
TSFlt & operator/=(const double &SFlt)
TChAIn & operator=(const TChAIn &)
int GetPrimHashCd() const
static int CmpI(const char *CStr1, const char *CStr2)
bool operator==(const double &Flt) const _CMPWARN
static bool IsHex(const char &Ch)
bool operator==(const TDbStr &DbStr) const
void Load(TSIn &SIn, const bool &IsSmall=false)
static TStr PutFExtIfEmpty(const TStr &FNm, const TStr &FExt)
TStr(const char &Ch, bool)
TFlt & operator*=(const double &Flt)
void Save(TSOut &SOut) const
int SearchCh(const char &Ch, const int &BChN=0) const
static TStr GetHexStr(const int &Val)
int GetBf(const void *LBf, const TSize &LBfL)
ldouble operator()() const
TMemOut(const PMem &_Mem)
static TStr GetPrcStr(const double &RelVal, const double &FullVal)
TStr GetSubStr(const int &BChN) const
TLFlt & operator=(const TLFlt &LFlt)
void Gen(const int &_BfL)
static double GetMx(const double &Flt1, const double &Flt2, const double Flt3, const double &Flt4)
static PMem New(const PMem &Mem)
#define IAssertR(Cond, Reason)
static TStr GetSpaceStr(const int &Spaces)
void SaveXml(TSOut &SOut, const TStr &Nm) const
TLFlt(const ldouble &_Val)
static PSOut New(const TStr &FNm, const bool &Append=false)
static uint JavaUIntToCppUInt(const uint &JavaUInt)
const char * CStr() const
#define ClassHdTP(TNm, PNm)
bool operator==(const char *_CStr) const
void Resize(const int &_MxBfL)
static TStr GetHexStr(const TUInt64 &Int)
void Save(TSOut &SOut) const
int GetPrimHashCd() const
TStr Right(const int &BChN) const
TNum & operator=(const TNum &Int)
bool operator!=(const char *_CStr) const
static TStr GetMegaStr(const int &Val)
void Save(TSOut &SOut) const
void SaveMem(const PSOut &SOut) const
static void LoadTxt(const PSIn &SIn, TChA &ChA)
bool IsHexInt64(int64 &Val) const
int64 GetUniDevInt64(const int64 &Range=0)
void Ins(const int &BChN, const char *CStr)
static TStr GetStr(const uint64 &Val)
static int GetInRng(const int &Val, const int &Mn, const int &Mx)
static TStr GetKiloStr(const uint64 &Val)
static bool IsNum(const char &Ch)
bool IsPrefix(const char *Str) const
static PSIn New(const TChA &ChA)
TStr & operator+=(const char *CStr)
static PStrPool Load(TSIn &SIn, bool LoadCompacted=true)
static TStr GetStr(const int &Val, const TStr &FmtStr)
TSFlt & operator-=(const double &SFlt)
TStr(const char &Ch1, const char &Ch2, bool)
void SaveXml(TSOut &SOut, const TStr &Nm) const
static TStr GetStrFromIpUInt(const uint &Ip)
static int GetMn(const int &Int1, const int &Int2, const int &Int3, const int &Int4)
TFltRect & operator=(const TFltRect &FltRect)
static PSIn New(const TMem &Mem)
int GetPrimHashCd() const
int SearchChBack(const char &Ch, int BChN=-1) const
static TRnd LoadTxt(TILx &Lx)
TFlt & operator/=(const double &Flt)
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
void Save(TSOut &SOut) const
bool IsFlt(double &Val) const
static double GetMx(const double &Flt1, const double &Flt2)
bool operator!=(const char *CStr) const
TDbStr(const TStr &_Str1, const TStr &_Str2)
bool IsXYIn(const double &X, const double &Y) const
TMem & operator=(const TMem &Mem)
PSIn GetSIn(const bool &IsCut=true, const int &CutBfL=-1)
static TStr GetStr(const double &Val, const TStr &FmtStr)
static TStr GetStr(const TUInt64 &Int)
static int GetMx(const int &Int1, const int &Int2)
TUInt64(const TUInt64 &Int)
bool operator==(const TChA &ChA) const
bool operator!=(const double &Flt) const _CMPWARN
bool EqI(const TStr &Str) const
bool operator!=(const ldouble &LFlt) const _CMPWARN
const char * GetCStr(const uint &Offset) const
TPt< TStrPool64 > PStrPool64
static bool IsHashCh(const char &Ch)
static char * SaveFrugalInt(char *pDest, int i)
TSFlt & operator*=(const double &SFlt)
void PutCh(const int &ChN, const char &Ch)
static char GetHexCh(const int &Val)
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
static PMem New(const TMem &Mem)
void Save(TSOut &SOut) const
void AddCh(const char &Ch, const int &MxLen=-1)
int GetUniDevInt(const int &MnVal, const int &MxVal)
TVoid & operator=(const TVoid &)
static const double EpsHalf
bool IsPrefix(const TStr &Str) const
int GetPrimHashCd() const
TFlt & operator=(const double &Flt)
static PStrPool New(const uint &_MxBfLen=0, const uint &_GrowBy=16 *1024 *1024)
bool IsChIn(const char &Ch) const
static bool IsNum(const double &Val)
static void SaveFrugalIntV(TSOut &SOut, const TVec< TInt, int > &IntV)
static TStr GetMegaStr(const double &Val)
TInt & operator-=(const int &Int)
int GetPrimHashCd() const
TRStr(const char *CStr, const int &MxLen)
static TStr GetYesNoStr(const bool &Val)
TUCh & operator=(const TUCh &UCh)
uint64 GetUniDevUInt64(const uint64 &Range=0)
void Save(TSOut &SOut) const
int CmpI(const TStr &Str) const
static PSOut New(const PMem &Mem)
void DelChAll(const char &Ch)
TChA & operator+=(const char &Ch)
void SaveXml(TSOut &SOut, const TStr &Nm) const
TUInt64(const uint64 &Int)
virtual int GetBf(const void *Bf, const TSize &BfL)=0
static int GetHex(const char &Ch)
double GetRayleigh(const double &Sigma)
static TStr GetNrFMid(const TStr &FMid)
TStr GetSubStr(const int &BChN, const int &EChN) const
bool DelStr(const TStr &Str)
int GetBf(const void *LBf, const TSize &LBfL)
TFlt & operator+=(const double &Flt)
TDbStr & operator=(const TDbStr &DbStr)
static TStr GetNrFNm(const TStr &FNm)
void Save(TSOut &SOut) const
TUInt & operator|=(const TUInt &UInt)
int Cmp(uint64 Offset, const char *Str) const
int SearchStr(const TChA &Str, const int &BChN=0) const
static bool IsIpv6Str(const TStr &IpStr, const char &SplitCh= ':')
sdouble operator()() const
static double GetMn(const double &Flt1, const double &Flt2, const double &Flt3)
bool operator==(const char &Ch) const
bool operator==(const TSFlt &SFlt) const _CMPWARN
TStr & operator=(const char &Ch)
bool operator==(const TInt &Int) const
int64 GetHexInt64() const
bool IsInt64(int64 &Val) const
static TStr GetKiloStr(const uint &Val)
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
static bool IsIpStr(const TStr &IpStr, uint &Ip, const char &SplitCh= '.')
const char * CStr() const
static TStr GetStr(const uint &Val, const TStr &FmtStr)
bool operator==(const TRnd &) const
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
bool operator!=(const int &Int) const
TLFlt & operator+=(const ldouble &LFlt)
TLFlt & operator-=(const ldouble &LFlt)
static TStr GetStr(const uint &Val)
int ChangeChAll(const char &SrcCh, const char &DstCh)
double GetXCenter() const
TDbStr(const TDbStr &DbStr)
void SaveXml(TSOut &SOut, const TStr &Nm) const
bool IsHexInt(int &Val) const
TBool & operator=(const TBool &Bool)
static PSIn New(const PMem &Mem)
static double GetMx(const double &Flt1, const double &Flt2, const double Flt3)
static bool GetValFromStr(const TStr &Str)
static double GetExpDevStep(const int &Seed, const int &Steps)
friend TStr operator+(const TStr &LStr, const TStr &RStr)
bool operator==(const TCh &Ch) const
bool IsStrIn(const TStr &Str) const
int PutCh(const char &Ch)
void SaveXml(TSOut &SOut, const TStr &Nm) const
void Save(TSOut &SOut) const
TInt & operator=(const TInt &Int)
int GetPrimHashCd() const
double GetGammaDev(const int &Order)
static TStr GetStr(const TUInt &UInt)
static TStr GetMegaStr(const uint &Val)
TStr GetWcMatch(const TStr &WcStr, const int &StarStrN=0) const
TFltRect(const TFltRect &FltRect)
void SplitOnCh(TStr &LStr, const char &SplitCh, TStr &RStr) const
void Save(TSOut &SOut, const bool &IsTxt) const
static const TStr FalseStr
int GetPrimHashCd() const
#define ClassTP(TNm, PNm)
void SaveXml(TSOut &SOut, const TStr &Nm) const
static int Sign(const int &Int)
TSFlt & operator+=(const double &SFlt)
static TStr GetMegaStr(const uint64 &Val)
bool IsUInt64(uint64 &Val) const
void Clr(bool DoDel=false)
void Save(TSOut &SOut) const
bool IsInt(int &Val) const
TAscFlt(const double &Val)
void Save(TSOut &SOut) const
static PSIn New(const TStr &FNm)
void Trunc(const int &_BfL)
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
static double GetMn(const double &Flt1, const double &Flt2, const double &Flt3, const double &Flt4)
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
TNum & operator=(const TNum &Other)
uint64 GetUInt64(const uint64 &DfVal) const
void Push(const char &Ch)
static TStr GetKiloStr(const double &Val)
TUInt & operator<<=(const int &ShiftBits)
int SearchChBack(const char &Ch, int BChN=-1) const
static bool IsWs(const char &Ch)
static TStr AddToFMid(const TStr &FNm, const TStr &ExtFMid)
double GetWeibull(const double &K, const double &Lambda)
int PutBf(const void *LBf, const TSize &LBfL)
int GetPrimHashCd() const
int ChangeStrAll(const TStr &SrcStr, const TStr &DstStr, const bool &FromStartP=false)
int GetPrimHashCd() const
int GetPrimHashCd() const
TStr GetStr(const TStr &MidStr=TStr()) const
static PStrPool LoadShM(TSIn &SIn)
int GetPrimHashCd() const
TStr GetUsFromYuAscii() const
static TStr & GetDChStr(const char &Ch1, const char &Ch2)
static int GetMn(const int &Int1, const int &Int2)
void Save(TSOut &SOut) const
void Save(TSOut &SOut) const
static TStr GetNrAbsFPath(const TStr &FPath, const TStr &BaseFPath=TStr())
bool IsPrefix(const char *CStr, const int &BChN=0) const
bool IsBool(bool &Val) const
TUInt & operator=(const TUInt &UInt)
TMem(const void *_Bf, const int &_BfL)
void Save(TSOut &SOut, const bool &IsSmall=false) const
unsigned long long uint64
void Save(TSOut &SOut) const
TSFlt & operator=(const TSFlt &SFlt)
static TStr Get01Str(const bool &Val)
bool operator==(const TFlt &Flt) const _CMPWARN
TSFlt(const sdouble &_Val)
int64 GetHexInt64(const int64 &DfVal) const
int CountCh(const char &Ch, const int &BChN=0) const
static double GetNrmDevStep(const int &Seed, const int &Steps)
TStr GetStr(const uint &Offset) const
void SaveTxt(const PSOut &SOut) const
int SearchStr(const TStr &Str, const int &BChN=0) const
bool IsSuffix(const char *Str) const
bool IsWcMatch(const int &StrBChN, const TStr &WcStr, const int &WcStrBChN, TStrV &StarStrV, const char &StarCh='*', const char &QuestCh='?') const
TChA(const int &_MxBfL=256)
static PSIn New(const TStr &Str)
char GetCh(const int &ChN) const
static TStr GetHexStr(const TInt &Int)
TMemIn(const TMem &_Mem, const int &_BfC=0)
static bool IsIpStr(const TStr &IpStr, const char &SplitCh= '.')
static int GetNum(const char &Ch)
static TStr GetStr(const TLFlt &LFlt, const int &Width=-1, const int &Prec=-1)
uint GetUniDevUInt(const uint &Range=0)
TUInt64 & operator=(const TUInt64 &Int)
int GetSecHashCd(const uint &Offset)
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
TStr Mid(const int &BChN, const int &Chs) const
static TRStr * GetNullRStr()
static PStrPool New(TSIn &SIn)
static void TestFrugalInt()
char operator[](const int &ChN) const
char & operator[](const int &ChN)
static bool IsOdd(const int &Int)
void Save(TSOut &SOut) const
TStr RightOf(const char &SplitCh) const
void Save(TSOut &SOut, const bool &SaveCompact=true) const
void Save(TSOut &SOut) const
TStr & ConvUsFromYuAscii()
const char * CStr() const
bool operator==(const char *CStr) const
TChA GetSubStr(const int &BChN, const int &EChN) const
TRStr(const char *CStr1, const char *CStr2)
TFlt(TSIn &SIn, const bool &IsTxt)
TUInt & operator&=(const TUInt &UInt)
bool operator==(const TVoid &) const
static TStr & GetChStr(const char &Ch)
static TStr PutFBaseIfEmpty(const TStr &FNm, const TStr &FBase)
bool IsWord(const bool &WsPrefixP=true, const bool &FirstUcAllowedP=true) const
static TStr LoadTxt(const TStr &FNm)
bool operator<(const int &Int) const
TStr & operator=(const TStr &Str)
void Trunc(const int &_BfL)
bool operator<(const TCh &Ch) const
bool operator!=(const double &Flt) const _CMPWARN
bool operator<(const TUCh &UCh) const
uint GetUInt(const uint &DfVal) const
TNum & operator-=(const TNum &Int)
void SaveXml(TSOut &SOut, const TStr &Nm) const
int GetPrimHashCd(const uint &Offset)
static PStrPool64 Load(TSIn &SIn, bool LoadCompact=true)
static TStr GetNrFPath(const TStr &FPath)
void SaveTxt(const TStr &FNm) const
static TStr GetNrFExt(const TStr &FExt)
bool operator<(const TChA &ChA) const
static TStr GetStr(const int &Val)
TUInt64 & operator-=(const TUInt64 &Int)
static TRStr * GetRStr(const char *CStr)
static TStr GetGigaStr(const double &Val)
TCh & operator=(const TCh &Ch)
void SaveBf(const void *Bf, const TSize &BfL)
char GetCh(const int &ChN) const
TChA & operator+=(const TMem &Mem)
TUInt64(const uint &MsVal, const uint &LsVal)
char GetCh(const int &ChN) const
bool operator==(const TLFlt &LFlt) const _CMPWARN
bool operator<(const TVoid &) const
char & operator[](const int &ChN) const
void SaveXml(TSOut &SOut, const TStr &Nm) const
TStr(TSIn &SIn, const bool &IsSmall=false)
void DelSubStr(const int &BChN, const int &EChN)
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
int64 GetInt64(const int64 &DfVal) const
char operator[](const int &ChN) const
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
void Save(const bool &Bool)
static uint GetRnd(const uint &Range=0)
TDbStr(const TStr &_Str1)
TNum & operator=(const Base &_Val)
TRnd(const int &_Seed=1, const int &Steps=0)
static double Abs(const double &Flt)
static double GetUniDevStep(const int &Seed, const int &Steps)
static int Round(const double &Flt)
bool GetNextLnBf(TChA &LnChA)
TStr Left(const int &EChN) const
static TStr PutFBase(const TStr &FNm, const TStr &FBase)
double GetPoissonDev(const double &Mean)
void SaveXml(TSOut &SOut, const TStr &Nm) const
void SaveXml(TSOut &SOut, const TStr &Nm) const
static void LoadMem(const PSIn &SIn, TMem &Mem)
TNum & operator+=(const TNum &Int)
void Move(const int &Steps)
static PStrPool New(const TStr &fileName)
void SaveTxt(TOLx &Lx) const
TUInt & operator=(const uint &_Val)
static TStr GetNumFNm(const TStr &FNm, const int &Num)
void Save(TSOut &SOut) const
static int Abs(const int &Int)
void Save(const TStr &FNm)
bool operator<(const TLFlt &LFlt) const
static int GetRnd(const int &Range=0)
void PutSeed(const int &_Seed)
void PutCh(const int &ChN, const char &Ch)
static bool IsAlNum(const char &Ch)
static int GetMx(const int &Int1, const int &Int2, const int &Int3, const int &Int4)
void Save(TSOut &SOut, const bool &IsSmall) const
TStr LeftOf(const char &SplitCh) const
TInt & operator=(const int &Int)
void SplitOnNonAlNum(TStrV &StrV) const
int SearchCh(const char &Ch, const int &BChN=0) const
double GetYCenter() const
static char * LoadFrugalInt(char *pSrc, int &i)
uint AddStr(const char *Str)
static bool IsValStr(const TStr &Str)
double GetBinomialDev(const double &Prb, const int &Trials)
void AddBf(char *NewBf, const int &BfS)
static double GetMn(const double &Flt1, const double &Flt2)
int ChangeCh(const char &SrcCh, const char &DstCh, const int &BChN=0)
TStr & operator+=(const TStr &Str)
TStr Mid(const int &BChN) const
static TStr GetYNStr(const bool &Val)
static bool IsAlpha(const char &Ch)
TChA & operator=(const TChA &ChA)
TRnd & operator=(const TRnd &Rnd)
static PMem New(const int &MxBfL=0)
bool IsChIn(const char &Ch) const
static TStr GetMegaStr(const int64 &Val)
TStr LeftOfLast(const char &SplitCh) const
static TStr GetStr(const TNum &Int)
bool operator<(const TInt &Int) const
static TStr Fmt(const char *FmtStr,...)
static TStr MkClone(const TStr &Str)
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
static bool IsNan(const double &Val)
double operator()() const
void Swap(const int &ChN1, const int &ChN2)
int GetHexInt(const int &DfVal) const
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
void SplitOnAllCh(const char &SplitCh, TStrV &StrV, const bool &SkipEmpty=true) const
void LoadBf(const void *Bf, const TSize &BfL)
void SaveXml(TSOut &SOut, const TStr &Nm) const
TStr & operator=(const TChA &ChA)
static TStr LoadTxt(const PSIn &SIn)
static int64 GetFromBufSafe(const char *Bf)
const char * operator()() const
double GetFlt(const double &DfVal) const
bool IsSuffix(const char *CStr) const
bool IsUInt(uint &Val) const
TStr & operator=(const char *CStr)
TUInt64 & operator*=(const TUInt64 &Int)
static char GetUsFromYuAscii(const char &Ch)
static bool Intersection(const TFltRect &Rect1, const TFltRect &Rect2)
int Cmp(const uint &Offset, const char *Str) const
static PStrPool64 New(::TSize MxBfL=0,::TSize GrowBy=16 *1024 *1024)
static TStr GetNrNumFExt(const int &FExtN)
static TStr GetStr(const TStr &Str, const TStr &FmtStr)
void GenZeros(const int &_BfL)
bool operator<(const TStr &Str) const
TRStr(TSIn &SIn, const bool &IsSmall)
static TStr GetStr(const bool &Val)
TStrIn & operator=(const TStrIn &)
TRStr & operator=(const TRStr &)
void Reserve(const int &_MxBfL, const bool &DoClr=true)
void Push(const char &Ch)
static PMem New(const void *Bf, const int &BfL)
void SaveXml(TSOut &SOut, const TStr &Nm) const
void AddChTo(const char &Ch, const int &ToChN)
static int Sign(const double &Flt)
bool operator<(const TBool &Bool) const
static TStr GetStr(const int64 &Val)
static TStr GetStr(const TCh &Ch)
static double GetInRng(const double &Val, const double &Mn, const double &Mx)
static TStr GetKiloStr(const int64 &Val)
void SaveXml(TSOut &SOut, const TStr &Nm) const
static void LoadFrugalIntV(TSIn &SIn, TVec< TInt, int > &IntV, bool ClrP=true)
bool operator==(const int &Int) const
bool operator==(const TBool &Bool) const
TUInt & operator^=(const TUInt &UInt)
bool operator==(const TStr &Str) const
TMem(const int &_MxBfL=0)
TUInt & operator>>=(const int &ShiftBits)
bool operator==(const double &Flt) const _CMPWARN
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
int GetUniDevInt(const int &Range=0)
static TStr PutFExt(const TStr &FNm, const TStr &FExt)
TInt & operator+=(const int &Int)
void SplitOnStr(const TStr &SplitStr, TStrV &StrV) const
bool GetNextLnBf(TChA &LnChA)
void PutCh(const int &ChN, const char &Ch)
static TStr GetStr(const ldouble &Val, const int &Width=-1, const int &Prec=-1)
void SplitOnWs(TStrV &StrV) const
int GetGeoDev(const double &Prb)
bool operator==(const ldouble &LFlt) const _CMPWARN
TUInt64 & operator+=(const TUInt64 &Int)
static char IsUc(const char &Ch)
bool operator!=(const TChA &ChA) const
TFlt & operator=(const TFlt &Flt)
static bool Eq6(const double &LFlt, const double &RFlt)
int GetPrimHashCd() const
TFltRect(const double &_MnX, const double &_MnY, const double &_MxX, const double &_MxY)
virtual int Len() const =0
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
int GetBf(const void *LBf, const TSize &LBfL)
void SplitOnLastCh(TStr &LStr, const char &SplitCh, TStr &RStr) const
TChA(const char *CStr, const int &StrLen)
static TStr GetStr(const uint &Val)
static TStr GetStr(const ldouble &Val, const TStr &FmtStr)
char * operator()() const
static char GetUc(const char &Ch)
TRStr(const char &Ch1, const char &Ch2)
TStr Slice(int BChN, int EChNP1) const
bool IsStrIn(const TStr &Str) const
static uint GetUIntFromIpStr(const TStr &IpStr, const char &SplitCh= '.')
static void Swap(int &Int1, int &Int2)
static TStr GetHexStr(const TNum &Int)
static TStr GetStr(const TBool &Bool)
uint64 GetMemUsed() const
int GetPrimHashCd() const
bool IsSuffix(const TStr &Str) const
TStr operator()(const int &BChN, const int &EChNP1) const
void SplitOnAllAnyCh(const TStr &SplitChStr, TStrV &StrV, const bool &SkipEmpty=true) const
uint AddStr(const TStr &Str)
void InsStr(const int &BChN, const TStr &Str)
static TStr GetStr(const TFlt &Flt, const int &Width=-1, const int &Prec=-1)
int CountCh(const char &Ch, const int &BChN=0) const
static const TStr TrueStr
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
int GetPrimHashCd() const
static int GetMn(const int &Int1, const int &Int2, const int &Int3)
bool operator!=(const char &Ch) const
bool GetNextLnBf(TChA &LnChA)
static TStr GetStr(const TInt &Int)
bool operator<(const TSFlt &SFlt) const
bool operator==(const TUCh &UCh) const
TStr RightOfLast(const char &SplitCh) const
void Save(TSOut &SOut) const
bool operator<(const TDbStr &DbStr) const
static bool IsAbsFPath(const TStr &FPath)
TFlt & operator-=(const double &Flt)
static bool IsEven(const int &Int)
double GetPowerDev(const double &AlphaSlope)
static PMem New(const TStr &Str)
int ChangeStr(const TStr &SrcStr, const TStr &DstStr, const int &BChN=0)
Vector is a sequence TVal objects representing an array that can change in size.
static void LoadMem(const PSIn &SIn, const PMem &Mem)
void ChangeCh(const char &SrcCh, const char &DstCh)
void SaveXml(TSOut &SOut, const TStr &Nm) const
static TStr GetKiloStr(const int &Val)
void SaveTxt(const PSOut &SOut) const
static TStr GetFNmStr(const TStr &Str, const bool &AlNumOnlyP=true)
int GetInt(const int &DfVal) const
void Clr(const bool &DoDel=true)
static int GetMx(const int &Int1, const int &Int2, const int &Int3)