SNAP Library 3.0, User Reference  2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
dt.h
Go to the documentation of this file.
1 #include "bd.h"
2 
4 // Forward
5 class TILx;
6 class TOLx;
8 
10 // Random
11 class TRnd{
12 public:
13  static const int RndSeed;
14 private:
15  static const int a, m, q, r;
16  int Seed;
17  int GetNextSeed(){
18  if ((Seed=a*(Seed%q)-r*(Seed/q))>0){return Seed;} else {return Seed+=m;}}
19 public:
20  TRnd(const int& _Seed=1, const int& Steps=0){
21  PutSeed(_Seed); Move(Steps);}
22  explicit TRnd(TSIn& SIn){SIn.Load(Seed);}
23  void Save(TSOut& SOut) const {SOut.Save(Seed);}
24  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
25  void SaveXml(TSOut& SOut, const TStr& Nm) const;
26 
27  TRnd& operator=(const TRnd& Rnd){Seed=Rnd.Seed; return *this;}
28  bool operator==(const TRnd&) const {Fail; return false;}
29 
30  double GetUniDev(){return GetNextSeed()/double(m);}
31  int GetUniDevInt(const int& Range=0);
32  int GetUniDevInt(const int& MnVal, const int& MxVal){
33  IAssert(MnVal<=MxVal); return MnVal+GetUniDevInt(MxVal-MnVal+1);}
34  uint GetUniDevUInt(const uint& Range=0);
35  int64 GetUniDevInt64(const int64& Range=0);
36  uint64 GetUniDevUInt64(const uint64& Range=0);
37  double GetNrmDev();
38  double GetNrmDev(
39  const double& Mean, const double& SDev, const double& Mn, const double& Mx);
40  double GetExpDev();
41  double GetExpDev(const double& Lambda); // mean=1/lambda
42  double GetGammaDev(const int& Order);
43  double GetPoissonDev(const double& Mean);
44  double GetBinomialDev(const double& Prb, const int& Trials);
45  int GetGeoDev(const double& Prb){
46  return 1+(int)floor(log(1.0-GetUniDev())/log(1.0-Prb));}
47  double GetPowerDev(const double& AlphaSlope){ // power-law degree distribution (AlphaSlope>0)
48  IAssert(AlphaSlope>1.0);
49  return pow(1.0-GetUniDev(), -1.0/(AlphaSlope-1.0));}
50  double GetRayleigh(const double& Sigma) { // 1/sqrt(alpha) = sigma
51  IAssert(Sigma>0.0);
52  return Sigma*sqrt(-2*log(1-GetUniDev()));}
53  double GetWeibull(const double& K, const double& Lambda) { // 1/alpha = lambda
54  IAssert(Lambda>0.0 && K>0.0);
55  return Lambda*pow(-log(1-GetUniDev()), 1.0/K);}
56  //void GetSphereDev(const int& Dim, TFltV& ValV);
57 
58  void PutSeed(const int& _Seed);
59  int GetSeed() const {return Seed;}
61  void Move(const int& Steps);
62  bool Check();
63 
64  static double GetUniDevStep(const int& Seed, const int& Steps){
65  TRnd Rnd(Seed); Rnd.Move(Steps); return Rnd.GetUniDev();}
66  static double GetNrmDevStep(const int& Seed, const int& Steps){
67  TRnd Rnd(Seed); Rnd.Move(Steps); return Rnd.GetNrmDev();}
68  static double GetExpDevStep(const int& Seed, const int& Steps){
69  TRnd Rnd(Seed); Rnd.Move(Steps); return Rnd.GetExpDev();}
70 
71  static TRnd LoadTxt(TILx& Lx);
72  void SaveTxt(TOLx& Lx) const;
73 };
74 
76 // Memory
78 private:
79  int MxBfL, BfL;
80  char* Bf;
81  void Resize(const int& _MxBfL);
82  bool DoFitLen(const int& LBfL) const {return BfL+LBfL<=MxBfL;}
83 public:
84  TMem(const int& _MxBfL=0):
85  MxBfL(_MxBfL), BfL(0), Bf(NULL){ IAssert(BfL>=0);
86  if (MxBfL>0){Bf=new char[MxBfL]; IAssert(Bf!=NULL);}}
87  static PMem New(const int& MxBfL=0){return new TMem(MxBfL);}
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);}
92  TMem(const TMem& Mem):
93  MxBfL(Mem.MxBfL), BfL(Mem.BfL), Bf(NULL){
94  if (MxBfL>0){Bf=new char[MxBfL]; memcpy(Bf, Mem.Bf, BfL);}}
95  static PMem New(const TMem& Mem){return new TMem(Mem);}
96  static PMem New(const PMem& Mem){return new TMem(*Mem);}
97  TMem(const TStr& Str);
98  static PMem New(const TStr& Str){return new TMem(Str);}
99  ~TMem(){if (Bf!=NULL){delete[] Bf;}}
100  explicit TMem(TSIn& SIn){
101  SIn.Load(MxBfL); SIn.Load(BfL);
102  Bf=new char[MxBfL=BfL]; SIn.LoadBf(Bf, BfL);}
103  void Save(TSOut& SOut) const {
104  SOut.Save(MxBfL); SOut.Save(BfL); SOut.SaveBf(Bf, BfL);}
105  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
106  void SaveXml(TSOut& SOut, const TStr& Nm) const;
107 
108  TMem& operator=(const TMem& Mem){
109  if (this!=&Mem){
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);}}
113  return *this;}
114  char* operator()() const {return Bf;}
115  TMem& operator+=(const char& Ch);
116  TMem& operator+=(const TMem& Mem);
117  TMem& operator+=(const TStr& Str);
118  TMem& operator+=(const PSIn& SIn);
119  char& operator[](const int& ChN) const {
120  Assert((0<=ChN)&&(ChN<BfL)); return Bf[ChN];}
121  int GetMemUsed() const {return int(2*sizeof(int)+sizeof(char*)+MxBfL);}
122 
123  void Gen(const int& _BfL){
124  Clr(); Resize(_BfL); BfL=_BfL;}
125  void GenZeros(const int& _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;}
133  else {BfL=0;}}
134  int Len() const {return BfL;}
135  bool Empty() const {return BfL==0;}
136  void Trunc(const int& _BfL){
137  if ((0<=_BfL)&&(_BfL<=BfL)){BfL=_BfL;}}
138  void Push(const char& Ch){operator+=(Ch);}
139  char Pop(){IAssert(BfL>0); BfL--; return Bf[BfL];}
140 
141  bool DoFitStr(const TStr& Str) const;
142  //int AddStr(const TStr& Str);
143  void AddBf(const void* Bf, const int& BfL);
144  char* GetBf() const {return Bf;}
145  TStr GetAsStr(const char& NewNullCh='\0') const;
146  PSIn GetSIn() const {
147  TMOut MOut(BfL); MOut.SaveBf(Bf, BfL); return MOut.GetSIn();}
148 
149  static void LoadMem(const PSIn& SIn, TMem& Mem){
150  Mem.Clr(); Mem.Gen(SIn->Len()); SIn->GetBf(Mem.Bf, SIn->Len());}
151  static void LoadMem(const PSIn& SIn, const PMem& Mem){
152  Mem->Clr(); Mem->Gen(SIn->Len()); SIn->GetBf(Mem->Bf, SIn->Len());}
153  void SaveMem(const PSOut& SOut) const {SOut->SaveBf(Bf, Len());}
154 };
155 
157 // Input-Memory
158 class TMemIn: public TSIn{
159 private:
161  const char* Bf;
162  int BfC, BfL;
163 public:
164  TMemIn(const TMem& _Mem, const int& _BfC=0);
165  static PSIn New(const TMem& Mem){
166  return PSIn(new TMemIn(Mem));}
167  static PSIn New(const PMem& Mem){
168  TMemIn* MemIn=new TMemIn(*Mem); MemIn->Mem=Mem; return PSIn(MemIn);}
170 
171  bool Eof(){return BfC==BfL;}
172  int Len() const {return BfL-BfC;}
173  char GetCh(){Assert(BfC<BfL); return Bf[BfC++];}
174  char PeekCh(){Assert(BfC<BfL); return Bf[BfC];}
175  int GetBf(const void* LBf, const TSize& LBfL);
176  void Reset(){Cs=TCs(); BfC=0;}
177  bool GetNextLnBf(TChA& LnChA);
178 };
179 
181 // Output-Memory
182 class TMemOut: public TSOut{
183 private:
185 private:
186  void FlushBf();
187 public:
188  TMemOut(const PMem& _Mem);
189  static PSOut New(const PMem& Mem){
190  return new TMemOut(Mem);}
192 
193  int PutCh(const char& Ch){
194  Mem->operator+=(Ch); return Ch;}
195  int PutBf(const void* LBf, const TSize& LBfL);
196  void Flush(){}
197 };
198 
200 // Char-Array
201 class TChA{
202 private:
203  int MxBfL, BfL;
204  char* Bf;
205  void Resize(const int& _MxBfL);
206 public:
207  explicit TChA(const int& _MxBfL=256){
208  Bf=new char[(MxBfL=_MxBfL)+1]; Bf[BfL=0]=0;}
209  TChA(const char* CStr){
210  Bf=new char[(MxBfL=BfL=int(strlen(CStr)))+1]; strcpy(Bf, CStr);}
211  TChA(const char* CStr, const int& StrLen) : MxBfL(StrLen), BfL(StrLen) {
212  Bf=new char[StrLen+1]; strncpy(Bf, CStr, StrLen); Bf[StrLen]=0;}
213  TChA(const TChA& ChA){
214  Bf=new char[(MxBfL=ChA.MxBfL)+1]; BfL=ChA.BfL; strcpy(Bf, ChA.CStr());}
215  TChA(const TStr& Str);
216  TChA(const TMem& Mem){
217  Bf=new char[(MxBfL=BfL=Mem.Len())+1]; Bf[MxBfL]=0;
218  memcpy(CStr(), Mem(), Mem.Len());}
219  ~TChA(){delete[] Bf;}
220  explicit TChA(TSIn& SIn){
221  SIn.Load(MxBfL); SIn.Load(BfL); SIn.Load(Bf, MxBfL, BfL);}
222  void Load(TSIn& SIn){ delete[] Bf;
223  SIn.Load(MxBfL); SIn.Load(BfL); SIn.Load(Bf, MxBfL, BfL);}
224  void Save(TSOut& SOut, const bool& SaveCompact=true) const { //J:
225  SOut.Save(SaveCompact?BfL:MxBfL); SOut.Save(BfL); SOut.Save(Bf, BfL);}
226  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
227  void SaveXml(TSOut& SOut, const TStr& Nm) const;
228 
229  TChA& operator=(const TChA& ChA);
230  TChA& operator=(const TStr& Str);
231  TChA& operator=(const char* CStr);
232  bool operator==(const TChA& ChA) const {return strcmp(CStr(), ChA.CStr())==0;}
233  bool operator==(const char* _CStr) const {return strcmp(CStr(), _CStr)==0;}
234  bool operator==(const char& Ch) const {return (BfL==1)&&(Bf[0]==Ch);}
235  bool operator!=(const TChA& ChA) const {return strcmp(CStr(), ChA.CStr())!=0;}
236  bool operator!=(const char* _CStr) const {return strcmp(CStr(), _CStr)!=0;}
237  bool operator!=(const char& Ch) const {return !((BfL==1)&&(Bf[0]==Ch));}
238  bool operator<(const TChA& ChA) const {return strcmp(CStr(), ChA.CStr())<0;}
239 
240  TChA& operator+=(const TMem& Mem);
241  TChA& operator+=(const TChA& ChA);
242  TChA& operator+=(const TStr& Str);
243  TChA& operator+=(const char* CStr);
244  TChA& operator+=(const char& Ch){
245  if (BfL==MxBfL){Resize(BfL+1);}
246  Bf[BfL]=Ch; BfL++; Bf[BfL]=0; return *this;}
247  char operator[](const int& ChN) const {
248  Assert((0<=ChN)&&(ChN<BfL)); return Bf[ChN];}
249  char& operator[](const int& ChN){
250  Assert((0<=ChN)&&(ChN<BfL)); return Bf[ChN];}
251  int GetMemUsed() const {return int(2*sizeof(int)+sizeof(char*)+sizeof(char)*MxBfL);}
252 
253  char* operator ()(){return Bf;}
254  const char* operator ()() const {return Bf;}
255  char* CStr() {return Bf;}
256  const char* CStr() const {return Bf;}
257 
258  void Clr(){Bf[BfL=0]=0;}
259  int Len() const {return BfL;}
260  bool Empty() const {return BfL==0;}
261  void Ins(const int& BChN, const char* CStr);
262  void Del(const int& ChN);
263  void DelLastCh(){Pop();}
264  void Push(const char& Ch){operator+=(Ch);}
265  char Pop(){IAssert(BfL>0); BfL--; char Ch=Bf[BfL]; Bf[BfL]=0; return Ch;}
266  void Trunc();
267  void Trunc(const int& _BfL){
268  if ((0<=_BfL)&&(_BfL<=BfL)){Bf[BfL=_BfL]=0;}}
269  void Reverse();
270 
271  void AddCh(const char& Ch, const int& MxLen=-1){
272  if ((MxLen==-1)||(BfL<MxLen)){operator+=(Ch);}}
273  void AddChTo(const char& Ch, const int& ToChN){
274  while (Len()<ToChN){AddCh(Ch);}}
275  void AddBf(char *NewBf, const int& BfS){
276  if ((BfL+BfS+1)>MxBfL){Resize(BfL+BfS+1);}
277  strncpy(Bf+BfL,NewBf,BfS); BfL+=BfS; Bf[BfL]=0;}
278  void PutCh(const int& ChN, const char& Ch){
279  Assert((0<=ChN)&&(ChN<BfL)); Bf[ChN]=Ch;}
280  char GetCh(const int& ChN) const {return operator[](ChN);}
281  char LastCh() const { Assert(1<=BfL); return Bf[BfL-1]; }
282  char LastLastCh() const { Assert(2<=BfL); return Bf[BfL-2]; }
283 
284  TChA GetSubStr(const int& BChN, const int& EChN) const;
285 
286  int CountCh(const char& Ch, const int& BChN=0) const;
287  int SearchCh(const char& Ch, const int& BChN=0) const;
288  int SearchChBack(const char& Ch, int BChN=-1) const;
289  int SearchStr(const TChA& Str, const int& BChN=0) const;
290  int SearchStr(const TStr& Str, const int& BChN=0) const;
291  int SearchStr(const char* CStr, const int& BChN=0) const;
292  bool IsStrIn(const TStr& Str) const {return SearchStr(Str)!=-1;}
293  bool IsPrefix(const char* CStr, const int& BChN=0) const;
294  bool IsPrefix(const TStr& Str) const;
295  bool IsPrefix(const TChA& Str) const;
296  bool IsSuffix(const char* CStr) const;
297  bool IsSuffix(const TStr& Str) const;
298  bool IsSuffix(const TChA& Str) const;
299 
300  bool IsChIn(const char& Ch) const {return SearchCh(Ch)!=-1;}
301  void ChangeCh(const char& SrcCh, const char& DstCh);
302  TChA& ToUc();
303  TChA& ToLc();
304  TChA& ToTrunc();
305  void CompressWs();
306  void Swap(const int& ChN1, const int& ChN2);
307  void Swap(TChA& ChA);
308 
309  int GetPrimHashCd() const;
310  int GetSecHashCd() const;
311 
312  static void LoadTxt(const PSIn& SIn, TChA& ChA);
313  void SaveTxt(const PSOut& SOut) const;
314 
315  //friend TChA operator+(const TChA& LStr, const TChA& RStr);
316  //friend TChA operator+(const TChA& LStr, const TStr& RStr);
317  //friend TChA operator+(const TChA& LStr, const char* RCStr);
318 };
319 
321 // Input-Char-Array
322 class TChAIn: public TSIn{
323 private:
324  const char* Bf;
325  int BfC, BfL;
326 private:
327  TChAIn();
328  TChAIn(const TChAIn&);
329  TChAIn& operator=(const TChAIn&);
330 public:
331  TChAIn(const TChA& ChA, const int& _BfC=0);
332  static PSIn New(const TChA& ChA){return PSIn(new TChAIn(ChA));}
334 
335  bool Eof(){return BfC==BfL;}
336  int Len() const {return BfL-BfC;}
337  char GetCh(){Assert(BfC<BfL); return Bf[BfC++];}
338  char PeekCh(){Assert(BfC<BfL); return Bf[BfC];}
339  int GetBf(const void* LBf, const TSize& LBfL);
340  void Reset(){Cs=TCs(); BfC=0;}
341  bool GetNextLnBf(TChA& LnChA);
342 };
343 
345 // Ref-String
346 class TRStr{
347 public:
348  char* Bf;
349  int Refs;
350 public:
351  TRStr(){Refs=1; Bf=new char[0+1]; Bf[0]=0;}
352  TRStr(const int& Len){
353  IAssert(Len>=0); Refs=0; Bf=new char[Len+1]; Bf[Len]=0;}
354  TRStr(const char* CStr){
355  Refs=0; Bf=new char[strlen(CStr)+1]; strcpy(Bf, CStr);}
356  TRStr(const char* CStr, const int& MxLen){
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);}
361  TRStr(const char& Ch){
362  Refs=0; Bf=new char[1+1]; Bf[0]=Ch; Bf[1]=0;}
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;}
366  Assert(((this!=GetNullRStr())&&(Refs==0))||((this==GetNullRStr())&&(Refs==1)));
367  delete[] Bf;}
368  explicit TRStr(TSIn& SIn, const bool& IsSmall){
369  if (IsSmall){Refs=0; SIn.Load(Bf);}
370  else {Refs=0; int BfL; SIn.Load(BfL); SIn.Load(Bf, BfL, BfL);}}
371  void Save(TSOut& SOut, const bool& IsSmall) const {
372  if (IsSmall){SOut.Save(Bf);}
373  else {int BfL=int(strlen(Bf)); SOut.Save(BfL); SOut.Save(Bf, BfL);}}
374 
375  TRStr& operator=(const TRStr&){Fail; return *this;}
376  int GetMemUsed() const {return int(sizeof(int))+int(strlen(Bf));}
377 
378  void MkRef(){Refs++;}
379  void UnRef(){Assert(Refs>0); if (--Refs==0){delete this;}}
380 
381  const char* CStr() const {return Bf;}
382  char* CStr() {return Bf;}
383  bool Empty() const {return Bf[0]==0;}
384  int Len() const {return int(strlen(Bf));}
385 
386  void PutCh(const int& ChN, const char& Ch){
387  Assert((0<=ChN)&&(ChN<Len())); Bf[ChN]=Ch;}
388  char GetCh(const int& ChN) const {
389  Assert((0<=ChN)&&(ChN<Len())); return Bf[ChN];}
390 
391  bool IsUc() const;
392  void ToUc();
393  bool IsLc() const;
394  void ToLc();
395  void ToCap();
396  void ConvUsFromYuAscii();
397  static int CmpI(const char* CStr1, const char* CStr2);
398 
399  int GetPrimHashCd() const;
400  int GetSecHashCd() const;
401 
402  static TRStr* GetNullRStr(){
403  static TRStr NullRStr; Assert(NullRStr.Bf!=NULL); return &NullRStr;}
404 };
405 
407 // String
408 class TStr;
409 template <class TVal, class TSizeTy> class TVec;
410 typedef TVec<TStr, int> TStrV;
411 
412 class TStr{
413 private:
415 private:
416  TStr(const char& Ch, bool){
417  RStr=new TRStr(Ch); RStr->MkRef();}
418  TStr(const char& Ch1, const char& Ch2, bool){
419  RStr=new TRStr(Ch1, Ch2); RStr->MkRef();}
420  static TRStr* GetRStr(const char* CStr);
421  void Optimize();
422 public:
424  TStr(const TStr& Str){RStr=Str.RStr; RStr->MkRef();}
425  TStr(const TChA& ChA){RStr=GetRStr(ChA.CStr()); RStr->MkRef();}
426  TStr(const TSStr& SStr){RStr=GetRStr(SStr.CStr()); RStr->MkRef();}
427  TStr(const char* CStr){RStr=GetRStr(CStr); RStr->MkRef();}
428  explicit TStr(const char& Ch){RStr=GetChStr(Ch).RStr; RStr->MkRef();}
429  TStr(const TMem& Mem){
430  RStr=new TRStr(Mem.Len()); RStr->MkRef();
431  memcpy(CStr(), Mem(), Mem.Len()); Optimize();}
432  explicit TStr(const PSIn& SIn){
433  int SInLen=SIn->Len(); RStr=new TRStr(SInLen); RStr->MkRef();
434  SIn->GetBf(CStr(), SInLen); Optimize();}
435  ~TStr(){RStr->UnRef();}
436  explicit TStr(TSIn& SIn, const bool& IsSmall=false):
437  RStr(new TRStr(SIn, IsSmall)){RStr->MkRef(); Optimize();}
438  void Load(TSIn& SIn, const bool& IsSmall=false){
439  *this=TStr(SIn, IsSmall);}
440  void Save(TSOut& SOut, const bool& IsSmall=false) const {
441  RStr->Save(SOut, IsSmall);}
442  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
443  void SaveXml(TSOut& SOut, const TStr& Nm) const;
444 
445  TStr& operator=(const TStr& Str){
446  if (this!=&Str){RStr->UnRef(); RStr=Str.RStr; RStr->MkRef();} return *this;}
447  TStr& operator=(const TChA& ChA){
448  RStr->UnRef(); RStr=GetRStr(ChA.CStr()); RStr->MkRef(); return *this;}
449  TStr& operator=(const char* CStr){
450  RStr->UnRef(); RStr=GetRStr(CStr); RStr->MkRef(); return *this;}
451  TStr& operator=(const char& Ch){
452  RStr->UnRef(); RStr=GetChStr(Ch).RStr; RStr->MkRef(); return *this;}
453  TStr& operator+=(const TStr& Str){
454  TRStr* NewRStr=new TRStr(RStr->CStr(), Str.RStr->CStr());
455  RStr->UnRef(); RStr=NewRStr; RStr->MkRef();
456  Optimize(); return *this;}
457  TStr& operator+=(const char* CStr){
458  TRStr* NewRStr=new TRStr(RStr->CStr(), CStr);
459  RStr->UnRef(); RStr=NewRStr; RStr->MkRef();
460  Optimize(); return *this;}
461  bool operator==(const TStr& Str) const {
462  return (RStr==Str.RStr)||(strcmp(RStr->CStr(), Str.RStr->CStr())==0);}
463  bool operator==(const char* CStr) const {
464  return strcmp(RStr->CStr(), CStr)==0;}
465 // bool operator!=(const TStr& Str) const {
466 // return strcmp(RStr->CStr(), Str.RStr->CStr())!=0;}
467  bool operator!=(const char* CStr) const {
468  return strcmp(RStr->CStr(), CStr)!=0;}
469  bool operator<(const TStr& Str) const {
470  return strcmp(RStr->CStr(), Str.RStr->CStr())<0;}
471  char operator[](const int& ChN) const {return RStr->GetCh(ChN);}
472  int GetMemUsed() const {return int(sizeof(TRStr*)+RStr->GetMemUsed());}
473 
474  char* operator()(){return RStr->CStr();}
475  const char* operator()() const {return RStr->CStr();}
476  char* CStr() {return RStr->CStr();}
477  const char* CStr() const {return RStr->CStr();}
478 
479  void PutCh(const int& ChN, const char& Ch){
480  TRStr* NewRStr=new TRStr(RStr->CStr());
481  RStr->UnRef(); RStr=NewRStr; RStr->MkRef();
482  RStr->PutCh(ChN, Ch); Optimize();}
483  char GetCh(const int& ChN) const {return RStr->GetCh(ChN);}
484  char LastCh() const {return GetCh(Len()-1);}
485 
487  int Len() const {return RStr->Len();}
488  bool Empty() const {return RStr->Empty();}
489 
490  // upper-case
491  bool IsUc() const {return RStr->IsUc();}
492  TStr& ToUc();
493  TStr GetUc() const {return TStr(*this).ToUc();}
494  int CmpI(const TStr& Str) const {return TRStr::CmpI(CStr(), Str.CStr());}
495  bool EqI(const TStr& Str) const {return TRStr::CmpI(CStr(), Str.CStr())==0;}
496  // lower-case
497  bool IsLc() const {return RStr->IsLc();}
498  TStr& ToLc();
499  TStr GetLc() const {return TStr(*this).ToLc();}
500  // capitalize
501  TStr& ToCap();
502  TStr GetCap() const {return TStr(*this).ToCap();}
503 
504  // truncate
505  TStr& ToTrunc();
506  TStr GetTrunc() const {return TStr(*this).ToTrunc();}
507  // Yu-Ascii to Us-Ascii
509  TStr GetUsFromYuAscii() const {return TStr(*this).ConvUsFromYuAscii();}
510  // hex
511  TStr& ToHex();
512  TStr GetHex() const {return TStr(*this).ToHex();}
513  TStr& FromHex();
514  TStr GetFromHex() const {return TStr(*this).FromHex();}
515 
516  TStr GetSubStr(const int& BChN, const int& EChN) const;
517  TStr GetSubStr(const int& BChN) const { return GetSubStr(BChN, Len()-1); }
518  void InsStr(const int& BChN, const TStr& Str);
519  void DelChAll(const char& Ch);
520  void DelSubStr(const int& BChN, const int& EChN);
521  bool DelStr(const TStr& Str);
522  TStr LeftOf(const char& SplitCh) const;
523  TStr LeftOfLast(const char& SplitCh) const;
524  TStr RightOf(const char& SplitCh) const;
525  TStr RightOfLast(const char& SplitCh) const;
526  void SplitOnCh(TStr& LStr, const char& SplitCh, TStr& RStr) const;
527  void SplitOnLastCh(TStr& LStr, const char& SplitCh, TStr& RStr) const;
528  void SplitOnAllCh(
529  const char& SplitCh, TStrV& StrV, const bool& SkipEmpty=true) const;
530  void SplitOnAllAnyCh(
531  const TStr& SplitChStr, TStrV& StrV, const bool& SkipEmpty=true) const;
532  void SplitOnWs(TStrV& StrV) const;
533  void SplitOnNonAlNum(TStrV& StrV) const;
534  void SplitOnStr(const TStr& SplitStr, TStrV& StrV) const;
535  void SplitOnStr(TStr& LeftStr, const TStr& MidStr, TStr& RightStr) const;
536 
537  //TStr Left(const int& Chs) const { return Chs>0 ? GetSubStr(0, Chs-1) : GetSubStr(0, Len()-Chs-1);}
538  //TStr Right(const int& Chs) const {return GetSubStr(Len()-Chs, Len()-1);}
539  TStr Mid(const int& BChN, const int& Chs) const { return GetSubStr(BChN, BChN+Chs-1); }
540  TStr Mid(const int& BChN) const {return GetSubStr(BChN, Len()-1); }
541  //TStr Slice(const int& BChN, const int& EChNP1) const {return GetSubStr(BChN, EChNP1-1);}
542  //TStr operator()(const int& BChN, const int& EChNP1) const {return Slice(BChN, EChNP1);}
543  //J: as in python or matlab: position 1 is 1st character, -1 is last character
544  TStr Left(const int& EChN) const { return EChN>0 ? GetSubStr(0, EChN-1) : GetSubStr(0, Len()+EChN-1);}
545  TStr Right(const int& BChN) const {return BChN>=0 ? GetSubStr(BChN, Len()-1) : GetSubStr(Len()+BChN, Len()-1);}
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); }
547  TStr operator()(const int& BChN, const int& EChNP1) const {return Slice(BChN, EChNP1);}
548 
549  int CountCh(const char& Ch, const int& BChN=0) const;
550  int SearchCh(const char& Ch, const int& BChN=0) const;
551  int SearchChBack(const char& Ch, int BChN=-1) const;
552  int SearchStr(const TStr& Str, const int& BChN=0) const;
553  bool IsChIn(const char& Ch) const {return SearchCh(Ch)!=-1;}
554  bool IsStrIn(const TStr& Str) const {return SearchStr(Str)!=-1;}
555  bool IsPrefix(const char *Str) const;
556  bool IsPrefix(const TStr& Str) const {
557  return IsPrefix(Str.CStr());}
558  bool IsSuffix(const char *Str) const;
559  bool IsSuffix(const TStr& Str) const {
560  return IsSuffix(Str.CStr());}
561 
562  int ChangeCh(const char& SrcCh, const char& DstCh, const int& BChN=0);
563  int ChangeChAll(const char& SrcCh, const char& DstCh);
564  int ChangeStr(const TStr& SrcStr, const TStr& DstStr, const int& BChN=0);
565  int ChangeStrAll(const TStr& SrcStr, const TStr& DstStr, const bool& FromStartP=false);
566  TStr Reverse() const {
567  TChA ChA(*this); ChA.Reverse(); return ChA;}
568 
569  int GetPrimHashCd() const {return RStr->GetPrimHashCd();}
570  int GetSecHashCd() const {return RStr->GetSecHashCd();}
571 
572  bool IsBool(bool& Val) const;
573 
574  bool IsInt(
575  const bool& Check, const int& MnVal, const int& MxVal, int& Val) const;
576  bool IsInt(int& Val) const {return IsInt(false, 0, 0, Val);}
577  bool IsInt() const {int Val; return IsInt(false, 0, 0, Val);}
578  int GetInt() const {int Val; IAssertR(IsInt(false, 0, 0, Val), *this); return Val;}
579  int GetInt(const int& DfVal) const {
580  int Val; if (IsInt(false, 0, 0, Val)){return Val;} else {return DfVal;}}
581 
582  bool IsUInt(
583  const bool& Check, const uint& MnVal, const uint& MxVal, uint& Val) const;
584  bool IsUInt(uint& Val) const {return IsUInt(false, 0, 0, Val);}
585  bool IsUInt() const {uint Val; return IsUInt(false, 0, 0, Val);}
586  uint GetUInt() const {uint Val; IAssert(IsUInt(false, 0, 0, Val)); return Val;}
587  uint GetUInt(const uint& DfVal) const {
588  uint Val; if (IsUInt(false, 0, 0, Val)){return Val;} else {return DfVal;}}
589 
590  bool IsInt64(
591  const bool& Check, const int64& MnVal, const int64& MxVal, int64& Val) const;
592  bool IsInt64(int64& Val) const {return IsInt64(false, 0, 0, Val);}
593  bool IsInt64() const {int64 Val; return IsInt64(false, 0, 0, Val);}
594  int64 GetInt64() const {
595  int64 Val; IAssert(IsInt64(false, 0, 0, Val)); return Val;}
596  int64 GetInt64(const int64& DfVal) const {
597  int64 Val; if (IsInt64(false, 0, 0, Val)){return Val;} else {return DfVal;}}
598 
599  bool IsUInt64(
600  const bool& Check, const uint64& MnVal, const uint64& MxVal, uint64& Val) const;
601  bool IsUInt64(uint64& Val) const {return IsUInt64(false, 0, 0, Val);}
602  bool IsUInt64() const {uint64 Val; return IsUInt64(false, 0, 0, Val);}
603  uint64 GetUInt64() const {
604  uint64 Val; IAssert(IsUInt64(false, 0, 0, Val)); return Val;}
605  uint64 GetUInt64(const uint64& DfVal) const {
606  uint64 Val; if (IsUInt64(false, 0, 0, Val)){return Val;} else {return DfVal;}}
607 
608  bool IsHexInt(const bool& Check, const int& MnVal, const int& MxVal, int& Val) const;
609  bool IsHexInt(int& Val) const {return IsHexInt(false, 0, 0, Val);}
610  bool IsHexInt() const {int Val; return IsHexInt(false, 0, 0, Val);}
611  int GetHexInt() const {
612  int Val; IAssert(IsHexInt(false, 0, 0, Val)); return Val;}
613  int GetHexInt(const int& DfVal) const {
614  int Val; if (IsHexInt(false, 0, 0, Val)){return Val;} else {return DfVal;}}
615 
616  bool IsHexInt64(const bool& Check, const int64& MnVal, const int64& MxVal, int64& Val) const;
617  bool IsHexInt64(int64& Val) const {return IsHexInt64(false, 0, 0, Val);}
618  bool IsHexInt64() const {int64 Val; return IsHexInt64(false, 0, 0, Val);}
619  int64 GetHexInt64() const {
620  int64 Val; IAssert(IsHexInt64(false, 0, 0, Val)); return Val;}
621  int64 GetHexInt64(const int64& DfVal) const {
622  int64 Val; if (IsHexInt64(false, 0, 0, Val)){return Val;} else {return DfVal;}}
623 
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);}
628  double GetFlt() const {
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;}}
632 
633  bool IsWord(const bool& WsPrefixP=true, const bool& FirstUcAllowedP=true) const;
634  bool IsWs() const;
635 
636  bool IsWcMatch(
637  const int& StrBChN, const TStr& WcStr, const int& WcStrBChN, TStrV& StarStrV,
638  const char& StarCh='*', const char& QuestCh='?') const;
639  bool IsWcMatch(
640  const TStr& WcStr, TStrV& StarStrV,
641  const char& StarCh='*', const char& QuestCh='?') const;
642  bool IsWcMatch(const TStr& WcStr, const char& StarCh, const char& QuestCh) const;
643  bool IsWcMatch(const TStr& WcStr, const int& StarStrN, TStr& StarStr) const;
644  bool IsWcMatch(const TStr& WcStr) const;
645  TStr GetWcMatch(const TStr& WcStr, const int& StarStrN=0) const;
646 
647  TStr GetFPath() const;
648  TStr GetFBase() const;
649  TStr GetFMid() const;
650  TStr GetFExt() const;
651  static TStr GetNrFPath(const TStr& FPath);
652  static TStr GetNrFMid(const TStr& FMid);
653  static TStr GetNrFExt(const TStr& FExt);
654  static TStr GetNrNumFExt(const int& FExtN);
655  static TStr GetNrFNm(const TStr& FNm);
656  static TStr GetNrAbsFPath(const TStr& FPath, const TStr& BaseFPath=TStr());
657  static bool IsAbsFPath(const TStr& FPath);
658  static TStr PutFExt(const TStr& FNm, const TStr& FExt);
659  static TStr PutFExtIfEmpty(const TStr& FNm, const TStr& FExt);
660  static TStr PutFBase(const TStr& FNm, const TStr& FBase);
661  static TStr PutFBaseIfEmpty(const TStr& FNm, const TStr& FBase);
662  static TStr AddToFMid(const TStr& FNm, const TStr& ExtFMid);
663  static TStr GetNumFNm(const TStr& FNm, const int& Num);
664  static TStr GetFNmStr(const TStr& Str, const bool& AlNumOnlyP=true);
665 
666  static TStr LoadTxt(const PSIn& SIn){
667  return TStr(SIn);}
668  static TStr LoadTxt(const TStr& FNm){
669  PSIn SIn=TFIn::New(FNm); return LoadTxt(SIn);}
670  void SaveTxt(const PSOut& SOut) const {
671  SOut->SaveBf(CStr(), Len());}
672  void SaveTxt(const TStr& FNm) const {
673  PSOut SOut=TFOut::New(FNm); SaveTxt(SOut);}
674 
675  static TStr& GetChStr(const char& Ch);
676  static TStr& GetDChStr(const char& Ch1, const char& Ch2);
677 
678  TStr GetStr() const {return *this;}
679  static TStr GetStr(const TStr& Str, const char* FmtStr);
680  static TStr GetStr(const TStr& Str, const TStr& FmtStr){
681  return GetStr(Str, FmtStr.CStr());}
682  static TStr GetStr(const TStrV& StrV, const TStr& DelimiterStr);
683  static TStr Fmt(const char *FmtStr, ...);
684  static TStr GetSpaceStr(const int& Spaces);
685  char* GetCStr() const {
686  char* Bf=new char[Len()+1]; strcpy(Bf, CStr()); return Bf;}
687 
688  static TStr MkClone(const TStr& Str){return TStr(Str.CStr());}
689  static TStr GetNullStr();
690 
691  friend TStr operator+(const TStr& LStr, const TStr& RStr);
692  friend TStr operator+(const TStr& LStr, const char* RCStr);
693 };
694 
696 // Input-String
697 class TStrIn: public TSIn{
698 private:
700  char* Bf;
701  int BfC, BfL;
702 private:
703  TStrIn();
704  TStrIn(const TStrIn&);
705  TStrIn& operator = (const TStrIn&);
706 public:
707  TStrIn(const TStr& _Str);
708  static PSIn New(const TStr& Str){return PSIn(new TStrIn(Str));}
710 
711  bool Eof(){return BfC==BfL;}
712  int Len() const {return BfL-BfC;}
713  char GetCh(){Assert(BfC<BfL); return Bf[BfC++];}
714  char PeekCh(){Assert(BfC<BfL); return Bf[BfC];}
715  int GetBf(const void* LBf, const TSize& LBfL);
716  void Reset(){Cs=TCs(); BfC=0;}
717  bool GetNextLnBf(TChA& LnChA);
718 };
719 
721 // Double-String
722 class TDbStr{
723 public:
726 public:
727  TDbStr(): Str1(), Str2(){}
728  TDbStr(const TDbStr& DbStr): Str1(DbStr.Str1), Str2(DbStr.Str2){}
729  TDbStr(const TStr& _Str1): Str1(_Str1), Str2(){}
730  TDbStr(const TStr& _Str1, const TStr& _Str2): Str1(_Str1), Str2(_Str2){}
731  explicit TDbStr(TSIn& SIn): Str1(SIn), Str2(SIn){}
732  void Save(TSOut& SOut) const {Str1.Save(SOut); Str2.Save(SOut);}
733 
734  TDbStr& operator=(const TDbStr& DbStr){
735  if (this!=&DbStr){Str1=DbStr.Str1; Str2=DbStr.Str2;} return *this;}
736  bool operator==(const TDbStr& DbStr) const {
737  return (Str1==DbStr.Str1)&&(Str2==DbStr.Str2);}
738  bool operator<(const TDbStr& DbStr) const {
739  return (Str1<DbStr.Str1)||((Str1==DbStr.Str1)&&(Str2<DbStr.Str2));}
740 
741  TStr GetStr(const TStr& MidStr=TStr()) const {
742  if (Filled()){return Str1+MidStr+Str2;} else {return Str1+Str2;}}
743  int GetPrimHashCd() const {
744  return Str1.GetPrimHashCd()+Str2.GetPrimHashCd();}
745  int GetSecHashCd() const {
746  return Str1.GetSecHashCd()+Str2.GetSecHashCd();}
747 
748  bool Empty() const {return (Str1.Empty())&&(Str2.Empty());}
749  bool Filled() const {return (!Str2.Empty())&&(!Str1.Empty());}
750 };
751 
753 // Simple-String-Pool
754 //ClassTP(TSStrPool, PSStrPool)//{
755 //private:
756 // TMem Bf;
757 //public:
758 // TSStrPool(const int& MxLen=0): Bf(MxLen){}
759 // TSStrPool(TSStrPool& StrPool): Bf(StrPool.Bf){}
760 // TSStrPool(TSIn& SIn): Bf(SIn){}
761 // void Save(TSOut& SOut) const {Bf.Save(SOut);}
762 //
763 // TSStrPool& operator=(const TSStrPool& StrPool){
764 // Bf=StrPool.Bf; return *this;}
765 //
766 // int Len() const {return Bf.Len();}
767 // void Clr(){Bf.Clr();}
768 // int AddStr(const TStr& Str){
769 // if (Str.Empty()){return -1;}
770 // else {int StrId=Bf.Len(); Bf+=Str; Bf+=char(0); return StrId;}}
771 // TStr GetStr(const int& StrId) const {
772 // if (StrId==-1){return "";}
773 // else {return TStr(Bf()+StrId);}}
774 //};
775 
777 // String-Pool
779 private:
780  uint MxBfL, BfL, GrowBy;
781  char *Bf;
782 private:
783  void Resize(const uint& _MxBfL);
784 public:
785  TStrPool(const uint& MxBfLen = 0, const uint& _GrowBy = 16*1024*1024);
786  TStrPool(TSIn& SIn, bool LoadCompact = true);
787  TStrPool(const TStrPool& Pool) : MxBfL(Pool.MxBfL), BfL(Pool.BfL), GrowBy(Pool.GrowBy) {
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; }
790 
791  static PStrPool New(const uint& _MxBfLen = 0, const uint& _GrowBy = 16*1024*1024) { return PStrPool(new TStrPool(_MxBfLen, _GrowBy)); }
792  static PStrPool New(TSIn& SIn) { return new TStrPool(SIn); }
793  static PStrPool New(const TStr& fileName) { PSIn SIn = TFIn::New(fileName); return new TStrPool(*SIn); }
794  static PStrPool Load(TSIn& SIn, bool LoadCompacted = true) { return PStrPool(new TStrPool(SIn, LoadCompacted)); }
795  void Save(TSOut& SOut) const;
796  void Save(const TStr& FNm){PSOut SOut=TFOut::New(FNm); Save(*SOut);}
797 
798  uint Len() const { return BfL; }
799  uint Size() const { return MxBfL; }
800  bool Empty() const { return ! Len(); }
801  char* operator () () const { return Bf; }
802  TStrPool& operator = (const TStrPool& Pool);
803  ::TSize GetMemUsed(){ return 4 * sizeof(int) + MxBfL;}
804 
805  uint AddStr(const char *Str, const uint& Len);
806  uint AddStr(const char *Str) { return AddStr(Str, uint(strlen(Str)) + 1); }
807  uint AddStr(const TStr& Str) { return AddStr(Str.CStr(), Str.Len() + 1); }
808 
809  TStr GetStr(const uint& Offset) const { Assert(Offset < BfL);
810  if (Offset == 0) return TStr::GetNullStr(); else return TStr(Bf + Offset); }
811  const char *GetCStr(const uint& Offset) const { Assert(Offset < BfL);
812  if (Offset == 0) return TStr::GetNullStr().CStr(); else return Bf + Offset; }
813 
814  // Clr() removes the empty string at the start.
815  // Call AddStr("") after Clr(), if you want to use the pool again.
816  void Clr(bool DoDel = false) { BfL = 0; if (DoDel && Bf) { free(Bf); Bf = 0; MxBfL = 0; } }
817  int Cmp(const uint& Offset, const char *Str) const { Assert(Offset < BfL);
818  if (Offset != 0) return strcmp(Bf + Offset, Str); else return strcmp("", Str); }
819 
820  static int GetPrimHashCd(const char *CStr);
821  static int GetSecHashCd(const char *CStr);
822  int GetPrimHashCd(const uint& Offset) { Assert(Offset < BfL);
823  if (Offset != 0) return GetPrimHashCd(Bf + Offset); else return GetPrimHashCd(""); }
824  int GetSecHashCd(const uint& Offset) { Assert(Offset < BfL);
825  if (Offset != 0) return GetSecHashCd(Bf + Offset); else return GetSecHashCd(""); }
826 };
827 
829 // String-Pool-64bit
831 private:
832  ::TSize MxBfL, BfL, GrowBy;
833  char *Bf;
834 private:
835  void Resize(const ::TSize& _MxBfL);
836 public:
837  TStrPool64(::TSize _MxBfL = 0, ::TSize _GrowBy = 16*1024*1024);
838  TStrPool64(const TStrPool64& StrPool);
839  TStrPool64(TSIn& SIn, bool LoadCompact = true);
840  ~TStrPool64() { Clr(true); }
841  void Save(TSOut& SOut) const;
842 
843  static PStrPool64 New(::TSize MxBfL = 0, ::TSize GrowBy = 16*1024*1024) {
844  return PStrPool64(new TStrPool64(MxBfL, GrowBy)); }
845  static PStrPool64 Load(TSIn& SIn, bool LoadCompact = true) {
846  return PStrPool64(new TStrPool64(SIn, LoadCompact)); }
847 
848  TStrPool64& operator=(const TStrPool64& StrPool);
849 
850  uint64 GetMemUsed() const { return 3*sizeof(::TSize) + uint64(MxBfL); }
851 
852  bool Empty() const { return (BfL == 0); }
853  uint64 Len() const {return BfL;}
854  uint64 Reserved() const { return MxBfL; }
855  void Clr(bool DoDel = false);
856  int Cmp(uint64 Offset, const char *Str) const { Assert(Offset < BfL);
857  if (Offset != 0) return strcmp(Bf + Offset, Str); else return strcmp("", Str); }
858 
859  uint64 AddStr(const TStr& Str);
860  TStr GetStr(const uint64& StrId) const;
861 };
862 
864 // Void
865 class TVoid{
866 public:
867  TVoid(){}
869  void Save(TSOut&) const {}
870  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
871  void SaveXml(TSOut& SOut, const TStr& Nm) const;
872 
873  TVoid& operator=(const TVoid&){return *this;}
874  bool operator==(const TVoid&) const {return true;}
875  bool operator<(const TVoid&) const {Fail; return false;}
876  int GetMemUsed() const {return sizeof(TVoid);}
877 };
878 
880 // Boolean
881 class TBool{
882 public:
883  bool Val;
884 public:
885  static const bool Mn;
886  static const bool Mx;
887  static const int Vals;
888  static TRnd Rnd;
889 
890  static const TStr FalseStr;
891  static const TStr TrueStr;
892  static const TStr NStr;
893  static const TStr YStr;
894  static const TStr NoStr;
895  static const TStr YesStr;
896 
897  TBool(): Val(false){}
898  TBool(const bool& _Val): Val(_Val){}
899  operator bool() const {return Val;}
900  explicit TBool(TSIn& SIn){SIn.Load(Val);}
901  void Load(TSIn& SIn){SIn.Load(Val);}
902  void Save(TSOut& SOut) const {SOut.Save(Val);}
903  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
904  void SaveXml(TSOut& SOut, const TStr& Nm) const;
905 
906  TBool& operator=(const TBool& Bool){Val=Bool.Val; return *this;}
907  bool operator==(const TBool& Bool) const {return Val==Bool.Val;}
908  bool operator<(const TBool& Bool) const {//return Val<Bool.Val;
909  return (Val==false)&&(Bool.Val==true);}
910  bool operator()() const {return Val;}
911  int GetMemUsed() const {return sizeof(TBool);}
912 
913  int GetPrimHashCd() const {return Val;}
914  int GetSecHashCd() const {return Val;}
915 
916  static bool GetRnd(){return Rnd.GetUniDevInt(2)==1;}
917 
918  static TStr GetStr(const bool& Val){
919  if (Val){return TrueStr;} else {return FalseStr;}}
920  static TStr GetStr(const TBool& Bool){
921  return GetStr(Bool.Val);}
922  static TStr GetYNStr(const bool& Val){
923  if (Val){return YStr;} else {return NStr;}}
924  static TStr GetYesNoStr(const bool& Val){
925  if (Val){return YesStr;} else {return NoStr;}}
926  static TStr Get01Str(const bool& Val){
927  if (Val){return "1";} else {return "0";}}
928  static bool IsValStr(const TStr& Str);
929  static bool GetValFromStr(const TStr& Str);
930  static bool GetValFromStr(const TStr& Str, const bool& DfVal);
931 };
932 
934 // Char
935 class TCh{
936 public:
937  char Val;
938 public:
939  static const char Mn;
940  static const char Mx;
941  static const int Vals;
942 
943  static const char NullCh;
944  static const char TabCh;
945  static const char LfCh;
946  static const char CrCh;
947  static const char EofCh;
948  static const char HashCh;
949 
950  TCh(): Val(TCh::NullCh){}
951  TCh(const char& _Val): Val(_Val){}
952  operator char() const {return Val;}
953  explicit TCh(TSIn& SIn){SIn.Load(Val);}
954  void Load(TSIn& SIn) {SIn.Load(Val);}
955  void Save(TSOut& SOut) const {SOut.Save(Val);}
956  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
957  void SaveXml(TSOut& SOut, const TStr& Nm) const;
958 
959  TCh& operator=(const TCh& Ch){Val=Ch.Val; return *this;}
960  bool operator==(const TCh& Ch) const {return Val==Ch.Val;}
961  bool operator<(const TCh& Ch) const {return Val<Ch.Val;}
962  char operator()() const {return Val;}
963  int GetMemUsed() const {return sizeof(TCh);}
964 
965  int GetPrimHashCd() const {return Val;}
966  int GetSecHashCd() const {return Val;}
967 
968  static bool IsHashCh(const char& Ch){
969  return (Ch==HashCh);}
970  static bool IsWs(const char& Ch){
971  return (Ch==' ')||(Ch==TabCh)||(Ch==CrCh)||(Ch==LfCh);}
972  static bool IsAlpha(const char& Ch){
973  return (('A'<=Ch)&&(Ch<='Z'))||(('a'<=Ch)&&(Ch<='z'));}
974  static bool IsNum(const char& Ch){return ('0'<=Ch)&&(Ch<='9');}
975  static bool IsAlNum(const char& Ch){return IsAlpha(Ch)||IsNum(Ch);}
976  static int GetNum(const char& Ch){Assert(IsNum(Ch)); return Ch-'0';}
977  static bool IsHex(const char& Ch){return
978  (('0'<=Ch)&&(Ch<='9'))||(('A'<=Ch)&&(Ch<='F'))||(('a'<=Ch)&&(Ch<='f'));}
979  static int GetHex(const char& Ch){
980  if (('0'<=Ch)&&(Ch<='9')){return Ch-'0';}
981  else if (('A'<=Ch)&&(Ch<='F')){return Ch-'A'+10;}
982  else if (('a'<=Ch)&&(Ch<='f')){return Ch-'a'+10;}
983  else Fail; return 0;}
984  static char GetHexCh(const int& Val){
985  if ((0<=Val)&&(Val<=9)){return char('0'+char(Val));}
986  else if ((10<=Val)&&(Val<=15)){return char('A'+char(Val-10));}
987  else Fail; return 0;}
988  static char IsUc(const char& Ch){
989  return ('A'<=Ch)&&(Ch<='Z');}
990  static char GetUc(const char& Ch){
991  if (('a'<=Ch)&&(Ch<='z')){return Ch-'a'+'A';} else {return Ch;}}
992  static char GetUsFromYuAscii(const char& Ch);
993 
994  static TStr GetStr(const TCh& Ch){
995  return TStr(Ch.Val);}
996 };
997 
999 // Unsigned-Char
1000 class TUCh{
1001 public:
1003 public:
1004  static const uchar Mn;
1005  static const uchar Mx;
1006  static const int Vals;
1007 
1008  TUCh(): Val(TCh::NullCh){}
1009  TUCh(const uchar& _Val): Val(_Val){}
1010  operator uchar() const {return Val;}
1011  explicit TUCh(TSIn& SIn){SIn.Load(Val);}
1012  void Save(TSOut& SOut) const {SOut.Save(Val);}
1013  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1014  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1015 
1016  TUCh& operator=(const TUCh& UCh){Val=UCh.Val; return *this;}
1017  bool operator==(const TUCh& UCh) const {return Val==UCh.Val;}
1018  bool operator<(const TUCh& UCh) const {return Val<UCh.Val;}
1019  uchar operator()() const {return Val;}
1020  int GetMemUsed() const {return sizeof(TUCh);}
1021 
1022  int GetPrimHashCd() const {return Val;}
1023  int GetSecHashCd() const {return Val;}
1024 };
1025 
1027 // Short-Integer
1028 class TSInt{
1029 public:
1031 public:
1032  TSInt(): Val(0){}
1033  TSInt(const int16& _Val): Val(_Val){}
1034  operator int16() const {return Val;}
1035  explicit TSInt(TSIn& SIn){SIn.Load(Val);}
1036  void Load(TSIn& SIn){SIn.Load(Val);}
1037  void Save(TSOut& SOut) const {SOut.Save(Val);}
1038  int GetPrimHashCd() const {return Val;}
1039  int GetSecHashCd() const {return Val/0x10;}
1040 };
1041 
1043 // Integer
1044 class TInt{
1045 public:
1046  int Val;
1047 public:
1048  static const int Mn;
1049  static const int Mx;
1050  static const int Kilo;
1051  static const int Mega;
1052  static const int Giga;
1053  static TRnd Rnd;
1054 
1055  TInt(): Val(0){}
1056  TInt(const int& _Val): Val(_Val){}
1057  operator int() const {return Val;}
1058  explicit TInt(TSIn& SIn){SIn.Load(Val);}
1059  void Load(TSIn& SIn){SIn.Load(Val);}
1060  void Save(TSOut& SOut) const {SOut.Save(Val);}
1061  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1062  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1063 
1064  TInt& operator=(const TInt& Int){Val=Int.Val; return *this;}
1065  TInt& operator=(const int& Int){Val=Int; return *this;}
1066  bool operator==(const TInt& Int) const {return Val==Int.Val;}
1067  bool operator==(const int& Int) const {return Val==Int;}
1068  bool operator!=(const int& Int) const {return Val!=Int;}
1069  bool operator<(const TInt& Int) const {return Val<Int.Val;}
1070  bool operator<(const int& Int) const {return Val<Int;}
1071  int operator()() const {return Val;}
1072  TInt& operator+=(const int& Int){Val+=Int; return *this;}
1073  TInt& operator-=(const int& Int){Val-=Int; return *this;}
1074  TInt operator++(int){Val++; return *this;}
1075  TInt operator--(int){Val--; return *this;}
1076  int GetMemUsed() const {return sizeof(TInt);}
1077 
1078  int GetPrimHashCd() const {return Val;}
1079  int GetSecHashCd() const {return Val/0x10;}
1080 
1081  static int Abs(const int& Int){return Int<0?-Int:Int;}
1082  static int Sign(const int& Int){return Int<0?-1:(Int>0?1:0);}
1083  static void Swap(int& Int1, int& Int2){
1084  int SwapInt1=Int1; Int1=Int2; Int2=SwapInt1;}
1085  static int GetRnd(const int& Range=0){return Rnd.GetUniDevInt(Range);}
1086 
1087  static bool IsOdd(const int& Int){return ((Int%2)==1);}
1088  static bool IsEven(const int& Int){return ((Int%2)==0);}
1089 
1090  static int GetMn(const int& Int1, const int& Int2){
1091  return Int1<Int2?Int1:Int2;}
1092  static int GetMx(const int& Int1, const int& Int2){
1093  return Int1>Int2?Int1:Int2;}
1094  static int GetMn(const int& Int1, const int& Int2, const int& Int3){
1095  return GetMn(Int1, GetMn(Int2, Int3));}
1096  static int GetMn(const int& Int1, const int& Int2,
1097  const int& Int3, const int& Int4){
1098  return GetMn(GetMn(Int1, Int2), GetMn(Int3, Int4));}
1099  static int GetMx(const int& Int1, const int& Int2, const int& Int3){
1100  return GetMx(Int1, GetMx(Int2, Int3));}
1101  static int GetMx(const int& Int1, const int& Int2,
1102  const int& Int3, const int& Int4){
1103  return GetMx(GetMx(Int1, Int2), GetMx(Int3, Int4));}
1104  static int GetInRng(const int& Val, const int& Mn, const int& Mx){
1105  IAssert(Mn<=Mx); return Val<Mn?Mn:(Val>Mx?Mx:Val);}
1106 
1107  TStr GetStr() const {return TInt::GetStr(Val);}
1108 
1109  static TStr GetStr(const int& Val){ return TStr::Fmt("%d", Val); }
1110  static TStr GetStr(const TInt& Int){ return GetStr(Int.Val);}
1111  static TStr GetStr(const int& Val, const char* FmtStr);
1112  static TStr GetStr(const int& Val, const TStr& FmtStr){ return GetStr(Val, FmtStr.CStr());}
1113 
1114  //J: So that TInt can convert any kind of integer to a string
1115  static TStr GetStr(const uint& Val){ return TStr::Fmt("%u", Val); }
1116  #ifdef GLib_WIN
1117  static TStr GetStr(const int64& Val) {return TStr::Fmt("%I64d", Val);}
1118  static TStr GetStr(const uint64& Val) {return TStr::Fmt("%I64u", Val);}
1119  #else
1120  static TStr GetStr(const int64& Val) {return TStr::Fmt("%lld", Val);}
1121  static TStr GetStr(const uint64& Val) {return TStr::Fmt("%llu", Val);}
1122  #endif
1123 
1124  static TStr GetHexStr(const int& Val){
1125  char Bf[255]; sprintf(Bf, "%X", Val); return TStr(Bf);}
1126  static TStr GetHexStr(const TInt& Int){
1127  return GetHexStr(Int.Val);}
1128 
1129  static TStr GetKiloStr(const int& Val){
1130  if (Val>=100*1000){return GetStr(Val/1000)+"K";}
1131  else if (Val>=1000){return GetStr(Val/1000)+"."+GetStr((Val%1000)/100)+"K";}
1132  else {return GetStr(Val);}}
1133  static TStr GetMegaStr(const int& Val){
1134  if (Val>=100*1000000){return GetStr(Val/1000000)+"M";}
1135  else if (Val>=1000000){
1136  return GetStr(Val/1000000)+"."+GetStr((Val%1000000)/100000)+"M";}
1137  else {return GetKiloStr(Val);}}
1138 
1139  // frugal
1140  static char* SaveFrugalInt(char *pDest, int i);
1141  static char* LoadFrugalInt(char *pSrc, int& i);
1142  static void TestFrugalInt();
1143  static void SaveFrugalIntV(TSOut& SOut, const TVec<TInt, int>& IntV);
1144  static void LoadFrugalIntV(TSIn& SIn, TVec<TInt, int>& IntV, bool ClrP=true);
1145 };
1146 
1148 // Unsigned-Integer
1149 class TUInt{
1150 public:
1152 public:
1153  static const uint Mn;
1154  static const uint Mx;
1155  static TRnd Rnd;
1156 
1157  TUInt(): Val(0){}
1158  TUInt(const uint& _Val): Val(_Val){}
1159  operator uint() const {return Val;}
1160  explicit TUInt(TSIn& SIn){SIn.Load(Val);}
1161  void Load(TSIn& SIn){SIn.Load(Val);}
1162  void Save(TSOut& SOut) const {SOut.Save(Val);}
1163  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1164  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1165 
1166  TUInt& operator=(const TUInt& UInt){Val=UInt.Val; return *this;}
1167  TUInt& operator=(const uint& _Val){Val=_Val; return *this;}
1168  TUInt operator++(int){Val++; return *this;}
1169  TUInt operator--(int){Val--; return *this;}
1170  //bool operator==(const TUInt& UInt) const {return Val==UInt.Val;}
1171  //bool operator==(const uint& UInt) const {return Val==UInt;}
1172  //bool operator!=(const uint& UInt) const {return Val!=UInt;}
1173  //bool operator<(const TUInt& UInt) const {return Val<UInt.Val;}
1174  uint operator()() const {return Val;}
1175  uint& operator()() {return Val;}
1176  TUInt& operator~(){Val=~Val; return *this;}
1177  TUInt& operator&=(const TUInt& UInt){Val&=UInt.Val; return *this;}
1178  TUInt& operator|=(const TUInt& UInt){Val|=UInt.Val; return *this;}
1179  TUInt& operator^=(const TUInt& UInt){Val^=UInt.Val; return *this;}
1180  TUInt& operator>>=(const int& ShiftBits){Val>>=ShiftBits; return *this;}
1181  TUInt& operator<<=(const int& ShiftBits){Val<<=ShiftBits; return *this;}
1182  int GetMemUsed() const {return sizeof(TUInt);}
1183 
1184  int GetPrimHashCd() const {return int(Val);}
1185  int GetSecHashCd() const {return Val/0x10;}
1186 
1187  static uint GetRnd(const uint& Range=0){return Rnd.GetUniDevUInt(Range);}
1188 
1189  TStr GetStr() const {return TUInt::GetStr(Val);}
1190  static TStr GetStr(const uint& Val){
1191  char Bf[255]; sprintf(Bf, "%u", Val); return TStr(Bf);}
1192  static TStr GetStr(const TUInt& UInt){
1193  return GetStr(UInt.Val);}
1194  static TStr GetStr(const uint& Val, const char* FmtStr);
1195  static TStr GetStr(const uint& Val, const TStr& FmtStr){
1196  return GetStr(Val, FmtStr.CStr());}
1197 
1198  static TStr GetKiloStr(const uint& Val){
1199  if (Val>100*1000){return GetStr(Val/1000)+"K";}
1200  else if (Val>1000){return GetStr(Val/1000)+"."+GetStr((Val%1000)/100)+"K";}
1201  else {return GetStr(Val);}}
1202  static TStr GetMegaStr(const uint& Val){
1203  if (Val>100*1000000){return GetStr(Val/1000000)+"M";}
1204  else if (Val>1000000){
1205  return GetStr(Val/1000000)+"."+GetStr((Val%1000000)/100000)+"M";}
1206  else {return GetKiloStr(Val);}}
1207 
1208  static uint JavaUIntToCppUInt(const uint& JavaUInt){
1209  uint B1=(JavaUInt & 0xFF000000) >> 24;
1210  uint B2=(JavaUInt & 0x00FF0000) >> 16;
1211  uint B3=(JavaUInt & 0x0000FF00) >> 8;
1212  uint B4=(JavaUInt & 0x000000FF) >> 0;
1213  uint CppUInt=(B4<<24)+(B3<<16)+(B2<<8)+(B1<<0);
1214  return CppUInt;}
1215 
1216  static bool IsIpStr(const TStr& IpStr, uint& Ip, const char& SplitCh = '.');
1217  static bool IsIpStr(const TStr& IpStr, const char& SplitCh = '.') { uint Ip; return IsIpStr(IpStr, Ip, SplitCh); }
1218  static uint GetUIntFromIpStr(const TStr& IpStr, const char& SplitCh = '.');
1219  static TStr GetStrFromIpUInt(const uint& Ip);
1220  static bool IsIpv6Str(const TStr& IpStr, const char& SplitCh = ':');
1221 };
1222 
1224 // Unsigned-Integer-64Bit
1225 class TUInt64{
1226 public:
1228 public:
1229  static const TUInt64 Mn;
1230  static const TUInt64 Mx;
1231 
1232  TUInt64(): Val(0){}
1233  TUInt64(const TUInt64& Int): Val(Int.Val){}
1234  TUInt64(const uint64& Int): Val(Int){}
1235  TUInt64(const uint& MsVal, const uint& LsVal): Val(0){
1236  Val=(((uint64)MsVal) << 32) | ((uint64)LsVal);}
1237  explicit TUInt64(void* Pt): Val(0){
1238  TConv_Pt64Ints32 Conv(Pt); Val=Conv.GetUInt64();}
1239  operator uint64() const {return Val;}
1240  explicit TUInt64(TSIn& SIn){SIn.Load(Val);}
1241  void Load(TSIn& SIn){SIn.Load(Val);}
1242  void Save(TSOut& SOut) const {SOut.Save(Val);}
1243  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1244  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1245 
1246  TUInt64& operator=(const TUInt64& Int){Val=Int.Val; return *this;}
1247  TUInt64& operator+=(const TUInt64& Int){Val+=Int.Val; return *this;}
1248  TUInt64& operator-=(const TUInt64& Int){Val-=Int.Val; return *this;}
1249  TUInt64& operator*=(const TUInt64& Int){Val*=Int.Val; return *this;}
1250  TUInt64 operator++(int){Val++; return *this;}
1251  TUInt64 operator--(int){Val--; return *this;}
1252  int GetMemUsed() const {return sizeof(TUInt64);}
1253 
1254  int GetPrimHashCd() const { return (int)GetMsVal() + (int)GetLsVal(); } //TODO: to check
1255  int GetSecHashCd() const { return ((int)GetMsVal() + (int)GetLsVal()) / 0x10; } //TODO: to check
1256 
1257  uint GetMsVal() const {
1258  return (uint)(Val >> 32);}
1259  uint GetLsVal() const {
1260  return (uint)(Val & 0xffffffff);}
1261 
1262  //TStr GetStr() const {return TStr::Fmt("%Lu", Val);}
1263  //static TStr GetStr(const TUInt64& Int){return TStr::Fmt("%Lu", Int.Val);}
1264  //static TStr GetHexStr(const TUInt64& Int){return TStr::Fmt("%LX", Int.Val);}
1265  #ifdef GLib_WIN
1266  TStr GetStr() const {return TStr::Fmt("%I64u", Val);}
1267  static TStr GetStr(const TUInt64& Int){return TStr::Fmt("%I64u", Int.Val);}
1268  static TStr GetHexStr(const TUInt64& Int){return TStr::Fmt("%I64X", Int.Val);}
1269  #else
1270  TStr GetStr() const {return TStr::Fmt("%llu", Val);}
1271  static TStr GetStr(const TUInt64& Int){return TStr::Fmt("%llu", Int.Val);}
1272  static TStr GetHexStr(const TUInt64& Int){return TStr::Fmt("%llX", Int.Val);}
1273  #endif
1274 
1275  static TStr GetKiloStr(const uint64& Val){
1276  if (Val>100*1000){return GetStr(Val/1000)+"K";}
1277  else if (Val>1000){return GetStr(Val/1000)+"."+GetStr((Val%1000)/100)+"K";}
1278  else {return GetStr(Val);}}
1279  static TStr GetMegaStr(const uint64& Val){
1280  if (Val>100*1000000){return GetStr(Val/1000000)+"M";}
1281  else if (Val>1000000){
1282  return GetStr(Val/1000000)+"."+GetStr((Val%1000000)/100000)+"M";}
1283  else {return GetKiloStr(Val);}}
1284  /*static TStr GetGigaStr(const uint64& Val){
1285  if (Val>100*1000000000){return GetStr(Val/1000000000)+"G";}
1286  else if (Val>1000000000){
1287  return GetStr(Val/1000000000)+"."+GetStr((Val%1000000000)/100000000)+"G";}
1288  else {return GetMegaStr(Val);}}*/
1289 };
1290 
1292 // Float
1293 class TFlt{
1294 public:
1295  double Val;
1296 public:
1297  static const double Mn;
1298  static const double Mx;
1299  static const double NInf;
1300  static const double PInf;
1301  static const double Eps;
1302  static const double EpsHalf;
1303  static TRnd Rnd;
1304 
1305  TFlt(): Val(0){}
1306  TFlt(const double& _Val): Val(_Val){}
1307  operator double() const {return Val;}
1308  explicit TFlt(TSIn& SIn){SIn.Load(Val);}
1309  void Save(TSOut& SOut) const {SOut.Save(Val);}
1310  explicit TFlt(TSIn& SIn, const bool& IsTxt){
1311  if (IsTxt){TStr Str(SIn, true); Val=Str.GetFlt(0);} else {SIn.Load(Val);}}
1312  void Load(TSIn& SIn){SIn.Load(Val);}
1313  void Save(TSOut& SOut, const bool& IsTxt) const {
1314  if (IsTxt){GetStr(Val).Save(SOut, true);} else {SOut.Save(Val);}}
1315  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1316  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1317 
1318  TFlt& operator=(const TFlt& Flt){Val=Flt.Val; return *this;}
1319  TFlt& operator=(const double& Flt){Val=Flt; return *this;}
1320  bool operator==(const TFlt& Flt) const _CMPWARN {return Val==Flt.Val;}
1321  bool operator==(const double& Flt) const _CMPWARN {return Val==Flt;}
1322  bool operator!=(const double& Flt) const _CMPWARN {return Val!=Flt;}
1323  double operator()() const {return Val;}
1324  TFlt& operator+=(const double& Flt){Val+=Flt; return *this;}
1325  TFlt& operator-=(const double& Flt){Val-=Flt; return *this;}
1326  TFlt& operator*=(const double& Flt){Val*=Flt; return *this;}
1327  TFlt& operator/=(const double& Flt){Val/=Flt; return *this;}
1328  TFlt operator++(int){Val++; return *this;}
1329  TFlt operator--(int){Val--; return *this;}
1330  int GetMemUsed() const {return sizeof(TFlt);}
1331 
1332  int GetPrimHashCd() const {
1333  int Expn; return int((frexp(Val, &Expn)-0.5)*double(TInt::Mx));}
1334  int GetSecHashCd() const {
1335  int Expn; frexp(Val, &Expn); return Expn;}
1336 
1337  static double Abs(const double& Flt){return Flt<0?-Flt:Flt;}
1338  static int Sign(const double& Flt){return Flt<0?-1:(Flt>0?1:0);}
1339  static int Round(const double& Flt){return int(floor(Flt+0.5));}
1340  static double GetRnd(){return Rnd.GetUniDev();}
1341  static bool Eq6(const double& LFlt, const double& RFlt){
1342  return fabs(LFlt-RFlt)<0.000001;}
1343 
1344  static double GetMn(const double& Flt1, const double& Flt2){
1345  return Flt1<Flt2?Flt1:Flt2;}
1346  static double GetMn(const double& Flt1, const double& Flt2, const double& Flt3){
1347  return GetMn(GetMn(Flt1, Flt2), Flt3); }
1348  static double GetMn(const double& Flt1, const double& Flt2, const double& Flt3, const double& Flt4){
1349  return GetMn(GetMn(Flt1, Flt2), GetMn(Flt3, Flt4)); }
1350 
1351  static double GetMx(const double& Flt1, const double& Flt2){
1352  return Flt1>Flt2?Flt1:Flt2;}
1353  static double GetMx(const double& Flt1, const double& Flt2, const double Flt3){
1354  return GetMx(GetMx(Flt1, Flt2), Flt3); }
1355  static double GetMx(const double& Flt1, const double& Flt2, const double Flt3, const double& Flt4){
1356  return GetMx(GetMx(Flt1, Flt2), GetMx(Flt3, Flt4)); }
1357 
1358  static double GetInRng(const double& Val, const double& Mn, const double& Mx){
1359  IAssert(Mn<=Mx); return Val<Mn?Mn:(Val>Mx?Mx:Val);}
1360 
1361  static bool IsNum(const double& Val){
1362  return (Mn<=Val)&&(Val<=Mx);}
1363  static bool IsNan(const double& Val){
1364  return (Val!=Val);}
1365 
1366  bool IsNum() const { return IsNum(Val); }
1367  bool IsNan() const { return IsNan(Val); }
1368 
1369  TStr GetStr() const {return TFlt::GetStr(Val);}
1370  static TStr GetStr(const double& Val, const int& Width=-1, const int& Prec=-1);
1371  static TStr GetStr(const TFlt& Flt, const int& Width=-1, const int& Prec=-1){
1372  return GetStr(Flt.Val, Width, Prec);}
1373  static TStr GetStr(const double& Val, const char* FmtStr);
1374  static TStr GetStr(const double& Val, const TStr& FmtStr){
1375  return GetStr(Val, FmtStr.CStr());}
1376  static TStr GetPrcStr(const double& RelVal, const double& FullVal){
1377  return GetStr(100*RelVal/FullVal, "%3.0f%%");}
1378 
1379  static TStr GetKiloStr(const double& Val){
1380  if (fabs(Val)>100*1000){return TStr::Fmt("%.0fK", Val/1000);}
1381  else if (fabs(Val)>1000){return TStr::Fmt("%.1fK", Val/1000);}
1382  else {return TStr::Fmt("%.0f", Val);}}
1383  static TStr GetMegaStr(const double& Val){
1384  if (fabs(Val)>100*1000000){return TStr::Fmt("%.0fM", Val/1000000);}
1385  else if (fabs(Val)>1000000){return TStr::Fmt("%.1fM", Val/1000000);}
1386  else {return GetKiloStr(Val);}}
1387  static TStr GetGigaStr(const double& Val){
1388  if (fabs(Val)>100*1000000000.0){return TStr::Fmt("%.0fG", Val/1000000000.0);}
1389  else if (fabs(Val)>1000000000.0){return TStr::Fmt("%.1fG", Val/1000000000.0);}
1390  else {return GetMegaStr(Val);}}
1391 };
1392 
1394 // Ascii-Float
1395 class TAscFlt: public TFlt{
1396 public:
1397  TAscFlt(): TFlt(){}
1398  TAscFlt(const double& Val): TFlt(Val){}
1399  explicit TAscFlt(TSIn& SIn): TFlt(SIn, true){}
1400  void Save(TSOut& SOut) const {TFlt::Save(SOut, true);}
1401 };
1402 
1404 // Short-Float
1405 class TSFlt{
1406 public:
1408 public:
1409  static const sdouble Mn;
1410  static const sdouble Mx;
1411 
1412  TSFlt(): Val(0){}
1413  TSFlt(const sdouble& _Val): Val(sdouble(_Val)){}
1414  //TSFlt(const double& _Val): Val(sdouble(_Val)){}
1415  operator sdouble() const {return Val;}
1416  //operator double() const {return Val;}
1417  explicit TSFlt(TSIn& SIn){SIn.Load(Val);}
1418  void Save(TSOut& SOut) const {SOut.Save(Val);}
1419  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1420  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1421 
1422  TSFlt& operator=(const TSFlt& SFlt){Val=SFlt.Val; return *this;}
1423  bool operator==(const TSFlt& SFlt) const _CMPWARN {return Val==SFlt.Val;}
1424  bool operator==(const double& Flt) const _CMPWARN {return Val==Flt;}
1425  bool operator!=(const double& Flt) const _CMPWARN {return Val!=Flt;}
1426  bool operator<(const TSFlt& SFlt) const {return Val<SFlt.Val;}
1427  sdouble operator()() const {return Val;}
1428  TSFlt& operator+=(const double& SFlt){Val+=sdouble(SFlt); return *this;}
1429  TSFlt& operator-=(const double& SFlt){Val-=sdouble(SFlt); return *this;}
1430  TSFlt& operator*=(const double& SFlt){Val*=sdouble(SFlt); return *this;}
1431  TSFlt& operator/=(const double& SFlt){Val/=sdouble(SFlt); return *this;}
1432  TSFlt operator++(int){Val++; return *this;}
1433  TSFlt operator--(int){Val--; return *this;}
1434  int GetMemUsed() const {return sizeof(TSFlt);}
1435 
1436  int GetPrimHashCd() const {
1437  int Expn; return int((frexp(Val, &Expn)-0.5)*double(TInt::Mx));}
1438  int GetSecHashCd() const {
1439  int Expn; frexp(Val, &Expn); return Expn;}
1440 };
1441 
1443 // Long-Float
1444 class TLFlt{
1445 public:
1447 public:
1448  static const ldouble Mn;
1449  static const ldouble Mx;
1450 
1451  TLFlt(): Val(0){}
1452  TLFlt(const ldouble& _Val): Val(_Val){}
1453  operator ldouble() const {return Val;}
1454  explicit TLFlt(TSIn& SIn){SIn.Load(Val);}
1455  void Save(TSOut& SOut) const {SOut.Save(Val);}
1456  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1457  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1458 
1459  TLFlt& operator=(const TLFlt& LFlt){Val=LFlt.Val; return *this;}
1460  bool operator==(const TLFlt& LFlt) const _CMPWARN {return Val==LFlt.Val;}
1461  bool operator==(const ldouble& LFlt) const _CMPWARN {return Val==LFlt;}
1462  bool operator!=(const ldouble& LFlt) const _CMPWARN {return Val!=LFlt;}
1463  bool operator<(const TLFlt& LFlt) const {return Val<LFlt.Val;}
1464  ldouble operator()() const {return Val;}
1465  TLFlt& operator+=(const ldouble& LFlt){Val+=LFlt; return *this;}
1466  TLFlt& operator-=(const ldouble& LFlt){Val-=LFlt; return *this;}
1467  int GetMemUsed() const {return sizeof(TLFlt);}
1468 
1469  int GetPrimHashCd() const {Fail; return 0;}
1470  int GetSecHashCd() const {Fail; return 0;}
1471 
1472  static TStr GetStr(const ldouble& Val, const int& Width=-1, const int& Prec=-1);
1473  static TStr GetStr(const TLFlt& LFlt, const int& Width=-1, const int& Prec=-1){
1474  return GetStr(LFlt.Val, Width, Prec);}
1475  static TStr GetStr(const ldouble& Val, const char* FmtStr);
1476  static TStr GetStr(const ldouble& Val, const TStr& FmtStr){
1477  return GetStr(Val, FmtStr.CStr());}
1478 };
1479 
1481 // Float-Rectangle
1482 class TFltRect{
1483 public:
1485 public:
1487  MnX(), MnY(), MxX(), MxY(){}
1488  TFltRect(const TFltRect& FltRect):
1489  MnX(FltRect.MnX), MnY(FltRect.MnY), MxX(FltRect.MxX), MxY(FltRect.MxY){}
1491  const double& _MnX, const double& _MnY,
1492  const double& _MxX, const double& _MxY):
1493  MnX(_MnX), MnY(_MnY), MxX(_MxX), MxY(_MxY){}
1495  MnX(SIn), MnY(SIn), MxX(SIn), MxY(SIn){}
1496  void Save(TSOut& SOut) const {
1497  MnX.Save(SOut); MnY.Save(SOut); MxX.Save(SOut); MxY.Save(SOut);}
1498  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1499  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1500 
1501  TFltRect& operator=(const TFltRect& FltRect){
1502  MnX=FltRect.MnX; MnY=FltRect.MnY; MxX=FltRect.MxX; MxY=FltRect.MxY;
1503  return *this;}
1504 
1505  // get coordinates
1506  double GetMnX() const {return MnX;}
1507  double GetMnY() const {return MnY;}
1508  double GetMxX() const {return MxX;}
1509  double GetMxY() const {return MxY;}
1510 
1511  // get lengths
1512  double GetXLen() const {return MxX-MnX;}
1513  double GetYLen() const {return MxY-MnY;}
1514 
1515  // get centers
1516  double GetXCenter() const {return MnX+(MxX-MnX)/2;}
1517  double GetYCenter() const {return MnY+(MxY-MnY)/2;}
1518 
1519  // tests
1520  bool IsXYIn(const double& X, const double& Y) const {
1521  return (MnX<=X)&&(X<=MxX)&&(MnY<=Y)&&(Y<=MxY);}
1522  static bool Intersection(const TFltRect& Rect1, const TFltRect& Rect2);
1523 
1524  // string
1525  TStr GetStr() const;
1526 };
1527 
TSFlt & operator/=(const double &SFlt)
Definition: dt.h:1431
#define IAssert(Cond)
Definition: bd.h:262
TChAIn & operator=(const TChAIn &)
int GetPrimHashCd() const
Definition: dt.h:1078
static int CmpI(const char *CStr1, const char *CStr2)
Definition: dt.cpp:699
bool operator==(const double &Flt) const _CMPWARN
Definition: dt.h:1321
static bool IsHex(const char &Ch)
Definition: dt.h:977
int GetInt() const
Definition: dt.h:578
Definition: bd.h:514
char * GetCStr() const
Definition: dt.h:685
bool IsUInt() const
Definition: dt.h:585
bool operator==(const TDbStr &DbStr) const
Definition: dt.h:736
TStr(const PSIn &SIn)
Definition: dt.h:432
bool IsLc() const
Definition: dt.cpp:672
void Load(TSIn &SIn, const bool &IsSmall=false)
Definition: dt.h:438
static TStr PutFExtIfEmpty(const TStr &FNm, const TStr &FExt)
Definition: dt.cpp:1503
TUInt operator++(int)
Definition: dt.h:1168
TStr(const char &Ch, bool)
Definition: dt.h:416
TFlt & operator*=(const double &Flt)
Definition: dt.h:1326
void Save(TSOut &SOut) const
Definition: dt.h:1400
int SearchCh(const char &Ch, const int &BChN=0) const
Definition: dt.cpp:1043
static TStr GetHexStr(const int &Val)
Definition: dt.h:1124
TStr GetFromHex() const
Definition: dt.h:514
int GetBf(const void *LBf, const TSize &LBfL)
Definition: dt.cpp:1646
TRStr * RStr
Definition: dt.h:414
static const double NInf
Definition: dt.h:1299
ldouble operator()() const
Definition: dt.h:1464
TMemOut(const PMem &_Mem)
Definition: dt.cpp:334
TUInt()
Definition: dt.h:1157
static TStr GetPrcStr(const double &RelVal, const double &FullVal)
Definition: dt.h:1376
void Randomize()
Definition: dt.h:60
TStr GetSubStr(const int &BChN) const
Definition: dt.h:517
char GetCh()
Definition: dt.h:173
TLFlt & operator=(const TLFlt &LFlt)
Definition: dt.h:1459
TUInt64 operator--(int)
Definition: dt.h:1251
void Gen(const int &_BfL)
Definition: dt.h:123
char * CStr()
Definition: bd.h:531
static double GetMx(const double &Flt1, const double &Flt2, const double Flt3, const double &Flt4)
Definition: dt.h:1355
static PMem New(const PMem &Mem)
Definition: dt.h:96
static const uint Mn
Definition: dt.h:1153
TStr GetStr() const
Definition: dt.h:1107
#define IAssertR(Cond, Reason)
Definition: bd.h:265
static const int Kilo
Definition: dt.h:1050
static TStr GetSpaceStr(const int &Spaces)
Definition: dt.cpp:1608
char Pop()
Definition: dt.h:139
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:1910
static const int r
Definition: dt.h:15
int GetSecHashCd() const
Definition: dt.h:966
bool IsInt64() const
Definition: dt.h:593
TLFlt(const ldouble &_Val)
Definition: dt.h:1452
TStr(const TChA &ChA)
Definition: dt.h:425
TSFlt(TSIn &SIn)
Definition: dt.h:1417
uint GetLsVal() const
Definition: dt.h:1259
static PSOut New(const TStr &FNm, const bool &Append=false)
Definition: fl.cpp:442
static uint JavaUIntToCppUInt(const uint &JavaUInt)
Definition: dt.h:1208
int Len() const
Definition: dt.h:487
void ToLc()
Definition: dt.cpp:679
const char * CStr() const
Definition: dt.h:381
#define ClassHdTP(TNm, PNm)
Definition: bd.h:135
TStr GetFMid() const
Definition: dt.cpp:1403
bool operator==(const char *_CStr) const
Definition: dt.h:233
bool Eof()
Definition: dt.h:335
void Resize(const int &_MxBfL)
Definition: dt.cpp:348
void Reset()
Definition: dt.h:176
static TStr GetHexStr(const TUInt64 &Int)
Definition: dt.h:1272
void Save(TSOut &SOut) const
Definition: dt.h:732
int GetPrimHashCd() const
Definition: dt.h:965
TStr Right(const int &BChN) const
Definition: dt.h:545
TRStr()
Definition: dt.h:351
bool operator!=(const char *_CStr) const
Definition: dt.h:236
TUCh(TSIn &SIn)
Definition: dt.h:1011
static TStr GetMegaStr(const int &Val)
Definition: dt.h:1133
void Save(TSOut &SOut) const
Definition: dt.h:1496
void SaveMem(const PSOut &SOut) const
Definition: dt.h:153
static void LoadTxt(const PSIn &SIn, TChA &ChA)
Definition: dt.cpp:616
bool IsHexInt64(int64 &Val) const
Definition: dt.h:617
TStr & FromHex()
Definition: dt.cpp:798
int64 GetUniDevInt64(const int64 &Range=0)
Definition: dt.cpp:51
void Ins(const int &BChN, const char *CStr)
Definition: dt.cpp:407
double GetMnY() const
Definition: dt.h:1507
static TStr GetStr(const uint64 &Val)
Definition: dt.h:1121
static int GetInRng(const int &Val, const int &Mn, const int &Mx)
Definition: dt.h:1104
int GetNextSeed()
Definition: dt.h:17
static TStr GetKiloStr(const uint64 &Val)
Definition: dt.h:1275
static bool IsNum(const char &Ch)
Definition: dt.h:974
int BfC
Definition: dt.h:701
bool IsPrefix(const char *Str) const
Definition: dt.cpp:1081
static PSIn New(const TChA &ChA)
Definition: dt.h:332
Definition: dt.h:11
TStr & operator+=(const char *CStr)
Definition: dt.h:457
Definition: dt.h:1482
TSInt(TSIn &SIn)
Definition: dt.h:1035
static const sdouble Mn
Definition: dt.h:1409
static PStrPool Load(TSIn &SIn, bool LoadCompacted=true)
Definition: dt.h:794
bool IsFlt() const
Definition: dt.h:627
static TStr GetStr(const int &Val, const TStr &FmtStr)
Definition: dt.h:1112
TSFlt & operator-=(const double &SFlt)
Definition: dt.h:1429
static const TStr NoStr
Definition: dt.h:894
TStr(const char &Ch1, const char &Ch2, bool)
Definition: dt.h:418
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:2280
static TStr GetStrFromIpUInt(const uint &Ip)
Definition: dt.cpp:2117
static int GetMn(const int &Int1, const int &Int2, const int &Int3, const int &Int4)
Definition: dt.h:1096
TStr GetFPath() const
Definition: dt.cpp:1389
TFltRect & operator=(const TFltRect &FltRect)
Definition: dt.h:1501
static PSIn New(const TMem &Mem)
Definition: dt.h:165
void Del(const int &ChN)
Definition: dt.cpp:414
int GetPrimHashCd() const
Definition: dt.cpp:709
bool IsHexInt64() const
Definition: dt.h:618
int Val
Definition: dt.h:1046
sdouble Val
Definition: dt.h:1407
static const uint Mx
Definition: dt.h:1154
static TRnd Rnd
Definition: dt.h:888
int SearchChBack(const char &Ch, int BChN=-1) const
Definition: dt.cpp:1053
long double ldouble
Definition: bd.h:16
char * Bf
Definition: dt.h:80
static TRnd LoadTxt(TILx &Lx)
Definition: dt.cpp:215
uint64 GetUInt64() const
Definition: bd.h:558
TFlt & operator/=(const double &Flt)
Definition: dt.h:1327
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:1833
void Save(TSOut &SOut) const
Definition: dt.h:1060
bool IsFlt(double &Val) const
Definition: dt.h:626
static double GetMx(const double &Flt1, const double &Flt2)
Definition: dt.h:1351
bool operator!=(const char *CStr) const
Definition: dt.h:467
TDbStr(const TStr &_Str1, const TStr &_Str2)
Definition: dt.h:730
void FlushBf()
bool IsLc() const
Definition: dt.h:497
int Len() const
Definition: dt.h:134
TUCh(const uchar &_Val)
Definition: dt.h:1009
unsigned int uint
Definition: bd.h:11
bool IsXYIn(const double &X, const double &Y) const
Definition: dt.h:1520
TMem & operator=(const TMem &Mem)
Definition: dt.h:108
bool IsHexInt() const
Definition: dt.h:610
PSIn GetSIn(const bool &IsCut=true, const int &CutBfL=-1)
Definition: fl.cpp:825
static TStr GetStr(const double &Val, const TStr &FmtStr)
Definition: dt.h:1374
static TStr GetStr(const TUInt64 &Int)
Definition: dt.h:1271
static int GetMx(const int &Int1, const int &Int2)
Definition: dt.h:1092
TUInt64(const TUInt64 &Int)
Definition: dt.h:1233
static const int RndSeed
Definition: dt.h:13
bool operator==(const TChA &ChA) const
Definition: dt.h:232
bool Empty() const
Definition: dt.h:260
static const int Mx
Definition: dt.h:1049
TRnd(TSIn &SIn)
Definition: dt.h:22
#define Fail
Definition: bd.h:238
bool operator!=(const double &Flt) const _CMPWARN
Definition: dt.h:1425
bool EqI(const TStr &Str) const
Definition: dt.h:495
TStr(const TStr &Str)
Definition: dt.h:424
bool operator!=(const ldouble &LFlt) const _CMPWARN
Definition: dt.h:1462
void ToCap()
Definition: dt.cpp:685
const char * GetCStr(const uint &Offset) const
Definition: dt.h:811
TPt< TStrPool64 > PStrPool64
Definition: dt.h:830
int BfL
Definition: dt.h:325
TStr GetUc() const
Definition: dt.h:493
static const char NullCh
Definition: dt.h:943
static bool IsHashCh(const char &Ch)
Definition: dt.h:968
static char * SaveFrugalInt(char *pDest, int i)
Definition: dt.cpp:1954
TSFlt & operator*=(const double &SFlt)
Definition: dt.h:1430
void PutCh(const int &ChN, const char &Ch)
Definition: dt.h:278
static char GetHexCh(const int &Val)
Definition: dt.h:984
TFlt(TSIn &SIn)
Definition: dt.h:1308
TStr Str2
Definition: dt.h:725
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:1923
static PMem New(const TMem &Mem)
Definition: dt.h:95
void Clr()
Definition: dt.h:258
void Load(TSIn &SIn)
Definition: dt.h:901
void Save(TSOut &SOut) const
Definition: dt.h:1012
double Val
Definition: dt.h:1295
void AddCh(const char &Ch, const int &MxLen=-1)
Definition: dt.h:271
int GetUniDevInt(const int &MnVal, const int &MxVal)
Definition: dt.h:32
TVoid & operator=(const TVoid &)
Definition: dt.h:873
static const double EpsHalf
Definition: dt.h:1302
TUInt64 operator++(int)
Definition: dt.h:1250
TCh(const char &_Val)
Definition: dt.h:951
bool IsPrefix(const TStr &Str) const
Definition: dt.h:556
int GetPrimHashCd() const
Definition: dt.h:1469
TFlt & operator=(const double &Flt)
Definition: dt.h:1319
static PStrPool New(const uint &_MxBfLen=0, const uint &_GrowBy=16 *1024 *1024)
Definition: dt.h:791
bool IsChIn(const char &Ch) const
Definition: dt.h:300
static bool IsNum(const double &Val)
Definition: dt.h:1361
static void SaveFrugalIntV(TSOut &SOut, const TVec< TInt, int > &IntV)
Definition: dt.cpp:2018
static TStr GetMegaStr(const double &Val)
Definition: dt.h:1383
TInt & operator-=(const int &Int)
Definition: dt.h:1073
uint Size() const
Definition: dt.h:799
int GetPrimHashCd() const
Definition: dt.h:569
TRStr(const char *CStr, const int &MxLen)
Definition: dt.h:356
static TStr GetYesNoStr(const bool &Val)
Definition: dt.h:924
TUCh & operator=(const TUCh &UCh)
Definition: dt.h:1016
uint64 GetUniDevUInt64(const uint64 &Range=0)
Definition: dt.cpp:57
bool Empty() const
Definition: dt.h:748
TInt operator--(int)
Definition: dt.h:1075
void Save(TSOut &SOut) const
Definition: dt.h:1037
static const bool Mx
Definition: dt.h:886
TSFlt()
Definition: dt.h:1412
int CmpI(const TStr &Str) const
Definition: dt.h:494
static PSOut New(const PMem &Mem)
Definition: dt.h:189
void DelChAll(const char &Ch)
Definition: dt.cpp:840
TChA & operator+=(const char &Ch)
Definition: dt.h:244
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:14
TUInt64(const uint64 &Int)
Definition: dt.h:1234
virtual int GetBf(const void *Bf, const TSize &BfL)=0
static int GetHex(const char &Ch)
Definition: dt.h:979
double GetMxY() const
Definition: dt.h:1509
double GetRayleigh(const double &Sigma)
Definition: dt.h:50
TStr(const TMem &Mem)
Definition: dt.h:429
const char * Bf
Definition: dt.h:161
static TStr GetNrFMid(const TStr &FMid)
Definition: dt.cpp:1445
int Len() const
Definition: dt.h:259
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
bool DelStr(const TStr &Str)
Definition: dt.cpp:863
int GetBf(const void *LBf, const TSize &LBfL)
Definition: dt.cpp:318
TFlt & operator+=(const double &Flt)
Definition: dt.h:1324
TDbStr & operator=(const TDbStr &DbStr)
Definition: dt.h:734
static bool GetRnd()
Definition: dt.h:916
static TStr GetNrFNm(const TStr &FNm)
Definition: dt.cpp:1467
TStr & ToHex()
Definition: dt.cpp:785
void Save(TSOut &SOut) const
Definition: dt.h:902
TUInt & operator|=(const TUInt &UInt)
Definition: dt.h:1178
int Cmp(uint64 Offset, const char *Str) const
Definition: dt.h:856
int GetSecHashCd() const
Definition: dt.h:570
int GetMemUsed() const
Definition: dt.h:963
int SearchStr(const TChA &Str, const int &BChN=0) const
Definition: dt.cpp:485
static bool IsIpv6Str(const TStr &IpStr, const char &SplitCh= ':')
Definition: dt.cpp:2122
sdouble operator()() const
Definition: dt.h:1427
static double GetMn(const double &Flt1, const double &Flt2, const double &Flt3)
Definition: dt.h:1346
bool operator==(const char &Ch) const
Definition: dt.h:234
bool operator==(const TSFlt &SFlt) const _CMPWARN
Definition: dt.h:1423
TStr & operator=(const char &Ch)
Definition: dt.h:451
bool operator==(const TInt &Int) const
Definition: dt.h:1066
int64 GetHexInt64() const
Definition: dt.h:619
TStr GetFExt() const
Definition: dt.cpp:1421
bool IsInt64(int64 &Val) const
Definition: dt.h:592
int GetSecHashCd() const
Definition: dt.h:1023
static TStr GetKiloStr(const uint &Val)
Definition: dt.h:1198
TPt< TStrPool > PStrPool
Definition: dt.h:778
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
TStr Str
Definition: dt.h:699
void Load(TSIn &SIn)
Definition: dt.h:1241
static bool IsIpStr(const TStr &IpStr, uint &Ip, const char &SplitCh= '.')
Definition: dt.cpp:2096
const char * CStr() const
Definition: dt.h:256
char * Bf
Definition: dt.h:204
TVec< TStr, int > TStrV
Definition: dt.h:409
TChA & ToUc()
Definition: dt.cpp:560
void Clr()
Definition: dt.h:486
TFlt MnX
Definition: dt.h:1484
uint & operator()()
Definition: dt.h:1175
static const int q
Definition: dt.h:15
void UnRef()
Definition: dt.h:379
static TStr GetStr(const uint &Val, const TStr &FmtStr)
Definition: dt.h:1195
bool operator==(const TRnd &) const
Definition: dt.h:28
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:2077
static TRnd Rnd
Definition: dt.h:1053
TStr & ToCap()
Definition: dt.cpp:764
bool operator!=(const int &Int) const
Definition: dt.h:1068
TLFlt & operator+=(const ldouble &LFlt)
Definition: dt.h:1465
TLFlt & operator-=(const ldouble &LFlt)
Definition: dt.h:1466
static TStr GetStr(const uint &Val)
Definition: dt.h:1190
static const double Mx
Definition: dt.h:1298
int ChangeChAll(const char &SrcCh, const char &DstCh)
Definition: dt.cpp:1113
double GetXCenter() const
Definition: dt.h:1516
TDbStr(const TDbStr &DbStr)
Definition: dt.h:728
int MxBfL
Definition: dt.h:203
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:2263
void Reset()
Definition: dt.h:716
Definition: dt.h:830
bool IsHexInt(int &Val) const
Definition: dt.h:609
TBool & operator=(const TBool &Bool)
Definition: dt.h:906
static PSIn New(const PMem &Mem)
Definition: dt.h:167
TAscFlt()
Definition: dt.h:1397
TCh(TSIn &SIn)
Definition: dt.h:953
static const TStr YStr
Definition: dt.h:893
Definition: dt.h:1444
int GetSecHashCd() const
Definition: dt.h:745
static double GetMx(const double &Flt1, const double &Flt2, const double Flt3)
Definition: dt.h:1353
static bool GetValFromStr(const TStr &Str)
Definition: dt.cpp:1850
PMem Mem
Definition: dt.h:184
static double GetExpDevStep(const int &Seed, const int &Steps)
Definition: dt.h:68
Definition: dt.h:1293
friend TStr operator+(const TStr &LStr, const TStr &RStr)
Definition: dt.cpp:1631
TRStr(const char &Ch)
Definition: dt.h:361
uint64 GetUInt64() const
Definition: dt.h:603
static const ldouble Mn
Definition: dt.h:1448
bool operator==(const TCh &Ch) const
Definition: dt.h:960
bool IsStrIn(const TStr &Str) const
Definition: dt.h:292
int PutCh(const char &Ch)
Definition: dt.h:193
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:746
int GetMemUsed() const
Definition: dt.h:1252
Definition: fl.h:58
TInt & operator=(const TInt &Int)
Definition: dt.h:1064
int GetPrimHashCd() const
Definition: dt.h:1332
static const int Giga
Definition: dt.h:1052
TUInt64(TSIn &SIn)
Definition: dt.h:1240
char GetCh()
Definition: dt.h:337
Definition: dt.h:182
int GetSecHashCd() const
Definition: dt.h:1438
double GetFlt() const
Definition: dt.h:628
double GetGammaDev(const int &Order)
Definition: dt.cpp:95
char * operator()()
Definition: dt.h:253
static TStr GetStr(const TUInt &UInt)
Definition: dt.h:1192
static TStr GetMegaStr(const uint &Val)
Definition: dt.h:1202
Definition: dt.h:77
TStr GetWcMatch(const TStr &WcStr, const int &StarStrN=0) const
Definition: dt.cpp:1379
TFltRect(const TFltRect &FltRect)
Definition: dt.h:1488
void SplitOnCh(TStr &LStr, const char &SplitCh, TStr &RStr) const
Definition: dt.cpp:901
TInt(TSIn &SIn)
Definition: dt.h:1058
void Optimize()
Definition: dt.cpp:729
void Save(TSOut &SOut, const bool &IsTxt) const
Definition: dt.h:1313
static const TStr FalseStr
Definition: dt.h:890
int GetPrimHashCd() const
Definition: dt.h:1022
char LastLastCh() const
Definition: dt.h:282
static const char EofCh
Definition: dt.h:947
#define ClassTP(TNm, PNm)
Definition: bd.h:126
static const int Mega
Definition: dt.h:1051
static const char Mx
Definition: dt.h:940
int64 GetInt64() const
Definition: dt.h:594
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:2232
static int Sign(const int &Int)
Definition: dt.h:1082
void DelLastCh()
Definition: dt.h:263
TSFlt & operator+=(const double &SFlt)
Definition: dt.h:1428
void Reverse()
Definition: dt.cpp:440
static TStr GetMegaStr(const uint64 &Val)
Definition: dt.h:1279
bool Empty() const
Definition: dt.h:800
char * Bf
Definition: dt.h:348
bool IsUInt64(uint64 &Val) const
Definition: dt.h:601
int GetSecHashCd() const
Definition: dt.h:914
void Clr(bool DoDel=false)
Definition: dt.h:816
void Save(TSOut &SOut) const
Definition: dt.h:1162
uint GetUInt() const
Definition: dt.h:586
bool IsInt(int &Val) const
Definition: dt.h:576
TAscFlt(const double &Val)
Definition: dt.h:1398
int GetSecHashCd() const
Definition: dt.h:1470
bool IsWs() const
Definition: dt.cpp:1304
char * CStr()
Definition: dt.h:382
void Save(TSOut &SOut) const
Definition: dt.h:23
Definition: dt.h:778
bool Empty() const
Definition: dt.h:383
static PSIn New(const TStr &FNm)
Definition: fl.cpp:290
TDbStr(TSIn &SIn)
Definition: dt.h:731
void Trunc(const int &_BfL)
Definition: dt.h:267
PSIn GetSIn() const
Definition: dt.h:146
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:1876
char GetCh()
Definition: dt.h:713
void Load(TSIn &SIn)
Definition: dt.h:954
static double GetMn(const double &Flt1, const double &Flt2, const double &Flt3, const double &Flt4)
Definition: dt.h:1348
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:1811
static const int Mn
Definition: dt.h:1048
uint64 GetUInt64(const uint64 &DfVal) const
Definition: dt.h:605
void Push(const char &Ch)
Definition: dt.h:138
static TStr GetKiloStr(const double &Val)
Definition: dt.h:1379
int BfL
Definition: dt.h:79
TUInt & operator<<=(const int &ShiftBits)
Definition: dt.h:1181
int SearchChBack(const char &Ch, int BChN=-1) const
Definition: dt.cpp:477
static bool IsWs(const char &Ch)
Definition: dt.h:970
static TStr AddToFMid(const TStr &FNm, const TStr &ExtFMid)
Definition: dt.cpp:1523
#define _CMPWARN
Definition: base.h:31
double GetWeibull(const double &K, const double &Lambda)
Definition: dt.h:53
int PutBf(const void *LBf, const TSize &LBfL)
Definition: dt.cpp:336
int GetPrimHashCd() const
Definition: dt.h:913
int ChangeStrAll(const TStr &SrcStr, const TStr &DstStr, const bool &FromStartP=false)
Definition: dt.cpp:1141
int GetPrimHashCd() const
Definition: dt.h:743
int GetPrimHashCd() const
Definition: dt.h:1254
TStr GetStr(const TStr &MidStr=TStr()) const
Definition: dt.h:741
TRStr(const char *CStr)
Definition: dt.h:354
int GetPrimHashCd() const
Definition: dt.h:1038
int GetMemUsed() const
Definition: dt.h:1330
TUInt(const uint &_Val)
Definition: dt.h:1158
TStr(const TSStr &SStr)
Definition: dt.h:426
static const int a
Definition: dt.h:15
TStr GetUsFromYuAscii() const
Definition: dt.h:509
static TStr & GetDChStr(const char &Ch1, const char &Ch2)
Definition: dt.cpp:1564
static int GetMn(const int &Int1, const int &Int2)
Definition: dt.h:1090
Definition: dt.h:697
void Save(TSOut &SOut) const
Definition: dt.h:1418
double GetExpDev()
Definition: dt.cpp:83
char * CStr()
Definition: dt.h:255
void Save(TSOut &SOut) const
Definition: dt.h:103
static TStr GetNrAbsFPath(const TStr &FPath, const TStr &BaseFPath=TStr())
Definition: dt.cpp:1471
bool IsPrefix(const char *CStr, const int &BChN=0) const
Definition: dt.cpp:499
bool IsBool(bool &Val) const
Definition: dt.cpp:1153
TUInt & operator=(const TUInt &UInt)
Definition: dt.h:1166
TMem(const void *_Bf, const int &_BfL)
Definition: dt.h:88
TInt()
Definition: dt.h:1055
int GetSecHashCd() const
Definition: dt.h:1079
void Save(TSOut &SOut, const bool &IsSmall=false) const
Definition: dt.h:440
TFlt MnY
Definition: dt.h:1484
void Flush()
Definition: dt.h:196
Definition: dt.h:935
Definition: dt.h:865
unsigned long long uint64
Definition: bd.h:38
bool IsInt() const
Definition: dt.h:577
static const char TabCh
Definition: dt.h:944
static const char Mn
Definition: dt.h:939
TFlt(const double &_Val)
Definition: dt.h:1306
~TMem()
Definition: dt.h:99
TSFlt & operator=(const TSFlt &SFlt)
Definition: dt.h:1422
static TStr Get01Str(const bool &Val)
Definition: dt.h:926
bool operator==(const TFlt &Flt) const _CMPWARN
Definition: dt.h:1320
void Load(bool &Bool)
Definition: fl.h:84
TSFlt(const sdouble &_Val)
Definition: dt.h:1413
int64 GetHexInt64(const int64 &DfVal) const
Definition: dt.h:621
int CountCh(const char &Ch, const int &BChN=0) const
Definition: dt.cpp:462
static double GetNrmDevStep(const int &Seed, const int &Steps)
Definition: dt.h:66
TStr GetStr(const uint &Offset) const
Definition: dt.h:809
void Load(TSIn &SIn)
Definition: dt.h:1036
void SaveTxt(const PSOut &SOut) const
Definition: dt.cpp:622
int SearchStr(const TStr &Str, const int &BChN=0) const
Definition: dt.cpp:1065
bool IsSuffix(const char *Str) const
Definition: dt.cpp:1093
bool IsWcMatch(const int &StrBChN, const TStr &WcStr, const int &WcStrBChN, TStrV &StarStrV, const char &StarCh='*', const char &QuestCh='?') const
Definition: dt.cpp:1311
TChA(const int &_MxBfL=256)
Definition: dt.h:207
static PSIn New(const TStr &Str)
Definition: dt.h:708
void MkRef()
Definition: dt.h:378
TUInt & operator~()
Definition: dt.h:1176
const char * Bf
Definition: dt.h:324
char GetCh(const int &ChN) const
Definition: dt.h:388
Definition: lx.h:129
static TStr GetHexStr(const TInt &Int)
Definition: dt.h:1126
TFlt MxY
Definition: dt.h:1484
TMemIn(const TMem &_Mem, const int &_BfC=0)
Definition: dt.cpp:315
static bool IsIpStr(const TStr &IpStr, const char &SplitCh= '.')
Definition: dt.h:1217
static int GetNum(const char &Ch)
Definition: dt.h:976
static TStr GetStr(const TLFlt &LFlt, const int &Width=-1, const int &Prec=-1)
Definition: dt.h:1473
TStr GetStr() const
Definition: dt.h:1189
uint GetUniDevUInt(const uint &Range=0)
Definition: dt.cpp:45
TUInt64 & operator=(const TUInt64 &Int)
Definition: dt.h:1246
TStr Str1
Definition: dt.h:724
char PeekCh()
Definition: dt.h:174
int GetSecHashCd(const uint &Offset)
Definition: dt.h:824
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:740
void Load(TSIn &SIn)
Definition: dt.h:1059
size_t TSize
Definition: bd.h:58
char LastCh() const
Definition: dt.h:281
TStr Mid(const int &BChN, const int &Chs) const
Definition: dt.h:539
static TRStr * GetNullRStr()
Definition: dt.h:402
static PStrPool New(TSIn &SIn)
Definition: dt.h:792
~TChAIn()
Definition: dt.h:333
static void TestFrugalInt()
Definition: dt.cpp:1998
#define Assert(Cond)
Definition: bd.h:251
char operator[](const int &ChN) const
Definition: dt.h:471
char & operator[](const int &ChN)
Definition: dt.h:249
static bool IsOdd(const int &Int)
Definition: dt.h:1087
Definition: lx.h:251
void Save(TSOut &SOut) const
Definition: dt.h:1455
TStr RightOf(const char &SplitCh) const
Definition: dt.cpp:887
void Save(TSOut &SOut, const bool &SaveCompact=true) const
Definition: dt.h:224
void Save(TSOut &SOut) const
Definition: dt.h:1242
Definition: dt.h:1405
TStr & ConvUsFromYuAscii()
Definition: dt.cpp:779
int GetSecHashCd() const
Definition: dt.cpp:611
int GetMemUsed() const
Definition: dt.h:1467
TMem(const TMem &Mem)
Definition: dt.h:92
const char * CStr() const
Definition: dt.h:477
bool Eof()
Definition: dt.h:171
char LastCh() const
Definition: dt.h:484
TVoid(TSIn &)
Definition: dt.h:868
bool operator==(const char *CStr) const
Definition: dt.h:463
TFlt operator--(int)
Definition: dt.h:1329
TChA GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:448
static const char HashCh
Definition: dt.h:948
TRStr(const char *CStr1, const char *CStr2)
Definition: dt.h:358
uchar operator()() const
Definition: dt.h:1019
TFlt(TSIn &SIn, const bool &IsTxt)
Definition: dt.h:1310
TCh()
Definition: dt.h:950
TUInt & operator&=(const TUInt &UInt)
Definition: dt.h:1177
bool operator==(const TVoid &) const
Definition: dt.h:874
void Load(TSIn &SIn)
Definition: dt.h:1161
static TStr & GetChStr(const char &Ch)
Definition: dt.cpp:1551
~TMemIn()
Definition: dt.h:169
static TStr PutFBaseIfEmpty(const TStr &FNm, const TStr &FBase)
Definition: dt.cpp:1515
bool IsWord(const bool &WsPrefixP=true, const bool &FirstUcAllowedP=true) const
Definition: dt.cpp:1292
TStr GetLc() const
Definition: dt.h:499
bool Val
Definition: dt.h:883
static TStr LoadTxt(const TStr &FNm)
Definition: dt.h:668
static const int Vals
Definition: dt.h:1006
bool operator<(const int &Int) const
Definition: dt.h:1070
TStr & operator=(const TStr &Str)
Definition: dt.h:445
double GetYLen() const
Definition: dt.h:1513
void Trunc(const int &_BfL)
Definition: dt.h:136
TInt(const int &_Val)
Definition: dt.h:1056
bool operator<(const TCh &Ch) const
Definition: dt.h:961
bool operator!=(const double &Flt) const _CMPWARN
Definition: dt.h:1322
bool operator<(const TUCh &UCh) const
Definition: dt.h:1018
uint GetUInt(const uint &DfVal) const
Definition: dt.h:587
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:1928
int GetPrimHashCd(const uint &Offset)
Definition: dt.h:822
static PStrPool64 Load(TSIn &SIn, bool LoadCompact=true)
Definition: dt.h:845
int Len() const
Definition: dt.h:712
static TStr GetNrFPath(const TStr &FPath)
Definition: dt.cpp:1430
TChA(const TMem &Mem)
Definition: dt.h:216
int GetMemUsed() const
Definition: dt.h:376
void SaveTxt(const TStr &FNm) const
Definition: dt.h:672
static TStr GetNrFExt(const TStr &FExt)
Definition: dt.cpp:1455
void Save(TSOut &) const
Definition: dt.h:869
::TSize GetMemUsed()
Definition: dt.h:803
static TStr GetNullStr()
Definition: dt.cpp:1626
TStr & ToLc()
Definition: dt.cpp:758
static const sdouble Mx
Definition: dt.h:1410
bool operator<(const TChA &ChA) const
Definition: dt.h:238
TDbStr()
Definition: dt.h:727
static TStr GetStr(const int &Val)
Definition: dt.h:1109
int GetMemUsed() const
Definition: dt.h:1434
TUInt64 & operator-=(const TUInt64 &Int)
Definition: dt.h:1248
void Load(TSIn &SIn)
Definition: dt.h:222
char * operator()()
Definition: dt.h:474
int Len() const
Definition: dt.h:384
bool IsNum() const
Definition: dt.h:1366
static TRStr * GetRStr(const char *CStr)
Definition: dt.cpp:719
int GetMemUsed() const
Definition: dt.h:121
static TStr GetGigaStr(const double &Val)
Definition: dt.h:1387
TCh & operator=(const TCh &Ch)
Definition: dt.h:959
TLFlt()
Definition: dt.h:1451
unsigned char uchar
Definition: bd.h:10
TChA(TSIn &SIn)
Definition: dt.h:220
double GetMxX() const
Definition: dt.h:1508
void SaveBf(const void *Bf, const TSize &BfL)
Definition: fl.h:172
char GetCh(const int &ChN) const
Definition: dt.h:483
uint64 Len() const
Definition: dt.h:853
TChA & operator+=(const TMem &Mem)
Definition: dt.cpp:387
TUInt64(const uint &MsVal, const uint &LsVal)
Definition: dt.h:1235
char GetCh(const int &ChN) const
Definition: dt.h:280
int BfL
Definition: dt.h:203
bool operator==(const TLFlt &LFlt) const _CMPWARN
Definition: dt.h:1460
int GetMemUsed() const
Definition: dt.h:1182
void Trunc()
Definition: dt.cpp:420
bool operator<(const TVoid &) const
Definition: dt.h:875
TFlt()
Definition: dt.h:1305
Definition: fl.h:128
TBool(TSIn &SIn)
Definition: dt.h:900
char & operator[](const int &ChN) const
Definition: dt.h:119
int BfC
Definition: dt.h:162
int GetMemUsed() const
Definition: dt.h:1020
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:1838
TStr(TSIn &SIn, const bool &IsSmall=false)
Definition: dt.h:436
void DelSubStr(const int &BChN, const int &EChN)
Definition: dt.cpp:850
int GetSecHashCd() const
Definition: dt.cpp:713
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:2227
Definition: dt.h:1028
static const char LfCh
Definition: dt.h:945
int64 GetInt64(const int64 &DfVal) const
Definition: dt.h:596
char operator[](const int &ChN) const
Definition: dt.h:247
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:2275
TStr GetStr() const
Definition: dt.h:678
void Save(const bool &Bool)
Definition: fl.h:173
static uint GetRnd(const uint &Range=0)
Definition: dt.h:1187
TDbStr(const TStr &_Str1)
Definition: dt.h:729
int GetSecHashCd() const
Definition: dt.h:1039
TRnd(const int &_Seed=1, const int &Steps=0)
Definition: dt.h:20
static double Abs(const double &Flt)
Definition: dt.h:1337
static double GetUniDevStep(const int &Seed, const int &Steps)
Definition: dt.h:64
static int Round(const double &Flt)
Definition: dt.h:1339
TFlt operator++(int)
Definition: dt.h:1328
Definition: dt.h:1044
bool GetNextLnBf(TChA &LnChA)
Definition: dt.cpp:326
TStr Left(const int &EChN) const
Definition: dt.h:544
static TStr PutFBase(const TStr &FNm, const TStr &FBase)
Definition: dt.cpp:1511
TSFlt operator--(int)
Definition: dt.h:1433
char PeekCh()
Definition: dt.h:714
Definition: xml.h:198
double GetPoissonDev(const double &Mean)
Definition: dt.cpp:121
TChA & ToLc()
Definition: dt.cpp:552
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:2082
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:1881
static void LoadMem(const PSIn &SIn, TMem &Mem)
Definition: dt.h:149
void Move(const int &Steps)
Definition: dt.cpp:29
Definition: fl.h:442
static PStrPool New(const TStr &fileName)
Definition: dt.h:793
void SaveTxt(TOLx &Lx) const
Definition: dt.cpp:219
TUInt & operator=(const uint &_Val)
Definition: dt.h:1167
static const TStr YesStr
Definition: dt.h:895
Definition: dt.h:201
TUInt operator--(int)
Definition: dt.h:1169
static TStr GetNumFNm(const TStr &FNm, const int &Num)
Definition: dt.cpp:1527
uchar Val
Definition: dt.h:1002
void Save(TSOut &SOut) const
Definition: dt.h:955
static int Abs(const int &Int)
Definition: dt.h:1081
TUInt64()
Definition: dt.h:1232
static const bool Mn
Definition: dt.h:885
void Save(const TStr &FNm)
Definition: dt.h:796
uint64 Reserved() const
Definition: dt.h:854
bool operator<(const TLFlt &LFlt) const
Definition: dt.h:1463
Definition: dt.h:1149
TFltRect()
Definition: dt.h:1486
bool IsNan() const
Definition: dt.h:1367
static const TStr NStr
Definition: dt.h:892
double GetNrmDev()
Definition: dt.cpp:63
TStr GetTrunc() const
Definition: dt.h:506
int Seed
Definition: dt.h:16
static int GetRnd(const int &Range=0)
Definition: dt.h:1085
Definition: dt.h:722
Definition: dt.h:158
TStr & ToUc()
Definition: dt.cpp:752
void ConvUsFromYuAscii()
Definition: dt.cpp:693
void PutSeed(const int &_Seed)
Definition: dt.cpp:18
void PutCh(const int &ChN, const char &Ch)
Definition: dt.h:386
static bool IsAlNum(const char &Ch)
Definition: dt.h:975
static int GetMx(const int &Int1, const int &Int2, const int &Int3, const int &Int4)
Definition: dt.h:1101
void Save(TSOut &SOut, const bool &IsSmall) const
Definition: dt.h:371
float sdouble
Definition: bd.h:15
TFlt MxX
Definition: dt.h:1484
TStr LeftOf(const char &SplitCh) const
Definition: dt.cpp:873
TInt & operator=(const int &Int)
Definition: dt.h:1065
void SplitOnNonAlNum(TStrV &StrV) const
Definition: dt.cpp:990
int SearchCh(const char &Ch, const int &BChN=0) const
Definition: dt.cpp:470
double GetYCenter() const
Definition: dt.h:1517
TInt operator++(int)
Definition: dt.h:1074
static char * LoadFrugalInt(char *pSrc, int &i)
Definition: dt.cpp:1975
uint AddStr(const char *Str)
Definition: dt.h:806
static bool IsValStr(const TStr &Str)
Definition: dt.cpp:1842
double GetBinomialDev(const double &Prb, const int &Trials)
Definition: dt.cpp:154
void AddBf(char *NewBf, const int &BfS)
Definition: dt.h:275
static double GetMn(const double &Flt1, const double &Flt2)
Definition: dt.h:1344
TStr GetStr() const
Definition: dt.h:1270
void Reset()
Definition: dt.h:340
int ChangeCh(const char &SrcCh, const char &DstCh, const int &BChN=0)
Definition: dt.cpp:1107
TUInt(TSIn &SIn)
Definition: dt.h:1160
TStr & operator+=(const TStr &Str)
Definition: dt.h:453
TFltRect(TSIn &SIn)
Definition: dt.h:1494
TBool()
Definition: dt.h:897
static const ldouble Mx
Definition: dt.h:1449
long long int64
Definition: bd.h:27
TStr(const char *CStr)
Definition: dt.h:427
TStr Mid(const int &BChN) const
Definition: dt.h:540
TSFlt operator++(int)
Definition: dt.h:1432
~TStrPool()
Definition: dt.h:789
TMem(TSIn &SIn)
Definition: dt.h:100
static TStr GetYNStr(const bool &Val)
Definition: dt.h:922
static bool IsAlpha(const char &Ch)
Definition: dt.h:972
Definition: dt.h:412
TSInt()
Definition: dt.h:1032
TChA & operator=(const TChA &ChA)
Definition: dt.cpp:366
int GetMemUsed() const
Definition: dt.h:1076
TRnd & operator=(const TRnd &Rnd)
Definition: dt.h:27
bool Empty() const
Definition: dt.h:488
static PMem New(const int &MxBfL=0)
Definition: dt.h:87
~TStr()
Definition: dt.h:435
uint64 Val
Definition: dt.h:1227
bool IsChIn(const char &Ch) const
Definition: dt.h:553
TStr & ToTrunc()
Definition: dt.cpp:770
TStr GetCap() const
Definition: dt.h:502
static double GetRnd()
Definition: dt.h:1340
TStr LeftOfLast(const char &SplitCh) const
Definition: dt.cpp:880
bool operator<(const TInt &Int) const
Definition: dt.h:1069
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
char PeekCh()
Definition: dt.h:338
static TStr MkClone(const TStr &Str)
Definition: dt.h:688
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:2151
static bool IsNan(const double &Val)
Definition: dt.h:1363
double operator()() const
Definition: dt.h:1323
void Swap(const int &ChN1, const int &ChN2)
Definition: dt.cpp:595
int GetHexInt(const int &DfVal) const
Definition: dt.h:613
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:9
void SplitOnAllCh(const char &SplitCh, TStrV &StrV, const bool &SkipEmpty=true) const
Definition: dt.cpp:926
static TRnd Rnd
Definition: dt.h:1155
int BfC
Definition: dt.h:325
TStr GetStr() const
Definition: dt.cpp:2325
bool Eof()
Definition: dt.h:711
void LoadBf(const void *Bf, const TSize &BfL)
Definition: fl.h:81
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:361
TAscFlt(TSIn &SIn)
Definition: dt.h:1399
void ToUc()
Definition: dt.cpp:667
TStr & operator=(const TChA &ChA)
Definition: dt.h:447
static TStr LoadTxt(const PSIn &SIn)
Definition: dt.h:666
int MxBfL
Definition: dt.h:79
const char * operator()() const
Definition: dt.h:475
double GetFlt(const double &DfVal) const
Definition: dt.h:630
bool IsSuffix(const char *CStr) const
Definition: dt.cpp:518
void Load(TSIn &SIn)
Definition: dt.h:1312
bool IsUInt(uint &Val) const
Definition: dt.h:584
TSInt(const int16 &_Val)
Definition: dt.h:1033
TStr & operator=(const char *CStr)
Definition: dt.h:449
TStr GetHex() const
Definition: dt.h:512
static const char CrCh
Definition: dt.h:946
TUInt64 & operator*=(const TUInt64 &Int)
Definition: dt.h:1249
static char GetUsFromYuAscii(const char &Ch)
Definition: dt.cpp:1885
static bool Intersection(const TFltRect &Rect1, const TFltRect &Rect2)
Definition: dt.cpp:2317
int Cmp(const uint &Offset, const char *Str) const
Definition: dt.h:817
static PStrPool64 New(::TSize MxBfL=0,::TSize GrowBy=16 *1024 *1024)
Definition: dt.h:843
static TStr GetNrNumFExt(const int &FExtN)
Definition: dt.cpp:1460
double GetUniDev()
Definition: dt.h:30
static TStr GetStr(const TStr &Str, const TStr &FmtStr)
Definition: dt.h:680
void GenZeros(const int &_BfL)
Definition: dt.h:125
bool operator<(const TStr &Str) const
Definition: dt.h:469
TRStr(TSIn &SIn, const bool &IsSmall)
Definition: dt.h:368
static TStr GetStr(const bool &Val)
Definition: dt.h:918
uint Len() const
Definition: dt.h:798
TStrIn & operator=(const TStrIn &)
Definition: dt.h:322
TRStr & operator=(const TRStr &)
Definition: dt.h:375
void Reserve(const int &_MxBfL, const bool &DoClr=true)
Definition: dt.h:128
void Push(const char &Ch)
Definition: dt.h:264
static PMem New(const void *Bf, const int &BfL)
Definition: dt.h:91
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:1815
void AddChTo(const char &Ch, const int &ToChN)
Definition: dt.h:273
TChA(const TChA &ChA)
Definition: dt.h:213
int GetMemUsed() const
Definition: dt.h:876
static int Sign(const double &Flt)
Definition: dt.h:1338
int GetSecHashCd() const
Definition: dt.h:1185
bool operator<(const TBool &Bool) const
Definition: dt.h:908
Definition: bd.h:196
static const double PInf
Definition: dt.h:1300
static TStr GetStr(const int64 &Val)
Definition: dt.h:1120
static TStr GetStr(const TCh &Ch)
Definition: dt.h:994
static double GetInRng(const double &Val, const double &Mn, const double &Mx)
Definition: dt.h:1358
uint Val
Definition: dt.h:1151
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:2311
static void LoadFrugalIntV(TSIn &SIn, TVec< TInt, int > &IntV, bool ClrP=true)
Definition: dt.cpp:2043
bool operator==(const int &Int) const
Definition: dt.h:1067
bool operator==(const TBool &Bool) const
Definition: dt.h:907
TStr GetStr() const
Definition: dt.h:1369
TUInt & operator^=(const TUInt &UInt)
Definition: dt.h:1179
bool Filled() const
Definition: dt.h:749
void CompressWs()
Definition: dt.cpp:581
TStr Reverse() const
Definition: dt.h:566
TPt< TSIn > PSIn
Definition: fl.h:119
bool operator==(const TStr &Str) const
Definition: dt.h:461
short int16
Definition: bd.h:20
ldouble Val
Definition: dt.h:1446
TMem(const int &_MxBfL=0)
Definition: dt.h:84
TUInt & operator>>=(const int &ShiftBits)
Definition: dt.h:1180
int Len() const
Definition: dt.h:172
bool operator==(const double &Flt) const _CMPWARN
Definition: dt.h:1424
static const uchar Mx
Definition: dt.h:1005
char * GetBf() const
Definition: dt.h:144
static const TUInt64 Mn
Definition: dt.h:1229
bool Empty() const
Definition: dt.h:852
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:1905
int GetUniDevInt(const int &Range=0)
Definition: dt.cpp:39
static TStr PutFExt(const TStr &FNm, const TStr &FExt)
Definition: dt.cpp:1499
static const int Vals
Definition: dt.h:941
TInt & operator+=(const int &Int)
Definition: dt.h:1072
void SplitOnStr(const TStr &SplitStr, TStrV &StrV) const
Definition: dt.cpp:1008
bool Empty() const
Definition: dt.h:135
bool GetNextLnBf(TChA &LnChA)
Definition: dt.cpp:1654
bool Check()
Definition: dt.cpp:33
void PutCh(const int &ChN, const char &Ch)
Definition: dt.h:479
int Len() const
Definition: dt.h:336
~TMemOut()
Definition: dt.h:191
static TStr GetStr(const ldouble &Val, const int &Width=-1, const int &Prec=-1)
Definition: dt.cpp:2284
void SplitOnWs(TStrV &StrV) const
Definition: dt.cpp:972
bool IsUc() const
Definition: dt.cpp:660
int GetGeoDev(const double &Prb)
Definition: dt.h:45
bool operator==(const ldouble &LFlt) const _CMPWARN
Definition: dt.h:1461
TUInt64 & operator+=(const TUInt64 &Int)
Definition: dt.h:1247
static char IsUc(const char &Ch)
Definition: dt.h:988
TChA & ToTrunc()
Definition: dt.cpp:568
bool operator!=(const TChA &ChA) const
Definition: dt.h:235
TFlt & operator=(const TFlt &Flt)
Definition: dt.h:1318
static bool Eq6(const double &LFlt, const double &RFlt)
Definition: dt.h:1341
static const int Vals
Definition: dt.h:887
char * Bf
Definition: dt.h:700
static const int m
Definition: dt.h:15
char * CStr()
Definition: dt.h:476
char Pop()
Definition: dt.h:265
int GetPrimHashCd() const
Definition: dt.h:1184
int BfL
Definition: dt.h:162
TFltRect(const double &_MnX, const double &_MnY, const double &_MxX, const double &_MxY)
Definition: dt.h:1490
TLFlt(TSIn &SIn)
Definition: dt.h:1454
int GetHexInt() const
Definition: dt.h:611
int Refs
Definition: dt.h:349
~TChA()
Definition: dt.h:219
TStr()
Definition: dt.h:423
virtual int Len() const =0
char operator()() const
Definition: dt.h:962
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:2303
int GetBf(const void *LBf, const TSize &LBfL)
Definition: dt.cpp:644
uint GetMsVal() const
Definition: dt.h:1257
void SplitOnLastCh(TStr &LStr, const char &SplitCh, TStr &RStr) const
Definition: dt.cpp:912
double GetMnX() const
Definition: dt.h:1506
TChA(const char *CStr, const int &StrLen)
Definition: dt.h:211
static TStr GetStr(const uint &Val)
Definition: dt.h:1115
PMem Mem
Definition: dt.h:160
static TStr GetStr(const ldouble &Val, const TStr &FmtStr)
Definition: dt.h:1476
Definition: dt.h:881
char * operator()() const
Definition: dt.h:114
static char GetUc(const char &Ch)
Definition: dt.h:990
TRStr(const char &Ch1, const char &Ch2)
Definition: dt.h:363
TStr Slice(int BChN, int EChNP1) const
Definition: dt.h:546
bool IsStrIn(const TStr &Str) const
Definition: dt.h:554
TVoid()
Definition: dt.h:867
Definition: fl.h:11
TStr GetFBase() const
Definition: dt.cpp:1396
static uint GetUIntFromIpStr(const TStr &IpStr, const char &SplitCh= '.')
Definition: dt.cpp:2107
static void Swap(int &Int1, int &Int2)
Definition: dt.h:1083
static TStr GetStr(const TBool &Bool)
Definition: dt.h:920
uint64 GetMemUsed() const
Definition: dt.h:850
int GetPrimHashCd() const
Definition: dt.cpp:607
bool IsSuffix(const TStr &Str) const
Definition: dt.h:559
TStr operator()(const int &BChN, const int &EChNP1) const
Definition: dt.h:547
void SplitOnAllAnyCh(const TStr &SplitChStr, TStrV &StrV, const bool &SkipEmpty=true) const
Definition: dt.cpp:944
TBool(const bool &_Val)
Definition: dt.h:898
uint AddStr(const TStr &Str)
Definition: dt.h:807
int GetSecHashCd() const
Definition: dt.h:1255
void InsStr(const int &BChN, const TStr &Str)
Definition: dt.cpp:825
static TStr GetStr(const TFlt &Flt, const int &Width=-1, const int &Prec=-1)
Definition: dt.h:1371
int16 Val
Definition: dt.h:1030
int BfL
Definition: dt.h:701
int CountCh(const char &Ch, const int &BChN=0) const
Definition: dt.cpp:1033
static const TStr TrueStr
Definition: dt.h:891
TUInt64(void *Pt)
Definition: dt.h:1237
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:2258
int GetMemUsed() const
Definition: dt.h:472
int GetPrimHashCd() const
Definition: dt.h:1436
bool IsUc() const
Definition: dt.h:491
static int GetMn(const int &Int1, const int &Int2, const int &Int3)
Definition: dt.h:1094
bool operator!=(const char &Ch) const
Definition: dt.h:237
uint operator()() const
Definition: dt.h:1174
bool GetNextLnBf(TChA &LnChA)
Definition: dt.cpp:652
static TStr GetStr(const TInt &Int)
Definition: dt.h:1110
Definition: dt.h:1395
TChA(const char *CStr)
Definition: dt.h:209
bool operator<(const TSFlt &SFlt) const
Definition: dt.h:1426
bool operator==(const TUCh &UCh) const
Definition: dt.h:1017
TStr RightOfLast(const char &SplitCh) const
Definition: dt.cpp:894
TCs Cs
Definition: fl.h:44
static const TUInt64 Mx
Definition: dt.h:1230
int GetSeed() const
Definition: dt.h:59
int GetSecHashCd() const
Definition: dt.h:1334
static const uchar Mn
Definition: dt.h:1004
int GetMemUsed() const
Definition: dt.h:911
void Save(TSOut &SOut) const
Definition: dt.h:1309
bool operator<(const TDbStr &DbStr) const
Definition: dt.h:738
static bool IsAbsFPath(const TStr &FPath)
Definition: dt.cpp:1491
TStr(const char &Ch)
Definition: dt.h:428
TFlt & operator-=(const double &Flt)
Definition: dt.h:1325
TUCh()
Definition: dt.h:1008
static bool IsEven(const int &Int)
Definition: dt.h:1088
double GetPowerDev(const double &AlphaSlope)
Definition: dt.h:47
Definition: dt.h:1225
bool operator()() const
Definition: dt.h:910
static const double Eps
Definition: dt.h:1301
bool IsUInt64() const
Definition: dt.h:602
static PMem New(const TStr &Str)
Definition: dt.h:98
int ChangeStr(const TStr &SrcStr, const TStr &DstStr, const int &BChN=0)
Definition: dt.cpp:1130
TRStr(const int &Len)
Definition: dt.h:352
static TRnd Rnd
Definition: dt.h:1303
static const double Mn
Definition: dt.h:1297
int operator()() const
Definition: dt.h:1071
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:429
Definition: dt.h:346
~TStrIn()
Definition: dt.h:709
char Val
Definition: dt.h:937
Definition: dt.h:1000
double GetXLen() const
Definition: dt.h:1512
static void LoadMem(const PSIn &SIn, const PMem &Mem)
Definition: dt.h:151
void ChangeCh(const char &SrcCh, const char &DstCh)
Definition: dt.cpp:537
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:2156
static TStr GetKiloStr(const int &Val)
Definition: dt.h:1129
void SaveTxt(const PSOut &SOut) const
Definition: dt.h:670
static TStr GetFNmStr(const TStr &Str, const bool &AlNumOnlyP=true)
Definition: dt.cpp:1531
int GetInt(const int &DfVal) const
Definition: dt.h:579
int GetMemUsed() const
Definition: dt.h:251
void Clr(const bool &DoDel=true)
Definition: dt.h:131
~TRStr()
Definition: dt.h:365
static int GetMx(const int &Int1, const int &Int2, const int &Int3)
Definition: dt.h:1099