SNAP Library 2.3, Developer Reference  2014-06-16 11:58:46
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: 1 is 1st character, -1 is last character
544  // TODO ROK, ask Jure about this comment
545  TStr Left(const int& EChN) const { return EChN>0 ? GetSubStr(0, EChN-1) : GetSubStr(0, Len()+EChN-1);}
546  TStr Right(const int& BChN) const {return BChN>=0 ? GetSubStr(BChN, Len()-1) : GetSubStr(Len()+BChN, Len()-1);}
547  TStr Slice(int BChN, int EChNP1) const { if(BChN<0){BChN=Len()+BChN;} if(EChNP1<=0){EChNP1=Len()+EChNP1;} return GetSubStr(BChN, EChNP1-1); }
548  TStr operator()(const int& BChN, const int& EChNP1) const {return Slice(BChN, EChNP1);}
549 
550  int CountCh(const char& Ch, const int& BChN=0) const;
551  int SearchCh(const char& Ch, const int& BChN=0) const;
552  int SearchChBack(const char& Ch, int BChN=-1) const;
553  int SearchStr(const TStr& Str, const int& BChN=0) const;
554  bool IsChIn(const char& Ch) const {return SearchCh(Ch)!=-1;}
555  bool IsStrIn(const TStr& Str) const {return SearchStr(Str)!=-1;}
556  bool IsPrefix(const char *Str) const;
557  bool IsPrefix(const TStr& Str) const {
558  return IsPrefix(Str.CStr());}
559  bool IsSuffix(const char *Str) const;
560  bool IsSuffix(const TStr& Str) const {
561  return IsSuffix(Str.CStr());}
562 
563  int ChangeCh(const char& SrcCh, const char& DstCh, const int& BChN=0);
564  int ChangeChAll(const char& SrcCh, const char& DstCh);
565  int ChangeStr(const TStr& SrcStr, const TStr& DstStr, const int& BChN=0);
566  int ChangeStrAll(const TStr& SrcStr, const TStr& DstStr, const bool& FromStartP=false);
567  TStr Reverse() const {
568  TChA ChA(*this); ChA.Reverse(); return ChA;}
569 
570  int GetPrimHashCd() const {return RStr->GetPrimHashCd();}
571  int GetSecHashCd() const {return RStr->GetSecHashCd();}
572 
573  bool IsBool(bool& Val) const;
574 
575  bool IsInt(
576  const bool& Check, const int& MnVal, const int& MxVal, int& Val) const;
577  bool IsInt(int& Val) const {return IsInt(false, 0, 0, Val);}
578  bool IsInt() const {int Val; return IsInt(false, 0, 0, Val);}
579  int GetInt() const {int Val; IAssertR(IsInt(false, 0, 0, Val), *this); return Val;}
580  int GetInt(const int& DfVal) const {
581  int Val; if (IsInt(false, 0, 0, Val)){return Val;} else {return DfVal;}}
582 
583  bool IsUInt(
584  const bool& Check, const uint& MnVal, const uint& MxVal, uint& Val) const;
585  bool IsUInt(uint& Val) const {return IsUInt(false, 0, 0, Val);}
586  bool IsUInt() const {uint Val; return IsUInt(false, 0, 0, Val);}
587  uint GetUInt() const {uint Val; IAssert(IsUInt(false, 0, 0, Val)); return Val;}
588  uint GetUInt(const uint& DfVal) const {
589  uint Val; if (IsUInt(false, 0, 0, Val)){return Val;} else {return DfVal;}}
590 
591  bool IsInt64(
592  const bool& Check, const int64& MnVal, const int64& MxVal, int64& Val) const;
593  bool IsInt64(int64& Val) const {return IsInt64(false, 0, 0, Val);}
594  bool IsInt64() const {int64 Val; return IsInt64(false, 0, 0, Val);}
595  int64 GetInt64() const {
596  int64 Val; IAssert(IsInt64(false, 0, 0, Val)); return Val;}
597  int64 GetInt64(const int64& DfVal) const {
598  int64 Val; if (IsInt64(false, 0, 0, Val)){return Val;} else {return DfVal;}}
599 
600  bool IsUInt64(
601  const bool& Check, const uint64& MnVal, const uint64& MxVal, uint64& Val) const;
602  bool IsUInt64(uint64& Val) const {return IsUInt64(false, 0, 0, Val);}
603  bool IsUInt64() const {uint64 Val; return IsUInt64(false, 0, 0, Val);}
604  uint64 GetUInt64() const {
605  uint64 Val; IAssert(IsUInt64(false, 0, 0, Val)); return Val;}
606  uint64 GetUInt64(const uint64& DfVal) const {
607  uint64 Val; if (IsUInt64(false, 0, 0, Val)){return Val;} else {return DfVal;}}
608 
609  bool IsHexInt(const bool& Check, const int& MnVal, const int& MxVal, int& Val) const;
610  bool IsHexInt(int& Val) const {return IsHexInt(false, 0, 0, Val);}
611  bool IsHexInt() const {int Val; return IsHexInt(false, 0, 0, Val);}
612  int GetHexInt() const {
613  int Val; IAssert(IsHexInt(false, 0, 0, Val)); return Val;}
614  int GetHexInt(const int& DfVal) const {
615  int Val; if (IsHexInt(false, 0, 0, Val)){return Val;} else {return DfVal;}}
616 
617  bool IsHexInt64(const bool& Check, const int64& MnVal, const int64& MxVal, int64& Val) const;
618  bool IsHexInt64(int64& Val) const {return IsHexInt64(false, 0, 0, Val);}
619  bool IsHexInt64() const {int64 Val; return IsHexInt64(false, 0, 0, Val);}
620  int64 GetHexInt64() const {
621  int64 Val; IAssert(IsHexInt64(false, 0, 0, Val)); return Val;}
622  int64 GetHexInt64(const int64& DfVal) const {
623  int64 Val; if (IsHexInt64(false, 0, 0, Val)){return Val;} else {return DfVal;}}
624 
625  bool IsFlt(const bool& Check, const double& MnVal, const double& MxVal,
626  double& Val, const char& DecDelimCh='.') const;
627  bool IsFlt(double& Val) const {return IsFlt(false, 0, 0, Val);}
628  bool IsFlt() const {double Val; return IsFlt(false, 0, 0, Val);}
629  double GetFlt() const {
630  double Val; IAssert(IsFlt(false, 0, 0, Val)); return Val;}
631  double GetFlt(const double& DfVal) const {
632  double Val; if (IsFlt(false, 0, 0, Val)){return Val;} else {return DfVal;}}
633 
634  bool IsWord(const bool& WsPrefixP=true, const bool& FirstUcAllowedP=true) const;
635  bool IsWs() const;
636 
637  bool IsWcMatch(
638  const int& StrBChN, const TStr& WcStr, const int& WcStrBChN, TStrV& StarStrV,
639  const char& StarCh='*', const char& QuestCh='?') const;
640  bool IsWcMatch(
641  const TStr& WcStr, TStrV& StarStrV,
642  const char& StarCh='*', const char& QuestCh='?') const;
643  bool IsWcMatch(const TStr& WcStr, const char& StarCh, const char& QuestCh) const;
644  bool IsWcMatch(const TStr& WcStr, const int& StarStrN, TStr& StarStr) const;
645  bool IsWcMatch(const TStr& WcStr) const;
646  TStr GetWcMatch(const TStr& WcStr, const int& StarStrN=0) const;
647 
648  TStr GetFPath() const;
649  TStr GetFBase() const;
650  TStr GetFMid() const;
651  TStr GetFExt() const;
652  static TStr GetNrFPath(const TStr& FPath);
653  static TStr GetNrFMid(const TStr& FMid);
654  static TStr GetNrFExt(const TStr& FExt);
655  static TStr GetNrNumFExt(const int& FExtN);
656  static TStr GetNrFNm(const TStr& FNm);
657  static TStr GetNrAbsFPath(const TStr& FPath, const TStr& BaseFPath=TStr());
658  static bool IsAbsFPath(const TStr& FPath);
659  static TStr PutFExt(const TStr& FNm, const TStr& FExt);
660  static TStr PutFExtIfEmpty(const TStr& FNm, const TStr& FExt);
661  static TStr PutFBase(const TStr& FNm, const TStr& FBase);
662  static TStr PutFBaseIfEmpty(const TStr& FNm, const TStr& FBase);
663  static TStr AddToFMid(const TStr& FNm, const TStr& ExtFMid);
664  static TStr GetNumFNm(const TStr& FNm, const int& Num);
665  static TStr GetFNmStr(const TStr& Str, const bool& AlNumOnlyP=true);
666 
667  static TStr LoadTxt(const PSIn& SIn){
668  return TStr(SIn);}
669  static TStr LoadTxt(const TStr& FNm){
670  PSIn SIn=TFIn::New(FNm); return LoadTxt(SIn);}
671  void SaveTxt(const PSOut& SOut) const {
672  SOut->SaveBf(CStr(), Len());}
673  void SaveTxt(const TStr& FNm) const {
674  PSOut SOut=TFOut::New(FNm); SaveTxt(SOut);}
675 
676  static TStr& GetChStr(const char& Ch);
677  static TStr& GetDChStr(const char& Ch1, const char& Ch2);
678 
679  TStr GetStr() const {return *this;}
680  static TStr GetStr(const TStr& Str, const char* FmtStr);
681  static TStr GetStr(const TStr& Str, const TStr& FmtStr){
682  return GetStr(Str, FmtStr.CStr());}
683  static TStr GetStr(const TStrV& StrV, const TStr& DelimiterStr);
684  static TStr Fmt(const char *FmtStr, ...);
685  static TStr GetSpaceStr(const int& Spaces);
686  char* GetCStr() const {
687  char* Bf=new char[Len()+1]; strcpy(Bf, CStr()); return Bf;}
688 
689  static TStr MkClone(const TStr& Str){return TStr(Str.CStr());}
690  static TStr GetNullStr();
691 
692  friend TStr operator+(const TStr& LStr, const TStr& RStr);
693  friend TStr operator+(const TStr& LStr, const char* RCStr);
694 };
695 
697 // Input-String
698 class TStrIn: public TSIn{
699 private:
701  char* Bf;
702  int BfC, BfL;
703 private:
704  TStrIn();
705  TStrIn(const TStrIn&);
706  TStrIn& operator = (const TStrIn&);
707 public:
708  TStrIn(const TStr& _Str);
709  static PSIn New(const TStr& Str){return PSIn(new TStrIn(Str));}
711 
712  bool Eof(){return BfC==BfL;}
713  int Len() const {return BfL-BfC;}
714  char GetCh(){Assert(BfC<BfL); return Bf[BfC++];}
715  char PeekCh(){Assert(BfC<BfL); return Bf[BfC];}
716  int GetBf(const void* LBf, const TSize& LBfL);
717  void Reset(){Cs=TCs(); BfC=0;}
718  bool GetNextLnBf(TChA& LnChA);
719 };
720 
722 // Double-String
723 class TDbStr{
724 public:
727 public:
728  TDbStr(): Str1(), Str2(){}
729  TDbStr(const TDbStr& DbStr): Str1(DbStr.Str1), Str2(DbStr.Str2){}
730  TDbStr(const TStr& _Str1): Str1(_Str1), Str2(){}
731  TDbStr(const TStr& _Str1, const TStr& _Str2): Str1(_Str1), Str2(_Str2){}
732  explicit TDbStr(TSIn& SIn): Str1(SIn), Str2(SIn){}
733  void Save(TSOut& SOut) const {Str1.Save(SOut); Str2.Save(SOut);}
734 
735  TDbStr& operator=(const TDbStr& DbStr){
736  if (this!=&DbStr){Str1=DbStr.Str1; Str2=DbStr.Str2;} return *this;}
737  bool operator==(const TDbStr& DbStr) const {
738  return (Str1==DbStr.Str1)&&(Str2==DbStr.Str2);}
739  bool operator<(const TDbStr& DbStr) const {
740  return (Str1<DbStr.Str1)||((Str1==DbStr.Str1)&&(Str2<DbStr.Str2));}
741 
742  TStr GetStr(const TStr& MidStr=TStr()) const {
743  if (Filled()){return Str1+MidStr+Str2;} else {return Str1+Str2;}}
744  int GetPrimHashCd() const {
745  return Str1.GetPrimHashCd()+Str2.GetPrimHashCd();}
746  int GetSecHashCd() const {
747  return Str1.GetSecHashCd()+Str2.GetSecHashCd();}
748 
749  bool Empty() const {return (Str1.Empty())&&(Str2.Empty());}
750  bool Filled() const {return (!Str2.Empty())&&(!Str1.Empty());}
751 };
752 
754 // Simple-String-Pool
755 //ClassTP(TSStrPool, PSStrPool)//{
756 //private:
757 // TMem Bf;
758 //public:
759 // TSStrPool(const int& MxLen=0): Bf(MxLen){}
760 // TSStrPool(TSStrPool& StrPool): Bf(StrPool.Bf){}
761 // TSStrPool(TSIn& SIn): Bf(SIn){}
762 // void Save(TSOut& SOut) const {Bf.Save(SOut);}
763 //
764 // TSStrPool& operator=(const TSStrPool& StrPool){
765 // Bf=StrPool.Bf; return *this;}
766 //
767 // int Len() const {return Bf.Len();}
768 // void Clr(){Bf.Clr();}
769 // int AddStr(const TStr& Str){
770 // if (Str.Empty()){return -1;}
771 // else {int StrId=Bf.Len(); Bf+=Str; Bf+=char(0); return StrId;}}
772 // TStr GetStr(const int& StrId) const {
773 // if (StrId==-1){return "";}
774 // else {return TStr(Bf()+StrId);}}
775 //};
776 
778 // String-Pool
780 private:
781  uint MxBfL, BfL, GrowBy;
782  char *Bf;
783 private:
784  void Resize(const uint& _MxBfL);
785 public:
786  TStrPool(const uint& MxBfLen = 0, const uint& _GrowBy = 16*1024*1024);
787  TStrPool(TSIn& SIn, bool LoadCompact = true);
788  TStrPool(const TStrPool& Pool) : MxBfL(Pool.MxBfL), BfL(Pool.BfL), GrowBy(Pool.GrowBy) {
789  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); }
790  ~TStrPool() { if (Bf) free(Bf); else IAssertR(MxBfL == 0, TStr::Fmt("size: %u, expected size: 0", MxBfL).CStr()); Bf = 0; MxBfL = 0; BfL = 0; }
791 
792  static PStrPool New(const uint& _MxBfLen = 0, const uint& _GrowBy = 16*1024*1024) { return PStrPool(new TStrPool(_MxBfLen, _GrowBy)); }
793  static PStrPool New(TSIn& SIn) { return new TStrPool(SIn); }
794  static PStrPool New(const TStr& fileName) { PSIn SIn = TFIn::New(fileName); return new TStrPool(*SIn); }
795  static PStrPool Load(TSIn& SIn, bool LoadCompacted = true) { return PStrPool(new TStrPool(SIn, LoadCompacted)); }
796  void Save(TSOut& SOut) const;
797  void Save(const TStr& FNm){PSOut SOut=TFOut::New(FNm); Save(*SOut);}
798 
799  uint Len() const { return BfL; }
800  uint Size() const { return MxBfL; }
801  bool Empty() const { return ! Len(); }
802  char* operator () () const { return Bf; }
803  TStrPool& operator = (const TStrPool& Pool);
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 Save(TSOut& SOut) const {SOut.Save(Val);}
955  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
956  void SaveXml(TSOut& SOut, const TStr& Nm) const;
957 
958  TCh& operator=(const TCh& Ch){Val=Ch.Val; return *this;}
959  bool operator==(const TCh& Ch) const {return Val==Ch.Val;}
960  bool operator<(const TCh& Ch) const {return Val<Ch.Val;}
961  char operator()() const {return Val;}
962  int GetMemUsed() const {return sizeof(TCh);}
963 
964  int GetPrimHashCd() const {return Val;}
965  int GetSecHashCd() const {return Val;}
966 
967  static bool IsWs(const char& Ch){
968  return (Ch==' ')||(Ch==TabCh)||(Ch==CrCh)||(Ch==LfCh);}
969  static bool IsAlpha(const char& Ch){
970  return (('A'<=Ch)&&(Ch<='Z'))||(('a'<=Ch)&&(Ch<='z'));}
971  static bool IsNum(const char& Ch){return ('0'<=Ch)&&(Ch<='9');}
972  static bool IsAlNum(const char& Ch){return IsAlpha(Ch)||IsNum(Ch);}
973  static int GetNum(const char& Ch){Assert(IsNum(Ch)); return Ch-'0';}
974  static bool IsHex(const char& Ch){return
975  (('0'<=Ch)&&(Ch<='9'))||(('A'<=Ch)&&(Ch<='F'))||(('a'<=Ch)&&(Ch<='f'));}
976  static int GetHex(const char& Ch){
977  if (('0'<=Ch)&&(Ch<='9')){return Ch-'0';}
978  else if (('A'<=Ch)&&(Ch<='F')){return Ch-'A'+10;}
979  else if (('a'<=Ch)&&(Ch<='f')){return Ch-'a'+10;}
980  else Fail; return 0;}
981  static char GetHexCh(const int& Val){
982  if ((0<=Val)&&(Val<=9)){return char('0'+char(Val));}
983  else if ((10<=Val)&&(Val<=15)){return char('A'+char(Val-10));}
984  else Fail; return 0;}
985  static char IsUc(const char& Ch){
986  return ('A'<=Ch)&&(Ch<='Z');}
987  static char GetUc(const char& Ch){
988  if (('a'<=Ch)&&(Ch<='z')){return Ch-'a'+'A';} else {return Ch;}}
989  static char GetUsFromYuAscii(const char& Ch);
990 
991  static TStr GetStr(const TCh& Ch){
992  return TStr(Ch.Val);}
993 };
994 
996 // Unsigned-Char
997 class TUCh{
998 public:
1000 public:
1001  static const uchar Mn;
1002  static const uchar Mx;
1003  static const int Vals;
1004 
1005  TUCh(): Val(TCh::NullCh){}
1006  TUCh(const uchar& _Val): Val(_Val){}
1007  operator uchar() const {return Val;}
1008  explicit TUCh(TSIn& SIn){SIn.Load(Val);}
1009  void Save(TSOut& SOut) const {SOut.Save(Val);}
1010  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1011  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1012 
1013  TUCh& operator=(const TUCh& UCh){Val=UCh.Val; return *this;}
1014  bool operator==(const TUCh& UCh) const {return Val==UCh.Val;}
1015  bool operator<(const TUCh& UCh) const {return Val<UCh.Val;}
1016  uchar operator()() const {return Val;}
1017  int GetMemUsed() const {return sizeof(TUCh);}
1018 
1019  int GetPrimHashCd() const {return Val;}
1020  int GetSecHashCd() const {return Val;}
1021 };
1022 
1024 // Short-Integer
1025 class TSInt{
1026 public:
1028 public:
1029  TSInt(): Val(0){}
1030  TSInt(const int16& _Val): Val(_Val){}
1031  operator int16() const {return Val;}
1032  explicit TSInt(TSIn& SIn){SIn.Load(Val);}
1033  void Load(TSIn& SIn){SIn.Load(Val);}
1034  void Save(TSOut& SOut) const {SOut.Save(Val);}
1035  int GetPrimHashCd() const {return Val;}
1036  int GetSecHashCd() const {return Val/0x10;}
1037 };
1038 
1040 // Integer
1041 class TInt{
1042 public:
1043  int Val;
1044 public:
1045  static const int Mn;
1046  static const int Mx;
1047  static const int Kilo;
1048  static const int Mega;
1049  static const int Giga;
1050  static TRnd Rnd;
1051 
1052  TInt(): Val(0){}
1053  TInt(const int& _Val): Val(_Val){}
1054  operator int() const {return Val;}
1055  explicit TInt(TSIn& SIn){SIn.Load(Val);}
1056  void Load(TSIn& SIn){SIn.Load(Val);}
1057  void Save(TSOut& SOut) const {SOut.Save(Val);}
1058  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1059  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1060 
1061  TInt& operator=(const TInt& Int){Val=Int.Val; return *this;}
1062  TInt& operator=(const int& Int){Val=Int; return *this;}
1063  bool operator==(const TInt& Int) const {return Val==Int.Val;}
1064  bool operator==(const int& Int) const {return Val==Int;}
1065  bool operator!=(const int& Int) const {return Val!=Int;}
1066  bool operator<(const TInt& Int) const {return Val<Int.Val;}
1067  bool operator<(const int& Int) const {return Val<Int;}
1068  int operator()() const {return Val;}
1069  TInt& operator+=(const int& Int){Val+=Int; return *this;}
1070  TInt& operator-=(const int& Int){Val-=Int; return *this;}
1071  TInt operator++(int){Val++; return *this;}
1072  TInt operator--(int){Val--; return *this;}
1073  int GetMemUsed() const {return sizeof(TInt);}
1074 
1075  int GetPrimHashCd() const {return Val;}
1076  int GetSecHashCd() const {return Val/0x10;}
1077 
1078  static int Abs(const int& Int){return Int<0?-Int:Int;}
1079  static int Sign(const int& Int){return Int<0?-1:(Int>0?1:0);}
1080  static void Swap(int& Int1, int& Int2){
1081  int SwapInt1=Int1; Int1=Int2; Int2=SwapInt1;}
1082  static int GetRnd(const int& Range=0){return Rnd.GetUniDevInt(Range);}
1083 
1084  static bool IsOdd(const int& Int){return ((Int%2)==1);}
1085  static bool IsEven(const int& Int){return ((Int%2)==0);}
1086 
1087  static int GetMn(const int& Int1, const int& Int2){
1088  return Int1<Int2?Int1:Int2;}
1089  static int GetMx(const int& Int1, const int& Int2){
1090  return Int1>Int2?Int1:Int2;}
1091  static int GetMn(const int& Int1, const int& Int2, const int& Int3){
1092  return GetMn(Int1, GetMn(Int2, Int3));}
1093  static int GetMn(const int& Int1, const int& Int2,
1094  const int& Int3, const int& Int4){
1095  return GetMn(GetMn(Int1, Int2), GetMn(Int3, Int4));}
1096  static int GetMx(const int& Int1, const int& Int2, const int& Int3){
1097  return GetMx(Int1, GetMx(Int2, Int3));}
1098  static int GetMx(const int& Int1, const int& Int2,
1099  const int& Int3, const int& Int4){
1100  return GetMx(GetMx(Int1, Int2), GetMx(Int3, Int4));}
1101  static int GetInRng(const int& Val, const int& Mn, const int& Mx){
1102  IAssert(Mn<=Mx); return Val<Mn?Mn:(Val>Mx?Mx:Val);}
1103 
1104  TStr GetStr() const {return TInt::GetStr(Val);}
1105 
1106  static TStr GetStr(const int& Val){ return TStr::Fmt("%d", Val); }
1107  static TStr GetStr(const TInt& Int){ return GetStr(Int.Val);}
1108  static TStr GetStr(const int& Val, const char* FmtStr);
1109  static TStr GetStr(const int& Val, const TStr& FmtStr){ return GetStr(Val, FmtStr.CStr());}
1110 
1111  //J: So that TInt can convert any kind of integer to a string
1112  static TStr GetStr(const uint& Val){ return TStr::Fmt("%u", Val); }
1113  #ifdef GLib_WIN
1114  static TStr GetStr(const int64& Val) {return TStr::Fmt("%I64d", Val);}
1115  static TStr GetStr(const uint64& Val) {return TStr::Fmt("%I64u", Val);}
1116  #else
1117  static TStr GetStr(const int64& Val) {return TStr::Fmt("%lld", Val);}
1118  static TStr GetStr(const uint64& Val) {return TStr::Fmt("%llu", Val);}
1119  #endif
1120 
1121  static TStr GetHexStr(const int& Val){
1122  char Bf[255]; sprintf(Bf, "%X", Val); return TStr(Bf);}
1123  static TStr GetHexStr(const TInt& Int){
1124  return GetHexStr(Int.Val);}
1125 
1126  static TStr GetKiloStr(const int& Val){
1127  if (Val>=100*1000){return GetStr(Val/1000)+"K";}
1128  else if (Val>=1000){return GetStr(Val/1000)+"."+GetStr((Val%1000)/100)+"K";}
1129  else {return GetStr(Val);}}
1130  static TStr GetMegaStr(const int& Val){
1131  if (Val>=100*1000000){return GetStr(Val/1000000)+"M";}
1132  else if (Val>=1000000){
1133  return GetStr(Val/1000000)+"."+GetStr((Val%1000000)/100000)+"M";}
1134  else {return GetKiloStr(Val);}}
1135 
1136  // frugal
1137  static char* SaveFrugalInt(char *pDest, int i);
1138  static char* LoadFrugalInt(char *pSrc, int& i);
1139  static void TestFrugalInt();
1140  static void SaveFrugalIntV(TSOut& SOut, const TVec<TInt, int>& IntV);
1141  static void LoadFrugalIntV(TSIn& SIn, TVec<TInt, int>& IntV, bool ClrP=true);
1142 };
1143 
1145 // Unsigned-Integer
1146 class TUInt{
1147 public:
1149 public:
1150  static const uint Mn;
1151  static const uint Mx;
1152  static TRnd Rnd;
1153 
1154  TUInt(): Val(0){}
1155  TUInt(const uint& _Val): Val(_Val){}
1156  operator uint() const {return Val;}
1157  explicit TUInt(TSIn& SIn){SIn.Load(Val);}
1158  void Load(TSIn& SIn){SIn.Load(Val);}
1159  void Save(TSOut& SOut) const {SOut.Save(Val);}
1160  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1161  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1162 
1163  TUInt& operator=(const TUInt& UInt){Val=UInt.Val; return *this;}
1164  TUInt& operator=(const uint& _Val){Val=_Val; return *this;}
1165  TUInt operator++(int){Val++; return *this;}
1166  TUInt operator--(int){Val--; return *this;}
1167  //bool operator==(const TUInt& UInt) const {return Val==UInt.Val;}
1168  //bool operator==(const uint& UInt) const {return Val==UInt;}
1169  //bool operator!=(const uint& UInt) const {return Val!=UInt;}
1170  //bool operator<(const TUInt& UInt) const {return Val<UInt.Val;}
1171  uint operator()() const {return Val;}
1172  uint& operator()() {return Val;}
1173  TUInt& operator~(){Val=~Val; return *this;}
1174  TUInt& operator&=(const TUInt& UInt){Val&=UInt.Val; return *this;}
1175  TUInt& operator|=(const TUInt& UInt){Val|=UInt.Val; return *this;}
1176  TUInt& operator^=(const TUInt& UInt){Val^=UInt.Val; return *this;}
1177  TUInt& operator>>=(const int& ShiftBits){Val>>=ShiftBits; return *this;}
1178  TUInt& operator<<=(const int& ShiftBits){Val<<=ShiftBits; return *this;}
1179  int GetMemUsed() const {return sizeof(TUInt);}
1180 
1181  int GetPrimHashCd() const {return int(Val);}
1182  int GetSecHashCd() const {return Val/0x10;}
1183 
1184  static uint GetRnd(const uint& Range=0){return Rnd.GetUniDevUInt(Range);}
1185 
1186  TStr GetStr() const {return TUInt::GetStr(Val);}
1187  static TStr GetStr(const uint& Val){
1188  char Bf[255]; sprintf(Bf, "%u", Val); return TStr(Bf);}
1189  static TStr GetStr(const TUInt& UInt){
1190  return GetStr(UInt.Val);}
1191  static TStr GetStr(const uint& Val, const char* FmtStr);
1192  static TStr GetStr(const uint& Val, const TStr& FmtStr){
1193  return GetStr(Val, FmtStr.CStr());}
1194 
1195  static TStr GetKiloStr(const uint& Val){
1196  if (Val>100*1000){return GetStr(Val/1000)+"K";}
1197  else if (Val>1000){return GetStr(Val/1000)+"."+GetStr((Val%1000)/100)+"K";}
1198  else {return GetStr(Val);}}
1199  static TStr GetMegaStr(const uint& Val){
1200  if (Val>100*1000000){return GetStr(Val/1000000)+"M";}
1201  else if (Val>1000000){
1202  return GetStr(Val/1000000)+"."+GetStr((Val%1000000)/100000)+"M";}
1203  else {return GetKiloStr(Val);}}
1204 
1205  static uint JavaUIntToCppUInt(const uint& JavaUInt){
1206  uint B1=(JavaUInt & 0xFF000000) >> 24;
1207  uint B2=(JavaUInt & 0x00FF0000) >> 16;
1208  uint B3=(JavaUInt & 0x0000FF00) >> 8;
1209  uint B4=(JavaUInt & 0x000000FF) >> 0;
1210  uint CppUInt=(B4<<24)+(B3<<16)+(B2<<8)+(B1<<0);
1211  return CppUInt;}
1212 
1213  static bool IsIpStr(const TStr& IpStr, uint& Ip, const char& SplitCh = '.');
1214  static bool IsIpStr(const TStr& IpStr, const char& SplitCh = '.') { uint Ip; return IsIpStr(IpStr, Ip, SplitCh); }
1215  static uint GetUIntFromIpStr(const TStr& IpStr, const char& SplitCh = '.');
1216  static TStr GetStrFromIpUInt(const uint& Ip);
1217  static bool IsIpv6Str(const TStr& IpStr, const char& SplitCh = ':');
1218 };
1219 
1221 // Unsigned-Integer-64Bit
1222 class TUInt64{
1223 public:
1225 public:
1226  static const TUInt64 Mn;
1227  static const TUInt64 Mx;
1228 
1229  TUInt64(): Val(0){}
1230  TUInt64(const TUInt64& Int): Val(Int.Val){}
1231  TUInt64(const uint64& Int): Val(Int){}
1232  TUInt64(const uint& MsVal, const uint& LsVal): Val(0){
1233  Val=(((uint64)MsVal) << 32) | ((uint64)LsVal);}
1234  explicit TUInt64(void* Pt): Val(0){
1235  TConv_Pt64Ints32 Conv(Pt); Val=Conv.GetUInt64();}
1236  operator uint64() const {return Val;}
1237  explicit TUInt64(TSIn& SIn){SIn.Load(Val);}
1238  void Load(TSIn& SIn){SIn.Load(Val);}
1239  void Save(TSOut& SOut) const {SOut.Save(Val);}
1240  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1241  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1242 
1243  TUInt64& operator=(const TUInt64& Int){Val=Int.Val; return *this;}
1244  TUInt64& operator+=(const TUInt64& Int){Val+=Int.Val; return *this;}
1245  TUInt64& operator-=(const TUInt64& Int){Val-=Int.Val; return *this;}
1246  TUInt64 operator++(int){Val++; return *this;}
1247  TUInt64 operator--(int){Val--; return *this;}
1248  int GetMemUsed() const {return sizeof(TUInt64);}
1249 
1250  int GetPrimHashCd() const { return (int)GetMsVal() + (int)GetLsVal(); } //TODO: to check
1251  int GetSecHashCd() const { return ((int)GetMsVal() + (int)GetLsVal()) / 0x10; } //TODO: to check
1252 
1253  uint GetMsVal() const {
1254  return (uint)(Val >> 32);}
1255  uint GetLsVal() const {
1256  return (uint)(Val & 0xffffffff);}
1257 
1258  //TStr GetStr() const {return TStr::Fmt("%Lu", Val);}
1259  //static TStr GetStr(const TUInt64& Int){return TStr::Fmt("%Lu", Int.Val);}
1260  //static TStr GetHexStr(const TUInt64& Int){return TStr::Fmt("%LX", Int.Val);}
1261  #ifdef GLib_WIN
1262  TStr GetStr() const {return TStr::Fmt("%I64u", Val);}
1263  static TStr GetStr(const TUInt64& Int){return TStr::Fmt("%I64u", Int.Val);}
1264  static TStr GetHexStr(const TUInt64& Int){return TStr::Fmt("%I64X", Int.Val);}
1265  #else
1266  TStr GetStr() const {return TStr::Fmt("%llu", Val);}
1267  static TStr GetStr(const TUInt64& Int){return TStr::Fmt("%llu", Int.Val);}
1268  static TStr GetHexStr(const TUInt64& Int){return TStr::Fmt("%llX", Int.Val);}
1269  #endif
1270 
1271  static TStr GetKiloStr(const uint64& Val){
1272  if (Val>100*1000){return GetStr(Val/1000)+"K";}
1273  else if (Val>1000){return GetStr(Val/1000)+"."+GetStr((Val%1000)/100)+"K";}
1274  else {return GetStr(Val);}}
1275  static TStr GetMegaStr(const uint64& Val){
1276  if (Val>100*1000000){return GetStr(Val/1000000)+"M";}
1277  else if (Val>1000000){
1278  return GetStr(Val/1000000)+"."+GetStr((Val%1000000)/100000)+"M";}
1279  else {return GetKiloStr(Val);}}
1280  /*static TStr GetGigaStr(const uint64& Val){
1281  if (Val>100*1000000000){return GetStr(Val/1000000000)+"G";}
1282  else if (Val>1000000000){
1283  return GetStr(Val/1000000000)+"."+GetStr((Val%1000000000)/100000000)+"G";}
1284  else {return GetMegaStr(Val);}}*/
1285 };
1286 
1288 // Float
1289 class TFlt{
1290 public:
1291  double Val;
1292 public:
1293  static const double Mn;
1294  static const double Mx;
1295  static const double NInf;
1296  static const double PInf;
1297  static const double Eps;
1298  static const double EpsHalf;
1299  static TRnd Rnd;
1300 
1301  TFlt(): Val(0){}
1302  TFlt(const double& _Val): Val(_Val){}
1303  operator double() const {return Val;}
1304  explicit TFlt(TSIn& SIn){SIn.Load(Val);}
1305  void Save(TSOut& SOut) const {SOut.Save(Val);}
1306  explicit TFlt(TSIn& SIn, const bool& IsTxt){
1307  if (IsTxt){TStr Str(SIn, true); Val=Str.GetFlt(0);} else {SIn.Load(Val);}}
1308  void Load(TSIn& SIn){SIn.Load(Val);}
1309  void Save(TSOut& SOut, const bool& IsTxt) const {
1310  if (IsTxt){GetStr(Val).Save(SOut, true);} else {SOut.Save(Val);}}
1311  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1312  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1313 
1314  TFlt& operator=(const TFlt& Flt){Val=Flt.Val; return *this;}
1315  TFlt& operator=(const double& Flt){Val=Flt; return *this;}
1316  bool operator==(const TFlt& Flt) const _CMPWARN {return Val==Flt.Val;}
1317  bool operator==(const double& Flt) const _CMPWARN {return Val==Flt;}
1318  bool operator!=(const double& Flt) const _CMPWARN {return Val!=Flt;}
1319  double operator()() const {return Val;}
1320  TFlt& operator+=(const double& Flt){Val+=Flt; return *this;}
1321  TFlt& operator-=(const double& Flt){Val-=Flt; return *this;}
1322  TFlt& operator*=(const double& Flt){Val*=Flt; return *this;}
1323  TFlt& operator/=(const double& Flt){Val/=Flt; return *this;}
1324  TFlt operator++(int){Val++; return *this;}
1325  TFlt operator--(int){Val--; return *this;}
1326  int GetMemUsed() const {return sizeof(TFlt);}
1327 
1328  int GetPrimHashCd() const {
1329  int Expn; return int((frexp(Val, &Expn)-0.5)*double(TInt::Mx));}
1330  int GetSecHashCd() const {
1331  int Expn; frexp(Val, &Expn); return Expn;}
1332 
1333  static double Abs(const double& Flt){return Flt<0?-Flt:Flt;}
1334  static int Sign(const double& Flt){return Flt<0?-1:(Flt>0?1:0);}
1335  static int Round(const double& Flt){return int(floor(Flt+0.5));}
1336  static double GetRnd(){return Rnd.GetUniDev();}
1337  static bool Eq6(const double& LFlt, const double& RFlt){
1338  return fabs(LFlt-RFlt)<0.000001;}
1339 
1340  static double GetMn(const double& Flt1, const double& Flt2){
1341  return Flt1<Flt2?Flt1:Flt2;}
1342  static double GetMn(const double& Flt1, const double& Flt2, const double& Flt3){
1343  return GetMn(GetMn(Flt1, Flt2), Flt3); }
1344  static double GetMn(const double& Flt1, const double& Flt2, const double& Flt3, const double& Flt4){
1345  return GetMn(GetMn(Flt1, Flt2), GetMn(Flt3, Flt4)); }
1346 
1347  static double GetMx(const double& Flt1, const double& Flt2){
1348  return Flt1>Flt2?Flt1:Flt2;}
1349  static double GetMx(const double& Flt1, const double& Flt2, const double Flt3){
1350  return GetMx(GetMx(Flt1, Flt2), Flt3); }
1351  static double GetMx(const double& Flt1, const double& Flt2, const double Flt3, const double& Flt4){
1352  return GetMx(GetMx(Flt1, Flt2), GetMx(Flt3, Flt4)); }
1353 
1354  static double GetInRng(const double& Val, const double& Mn, const double& Mx){
1355  IAssert(Mn<=Mx); return Val<Mn?Mn:(Val>Mx?Mx:Val);}
1356 
1357  static bool IsNum(const double& Val){
1358  return (Mn<=Val)&&(Val<=Mx);}
1359  static bool IsNan(const double& Val){
1360  return (Val!=Val);}
1361 
1362  bool IsNum() const { return IsNum(Val); }
1363  bool IsNan() const { return IsNan(Val); }
1364 
1365  TStr GetStr() const {return TFlt::GetStr(Val);}
1366  static TStr GetStr(const double& Val, const int& Width=-1, const int& Prec=-1);
1367  static TStr GetStr(const TFlt& Flt, const int& Width=-1, const int& Prec=-1){
1368  return GetStr(Flt.Val, Width, Prec);}
1369  static TStr GetStr(const double& Val, const char* FmtStr);
1370  static TStr GetStr(const double& Val, const TStr& FmtStr){
1371  return GetStr(Val, FmtStr.CStr());}
1372  static TStr GetPrcStr(const double& RelVal, const double& FullVal){
1373  return GetStr(100*RelVal/FullVal, "%3.0f%%");}
1374 
1375  static TStr GetKiloStr(const double& Val){
1376  if (fabs(Val)>100*1000){return TStr::Fmt("%.0fK", Val/1000);}
1377  else if (fabs(Val)>1000){return TStr::Fmt("%.1fK", Val/1000);}
1378  else {return TStr::Fmt("%.0f", Val);}}
1379  static TStr GetMegaStr(const double& Val){
1380  if (fabs(Val)>100*1000000){return TStr::Fmt("%.0fM", Val/1000000);}
1381  else if (fabs(Val)>1000000){return TStr::Fmt("%.1fM", Val/1000000);}
1382  else {return GetKiloStr(Val);}}
1383  static TStr GetGigaStr(const double& Val){
1384  if (fabs(Val)>100*1000000000.0){return TStr::Fmt("%.0fG", Val/1000000000.0);}
1385  else if (fabs(Val)>1000000000.0){return TStr::Fmt("%.1fG", Val/1000000000.0);}
1386  else {return GetMegaStr(Val);}}
1387 };
1388 
1390 // Ascii-Float
1391 class TAscFlt: public TFlt{
1392 public:
1393  TAscFlt(): TFlt(){}
1394  TAscFlt(const double& Val): TFlt(Val){}
1395  explicit TAscFlt(TSIn& SIn): TFlt(SIn, true){}
1396  void Save(TSOut& SOut) const {TFlt::Save(SOut, true);}
1397 };
1398 
1400 // Short-Float
1401 class TSFlt{
1402 public:
1404 public:
1405  static const sdouble Mn;
1406  static const sdouble Mx;
1407 
1408  TSFlt(): Val(0){}
1409  TSFlt(const sdouble& _Val): Val(sdouble(_Val)){}
1410  //TSFlt(const double& _Val): Val(sdouble(_Val)){}
1411  operator sdouble() const {return Val;}
1412  //operator double() const {return Val;}
1413  explicit TSFlt(TSIn& SIn){SIn.Load(Val);}
1414  void Save(TSOut& SOut) const {SOut.Save(Val);}
1415  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1416  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1417 
1418  TSFlt& operator=(const TSFlt& SFlt){Val=SFlt.Val; return *this;}
1419  bool operator==(const TSFlt& SFlt) const _CMPWARN {return Val==SFlt.Val;}
1420  bool operator==(const double& Flt) const _CMPWARN {return Val==Flt;}
1421  bool operator!=(const double& Flt) const _CMPWARN {return Val!=Flt;}
1422  bool operator<(const TSFlt& SFlt) const {return Val<SFlt.Val;}
1423  sdouble operator()() const {return Val;}
1424  TSFlt& operator+=(const double& SFlt){Val+=sdouble(SFlt); return *this;}
1425  TSFlt& operator-=(const double& SFlt){Val-=sdouble(SFlt); return *this;}
1426  TSFlt& operator*=(const double& SFlt){Val*=sdouble(SFlt); return *this;}
1427  TSFlt& operator/=(const double& SFlt){Val/=sdouble(SFlt); return *this;}
1428  TSFlt operator++(int){Val++; return *this;}
1429  TSFlt operator--(int){Val--; return *this;}
1430  int GetMemUsed() const {return sizeof(TSFlt);}
1431 
1432  int GetPrimHashCd() const {
1433  int Expn; return int((frexp(Val, &Expn)-0.5)*double(TInt::Mx));}
1434  int GetSecHashCd() const {
1435  int Expn; frexp(Val, &Expn); return Expn;}
1436 };
1437 
1439 // Long-Float
1440 class TLFlt{
1441 public:
1443 public:
1444  static const ldouble Mn;
1445  static const ldouble Mx;
1446 
1447  TLFlt(): Val(0){}
1448  TLFlt(const ldouble& _Val): Val(_Val){}
1449  operator ldouble() const {return Val;}
1450  explicit TLFlt(TSIn& SIn){SIn.Load(Val);}
1451  void Save(TSOut& SOut) const {SOut.Save(Val);}
1452  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1453  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1454 
1455  TLFlt& operator=(const TLFlt& LFlt){Val=LFlt.Val; return *this;}
1456  bool operator==(const TLFlt& LFlt) const _CMPWARN {return Val==LFlt.Val;}
1457  bool operator==(const ldouble& LFlt) const _CMPWARN {return Val==LFlt;}
1458  bool operator!=(const ldouble& LFlt) const _CMPWARN {return Val!=LFlt;}
1459  bool operator<(const TLFlt& LFlt) const {return Val<LFlt.Val;}
1460  ldouble operator()() const {return Val;}
1461  TLFlt& operator+=(const ldouble& LFlt){Val+=LFlt; return *this;}
1462  TLFlt& operator-=(const ldouble& LFlt){Val-=LFlt; return *this;}
1463  int GetMemUsed() const {return sizeof(TLFlt);}
1464 
1465  int GetPrimHashCd() const {Fail; return 0;}
1466  int GetSecHashCd() const {Fail; return 0;}
1467 
1468  static TStr GetStr(const ldouble& Val, const int& Width=-1, const int& Prec=-1);
1469  static TStr GetStr(const TLFlt& LFlt, const int& Width=-1, const int& Prec=-1){
1470  return GetStr(LFlt.Val, Width, Prec);}
1471  static TStr GetStr(const ldouble& Val, const char* FmtStr);
1472  static TStr GetStr(const ldouble& Val, const TStr& FmtStr){
1473  return GetStr(Val, FmtStr.CStr());}
1474 };
1475 
1477 // Float-Rectangle
1478 class TFltRect{
1479 public:
1481 public:
1483  MnX(), MnY(), MxX(), MxY(){}
1484  TFltRect(const TFltRect& FltRect):
1485  MnX(FltRect.MnX), MnY(FltRect.MnY), MxX(FltRect.MxX), MxY(FltRect.MxY){}
1487  const double& _MnX, const double& _MnY,
1488  const double& _MxX, const double& _MxY):
1489  MnX(_MnX), MnY(_MnY), MxX(_MxX), MxY(_MxY){}
1491  MnX(SIn), MnY(SIn), MxX(SIn), MxY(SIn){}
1492  void Save(TSOut& SOut) const {
1493  MnX.Save(SOut); MnY.Save(SOut); MxX.Save(SOut); MxY.Save(SOut);}
1494  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1495  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1496 
1497  TFltRect& operator=(const TFltRect& FltRect){
1498  MnX=FltRect.MnX; MnY=FltRect.MnY; MxX=FltRect.MxX; MxY=FltRect.MxY;
1499  return *this;}
1500 
1501  // get coordinates
1502  double GetMnX() const {return MnX;}
1503  double GetMnY() const {return MnY;}
1504  double GetMxX() const {return MxX;}
1505  double GetMxY() const {return MxY;}
1506 
1507  // get lengths
1508  double GetXLen() const {return MxX-MnX;}
1509  double GetYLen() const {return MxY-MnY;}
1510 
1511  // get centers
1512  double GetXCenter() const {return MnX+(MxX-MnX)/2;}
1513  double GetYCenter() const {return MnY+(MxY-MnY)/2;}
1514 
1515  // tests
1516  bool IsXYIn(const double& X, const double& Y) const {
1517  return (MnX<=X)&&(X<=MxX)&&(MnY<=Y)&&(Y<=MxY);}
1518  static bool Intersection(const TFltRect& Rect1, const TFltRect& Rect2);
1519 
1520  // string
1521  TStr GetStr() const;
1522 };
1523 
TSFlt & operator/=(const double &SFlt)
Definition: dt.h:1427
#define IAssert(Cond)
Definition: bd.h:262
TChAIn & operator=(const TChAIn &)
int GetPrimHashCd() const
Definition: dt.h:1075
static int CmpI(const char *CStr1, const char *CStr2)
Definition: dt.cpp:699
bool operator==(const double &Flt) const _CMPWARN
Definition: dt.h:1317
static bool IsHex(const char &Ch)
Definition: dt.h:974
int GetInt() const
Definition: dt.h:579
Definition: bd.h:514
char * GetCStr() const
Definition: dt.h:686
bool IsUInt() const
Definition: dt.h:586
bool operator==(const TDbStr &DbStr) const
Definition: dt.h:737
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:1165
TStr(const char &Ch, bool)
Definition: dt.h:416
TFlt & operator*=(const double &Flt)
Definition: dt.h:1322
void Save(TSOut &SOut) const
Definition: dt.h:1396
int SearchCh(const char &Ch, const int &BChN=0) const
Definition: dt.cpp:1043
static TStr GetHexStr(const int &Val)
Definition: dt.h:1121
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:1295
ldouble operator()() const
Definition: dt.h:1460
TMemOut(const PMem &_Mem)
Definition: dt.cpp:334
TUInt()
Definition: dt.h:1154
static TStr GetPrcStr(const double &RelVal, const double &FullVal)
Definition: dt.h:1372
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:1455
TUInt64 operator--(int)
Definition: dt.h:1247
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:1351
static PMem New(const PMem &Mem)
Definition: dt.h:96
static const uint Mn
Definition: dt.h:1150
TStr GetStr() const
Definition: dt.h:1104
#define IAssertR(Cond, Reason)
Definition: bd.h:265
static const int Kilo
Definition: dt.h:1047
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:965
bool IsInt64() const
Definition: dt.h:594
TLFlt(const ldouble &_Val)
Definition: dt.h:1448
TStr(const TChA &ChA)
Definition: dt.h:425
TSFlt(TSIn &SIn)
Definition: dt.h:1413
uint GetLsVal() const
Definition: dt.h:1255
static PSOut New(const TStr &FNm, const bool &Append=false)
Definition: fl.cpp:442
static uint JavaUIntToCppUInt(const uint &JavaUInt)
Definition: dt.h:1205
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:1268
void Save(TSOut &SOut) const
Definition: dt.h:733
int GetPrimHashCd() const
Definition: dt.h:964
TStr Right(const int &BChN) const
Definition: dt.h:546
TRStr()
Definition: dt.h:351
bool operator!=(const char *_CStr) const
Definition: dt.h:236
TUCh(TSIn &SIn)
Definition: dt.h:1008
static TStr GetMegaStr(const int &Val)
Definition: dt.h:1130
void Save(TSOut &SOut) const
Definition: dt.h:1492
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:618
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:1503
static TStr GetStr(const uint64 &Val)
Definition: dt.h:1118
static int GetInRng(const int &Val, const int &Mn, const int &Mx)
Definition: dt.h:1101
int GetNextSeed()
Definition: dt.h:17
static TStr GetKiloStr(const uint64 &Val)
Definition: dt.h:1271
static bool IsNum(const char &Ch)
Definition: dt.h:971
int BfC
Definition: dt.h:702
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:1478
TSInt(TSIn &SIn)
Definition: dt.h:1032
static const sdouble Mn
Definition: dt.h:1405
static PStrPool Load(TSIn &SIn, bool LoadCompacted=true)
Definition: dt.h:795
bool IsFlt() const
Definition: dt.h:628
static TStr GetStr(const int &Val, const TStr &FmtStr)
Definition: dt.h:1109
TSFlt & operator-=(const double &SFlt)
Definition: dt.h:1425
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:1093
TStr GetFPath() const
Definition: dt.cpp:1389
TFltRect & operator=(const TFltRect &FltRect)
Definition: dt.h:1497
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:619
int Val
Definition: dt.h:1043
sdouble Val
Definition: dt.h:1403
static const uint Mx
Definition: dt.h:1151
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:1323
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:1833
void Save(TSOut &SOut) const
Definition: dt.h:1057
bool IsFlt(double &Val) const
Definition: dt.h:627
static double GetMx(const double &Flt1, const double &Flt2)
Definition: dt.h:1347
bool operator!=(const char *CStr) const
Definition: dt.h:467
TDbStr(const TStr &_Str1, const TStr &_Str2)
Definition: dt.h:731
void FlushBf()
bool IsLc() const
Definition: dt.h:497
int Len() const
Definition: dt.h:134
TUCh(const uchar &_Val)
Definition: dt.h:1006
unsigned int uint
Definition: bd.h:11
bool IsXYIn(const double &X, const double &Y) const
Definition: dt.h:1516
TMem & operator=(const TMem &Mem)
Definition: dt.h:108
bool IsHexInt() const
Definition: dt.h:611
PSIn GetSIn(const bool &IsCut=true, const int &CutBfL=-1)
Definition: fl.cpp:666
static TStr GetStr(const double &Val, const TStr &FmtStr)
Definition: dt.h:1370
static TStr GetStr(const TUInt64 &Int)
Definition: dt.h:1267
static int GetMx(const int &Int1, const int &Int2)
Definition: dt.h:1089
TUInt64(const TUInt64 &Int)
Definition: dt.h:1230
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:1046
TRnd(TSIn &SIn)
Definition: dt.h:22
#define Fail
Definition: bd.h:238
bool operator!=(const double &Flt) const _CMPWARN
Definition: dt.h:1421
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:1458
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 char * SaveFrugalInt(char *pDest, int i)
Definition: dt.cpp:1954
TSFlt & operator*=(const double &SFlt)
Definition: dt.h:1426
void PutCh(const int &ChN, const char &Ch)
Definition: dt.h:278
static char GetHexCh(const int &Val)
Definition: dt.h:981
TFlt(TSIn &SIn)
Definition: dt.h:1304
TStr Str2
Definition: dt.h:726
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:1009
double Val
Definition: dt.h:1291
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:1298
TUInt64 operator++(int)
Definition: dt.h:1246
TCh(const char &_Val)
Definition: dt.h:951
bool IsPrefix(const TStr &Str) const
Definition: dt.h:557
int GetPrimHashCd() const
Definition: dt.h:1465
TFlt & operator=(const double &Flt)
Definition: dt.h:1315
static PStrPool New(const uint &_MxBfLen=0, const uint &_GrowBy=16 *1024 *1024)
Definition: dt.h:792
bool IsChIn(const char &Ch) const
Definition: dt.h:300
static bool IsNum(const double &Val)
Definition: dt.h:1357
static void SaveFrugalIntV(TSOut &SOut, const TVec< TInt, int > &IntV)
Definition: dt.cpp:2018
static TStr GetMegaStr(const double &Val)
Definition: dt.h:1379
TInt & operator-=(const int &Int)
Definition: dt.h:1070
uint Size() const
Definition: dt.h:800
int GetPrimHashCd() const
Definition: dt.h:570
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:1013
uint64 GetUniDevUInt64(const uint64 &Range=0)
Definition: dt.cpp:57
bool Empty() const
Definition: dt.h:749
TInt operator--(int)
Definition: dt.h:1072
void Save(TSOut &SOut) const
Definition: dt.h:1034
static const bool Mx
Definition: dt.h:886
TSFlt()
Definition: dt.h:1408
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:1231
virtual int GetBf(const void *Bf, const TSize &BfL)=0
static int GetHex(const char &Ch)
Definition: dt.h:976
double GetMxY() const
Definition: dt.h:1505
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:1320
TDbStr & operator=(const TDbStr &DbStr)
Definition: dt.h:735
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:1175
int Cmp(uint64 Offset, const char *Str) const
Definition: dt.h:856
int GetSecHashCd() const
Definition: dt.h:571
int GetMemUsed() const
Definition: dt.h:962
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:1423
static double GetMn(const double &Flt1, const double &Flt2, const double &Flt3)
Definition: dt.h:1342
bool operator==(const char &Ch) const
Definition: dt.h:234
bool operator==(const TSFlt &SFlt) const _CMPWARN
Definition: dt.h:1419
TStr & operator=(const char &Ch)
Definition: dt.h:451
bool operator==(const TInt &Int) const
Definition: dt.h:1063
int64 GetHexInt64() const
Definition: dt.h:620
TStr GetFExt() const
Definition: dt.cpp:1421
bool IsInt64(int64 &Val) const
Definition: dt.h:593
int GetSecHashCd() const
Definition: dt.h:1020
static TStr GetKiloStr(const uint &Val)
Definition: dt.h:1195
TPt< TStrPool > PStrPool
Definition: dt.h:779
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
TStr Str
Definition: dt.h:700
void Load(TSIn &SIn)
Definition: dt.h:1238
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:1480
uint & operator()()
Definition: dt.h:1172
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:1192
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:1050
TStr & ToCap()
Definition: dt.cpp:764
bool operator!=(const int &Int) const
Definition: dt.h:1065
TLFlt & operator+=(const ldouble &LFlt)
Definition: dt.h:1461
TLFlt & operator-=(const ldouble &LFlt)
Definition: dt.h:1462
static TStr GetStr(const uint &Val)
Definition: dt.h:1187
static const double Mx
Definition: dt.h:1294
int ChangeChAll(const char &SrcCh, const char &DstCh)
Definition: dt.cpp:1113
double GetXCenter() const
Definition: dt.h:1512
TDbStr(const TDbStr &DbStr)
Definition: dt.h:729
int MxBfL
Definition: dt.h:203
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:2263
void Reset()
Definition: dt.h:717
Definition: dt.h:830
bool IsHexInt(int &Val) const
Definition: dt.h:610
TBool & operator=(const TBool &Bool)
Definition: dt.h:906
static PSIn New(const PMem &Mem)
Definition: dt.h:167
TAscFlt()
Definition: dt.h:1393
TCh(TSIn &SIn)
Definition: dt.h:953
static const TStr YStr
Definition: dt.h:893
Definition: dt.h:1440
int GetSecHashCd() const
Definition: dt.h:746
static double GetMx(const double &Flt1, const double &Flt2, const double Flt3)
Definition: dt.h:1349
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:1289
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:604
static const ldouble Mn
Definition: dt.h:1444
bool operator==(const TCh &Ch) const
Definition: dt.h:959
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:1248
Definition: fl.h:58
TInt & operator=(const TInt &Int)
Definition: dt.h:1061
int GetPrimHashCd() const
Definition: dt.h:1328
static const int Giga
Definition: dt.h:1049
TUInt64(TSIn &SIn)
Definition: dt.h:1237
char GetCh()
Definition: dt.h:337
Definition: dt.h:182
int GetSecHashCd() const
Definition: dt.h:1434
double GetFlt() const
Definition: dt.h:629
double GetGammaDev(const int &Order)
Definition: dt.cpp:95
char * operator()()
Definition: dt.h:253
static TStr GetStr(const TUInt &UInt)
Definition: dt.h:1189
static TStr GetMegaStr(const uint &Val)
Definition: dt.h:1199
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:1484
void SplitOnCh(TStr &LStr, const char &SplitCh, TStr &RStr) const
Definition: dt.cpp:901
TInt(TSIn &SIn)
Definition: dt.h:1055
void Optimize()
Definition: dt.cpp:729
void Save(TSOut &SOut, const bool &IsTxt) const
Definition: dt.h:1309
static const TStr FalseStr
Definition: dt.h:890
int GetPrimHashCd() const
Definition: dt.h:1019
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:1048
static const char Mx
Definition: dt.h:940
int64 GetInt64() const
Definition: dt.h:595
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:2232
static int Sign(const int &Int)
Definition: dt.h:1079
void DelLastCh()
Definition: dt.h:263
TSFlt & operator+=(const double &SFlt)
Definition: dt.h:1424
void Reverse()
Definition: dt.cpp:440
static TStr GetMegaStr(const uint64 &Val)
Definition: dt.h:1275
bool Empty() const
Definition: dt.h:801
char * Bf
Definition: dt.h:348
bool IsUInt64(uint64 &Val) const
Definition: dt.h:602
int GetSecHashCd() const
Definition: dt.h:914
void Clr(bool DoDel=false)
Definition: dt.h:816
void Save(TSOut &SOut) const
Definition: dt.h:1159
uint GetUInt() const
Definition: dt.h:587
bool IsInt(int &Val) const
Definition: dt.h:577
TAscFlt(const double &Val)
Definition: dt.h:1394
int GetSecHashCd() const
Definition: dt.h:1466
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:779
bool Empty() const
Definition: dt.h:383
static PSIn New(const TStr &FNm)
Definition: fl.cpp:290
TDbStr(TSIn &SIn)
Definition: dt.h:732
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:714
static double GetMn(const double &Flt1, const double &Flt2, const double &Flt3, const double &Flt4)
Definition: dt.h:1344
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:1811
static const int Mn
Definition: dt.h:1045
uint64 GetUInt64(const uint64 &DfVal) const
Definition: dt.h:606
void Push(const char &Ch)
Definition: dt.h:138
static TStr GetKiloStr(const double &Val)
Definition: dt.h:1375
int BfL
Definition: dt.h:79
TUInt & operator<<=(const int &ShiftBits)
Definition: dt.h:1178
int SearchChBack(const char &Ch, int BChN=-1) const
Definition: dt.cpp:477
static bool IsWs(const char &Ch)
Definition: dt.h:967
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:744
int GetPrimHashCd() const
Definition: dt.h:1250
TStr GetStr(const TStr &MidStr=TStr()) const
Definition: dt.h:742
TRStr(const char *CStr)
Definition: dt.h:354
int GetPrimHashCd() const
Definition: dt.h:1035
int GetMemUsed() const
Definition: dt.h:1326
TUInt(const uint &_Val)
Definition: dt.h:1155
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:1087
Definition: dt.h:698
void Save(TSOut &SOut) const
Definition: dt.h:1414
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:1163
TMem(const void *_Bf, const int &_BfL)
Definition: dt.h:88
TInt()
Definition: dt.h:1052
int GetSecHashCd() const
Definition: dt.h:1076
void Save(TSOut &SOut, const bool &IsSmall=false) const
Definition: dt.h:440
TFlt MnY
Definition: dt.h:1480
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:578
static const char TabCh
Definition: dt.h:944
static const char Mn
Definition: dt.h:939
TFlt(const double &_Val)
Definition: dt.h:1302
~TMem()
Definition: dt.h:99
TSFlt & operator=(const TSFlt &SFlt)
Definition: dt.h:1418
static TStr Get01Str(const bool &Val)
Definition: dt.h:926
bool operator==(const TFlt &Flt) const _CMPWARN
Definition: dt.h:1316
void Load(bool &Bool)
Definition: fl.h:84
TSFlt(const sdouble &_Val)
Definition: dt.h:1409
int64 GetHexInt64(const int64 &DfVal) const
Definition: dt.h:622
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:1033
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:709
void MkRef()
Definition: dt.h:378
TUInt & operator~()
Definition: dt.h:1173
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:1123
TFlt MxY
Definition: dt.h:1480
TMemIn(const TMem &_Mem, const int &_BfC=0)
Definition: dt.cpp:315
static bool IsIpStr(const TStr &IpStr, const char &SplitCh= '.')
Definition: dt.h:1214
static int GetNum(const char &Ch)
Definition: dt.h:973
static TStr GetStr(const TLFlt &LFlt, const int &Width=-1, const int &Prec=-1)
Definition: dt.h:1469
TStr GetStr() const
Definition: dt.h:1186
uint GetUniDevUInt(const uint &Range=0)
Definition: dt.cpp:45
TUInt64 & operator=(const TUInt64 &Int)
Definition: dt.h:1243
TStr Str1
Definition: dt.h:725
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:1056
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:793
~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:1084
Definition: lx.h:251
void Save(TSOut &SOut) const
Definition: dt.h:1451
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:1239
Definition: dt.h:1401
TStr & ConvUsFromYuAscii()
Definition: dt.cpp:779
int GetSecHashCd() const
Definition: dt.cpp:611
int GetMemUsed() const
Definition: dt.h:1463
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:1325
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:1016
TFlt(TSIn &SIn, const bool &IsTxt)
Definition: dt.h:1306
TCh()
Definition: dt.h:950
TUInt & operator&=(const TUInt &UInt)
Definition: dt.h:1174
bool operator==(const TVoid &) const
Definition: dt.h:874
void Load(TSIn &SIn)
Definition: dt.h:1158
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:669
static const int Vals
Definition: dt.h:1003
bool operator<(const int &Int) const
Definition: dt.h:1067
TStr & operator=(const TStr &Str)
Definition: dt.h:445
double GetYLen() const
Definition: dt.h:1509
void Trunc(const int &_BfL)
Definition: dt.h:136
TInt(const int &_Val)
Definition: dt.h:1053
bool operator<(const TCh &Ch) const
Definition: dt.h:960
bool operator!=(const double &Flt) const _CMPWARN
Definition: dt.h:1318
bool operator<(const TUCh &UCh) const
Definition: dt.h:1015
uint GetUInt(const uint &DfVal) const
Definition: dt.h:588
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:713
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:673
static TStr GetNrFExt(const TStr &FExt)
Definition: dt.cpp:1455
void Save(TSOut &) const
Definition: dt.h:869
static TStr GetNullStr()
Definition: dt.cpp:1626
TStr & ToLc()
Definition: dt.cpp:758
static const sdouble Mx
Definition: dt.h:1406
bool operator<(const TChA &ChA) const
Definition: dt.h:238
TDbStr()
Definition: dt.h:728
static TStr GetStr(const int &Val)
Definition: dt.h:1106
int GetMemUsed() const
Definition: dt.h:1430
TUInt64 & operator-=(const TUInt64 &Int)
Definition: dt.h:1245
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:1362
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:1383
TCh & operator=(const TCh &Ch)
Definition: dt.h:958
TLFlt()
Definition: dt.h:1447
unsigned char uchar
Definition: bd.h:10
TChA(TSIn &SIn)
Definition: dt.h:220
double GetMxX() const
Definition: dt.h:1504
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:1232
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:1456
int GetMemUsed() const
Definition: dt.h:1179
void Trunc()
Definition: dt.cpp:420
bool operator<(const TVoid &) const
Definition: dt.h:875
TFlt()
Definition: dt.h:1301
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:1017
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:1025
static const char LfCh
Definition: dt.h:945
int64 GetInt64(const int64 &DfVal) const
Definition: dt.h:597
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:679
void Save(const bool &Bool)
Definition: fl.h:173
static uint GetRnd(const uint &Range=0)
Definition: dt.h:1184
TDbStr(const TStr &_Str1)
Definition: dt.h:730
int GetSecHashCd() const
Definition: dt.h:1036
TRnd(const int &_Seed=1, const int &Steps=0)
Definition: dt.h:20
static double Abs(const double &Flt)
Definition: dt.h:1333
static double GetUniDevStep(const int &Seed, const int &Steps)
Definition: dt.h:64
static int Round(const double &Flt)
Definition: dt.h:1335
TFlt operator++(int)
Definition: dt.h:1324
Definition: dt.h:1041
bool GetNextLnBf(TChA &LnChA)
Definition: dt.cpp:326
TStr Left(const int &EChN) const
Definition: dt.h:545
static TStr PutFBase(const TStr &FNm, const TStr &FBase)
Definition: dt.cpp:1511
TSFlt operator--(int)
Definition: dt.h:1429
char PeekCh()
Definition: dt.h:715
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:417
static PStrPool New(const TStr &fileName)
Definition: dt.h:794
void SaveTxt(TOLx &Lx) const
Definition: dt.cpp:219
TUInt & operator=(const uint &_Val)
Definition: dt.h:1164
static const TStr YesStr
Definition: dt.h:895
Definition: dt.h:201
TUInt operator--(int)
Definition: dt.h:1166
static TStr GetNumFNm(const TStr &FNm, const int &Num)
Definition: dt.cpp:1527
uchar Val
Definition: dt.h:999
void Save(TSOut &SOut) const
Definition: dt.h:954
static int Abs(const int &Int)
Definition: dt.h:1078
TUInt64()
Definition: dt.h:1229
static const bool Mn
Definition: dt.h:885
void Save(const TStr &FNm)
Definition: dt.h:797
uint64 Reserved() const
Definition: dt.h:854
bool operator<(const TLFlt &LFlt) const
Definition: dt.h:1459
Definition: dt.h:1146
TFltRect()
Definition: dt.h:1482
bool IsNan() const
Definition: dt.h:1363
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:1082
Definition: dt.h:723
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:972
static int GetMx(const int &Int1, const int &Int2, const int &Int3, const int &Int4)
Definition: dt.h:1098
void Save(TSOut &SOut, const bool &IsSmall) const
Definition: dt.h:371
float sdouble
Definition: bd.h:15
TFlt MxX
Definition: dt.h:1480
TStr LeftOf(const char &SplitCh) const
Definition: dt.cpp:873
TInt & operator=(const int &Int)
Definition: dt.h:1062
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:1513
TInt operator++(int)
Definition: dt.h:1071
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:1340
TStr GetStr() const
Definition: dt.h:1266
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:1157
TStr & operator+=(const TStr &Str)
Definition: dt.h:453
TFltRect(TSIn &SIn)
Definition: dt.h:1490
TBool()
Definition: dt.h:897
static const ldouble Mx
Definition: dt.h:1445
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:1428
~TStrPool()
Definition: dt.h:790
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:969
Definition: dt.h:412
TSInt()
Definition: dt.h:1029
TChA & operator=(const TChA &ChA)
Definition: dt.cpp:366
int GetMemUsed() const
Definition: dt.h:1073
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:1224
bool IsChIn(const char &Ch) const
Definition: dt.h:554
TStr & ToTrunc()
Definition: dt.cpp:770
TStr GetCap() const
Definition: dt.h:502
static double GetRnd()
Definition: dt.h:1336
TStr LeftOfLast(const char &SplitCh) const
Definition: dt.cpp:880
bool operator<(const TInt &Int) const
Definition: dt.h:1066
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:689
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:2151
static bool IsNan(const double &Val)
Definition: dt.h:1359
double operator()() const
Definition: dt.h:1319
void Swap(const int &ChN1, const int &ChN2)
Definition: dt.cpp:595
int GetHexInt(const int &DfVal) const
Definition: dt.h:614
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:1152
int BfC
Definition: dt.h:325
TStr GetStr() const
Definition: dt.cpp:2325
bool Eof()
Definition: dt.h:712
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:1395
void ToUc()
Definition: dt.cpp:667
TStr & operator=(const TChA &ChA)
Definition: dt.h:447
static TStr LoadTxt(const PSIn &SIn)
Definition: dt.h:667
int MxBfL
Definition: dt.h:79
const char * operator()() const
Definition: dt.h:475
double GetFlt(const double &DfVal) const
Definition: dt.h:631
bool IsSuffix(const char *CStr) const
Definition: dt.cpp:518
void Load(TSIn &SIn)
Definition: dt.h:1308
bool IsUInt(uint &Val) const
Definition: dt.h:585
TSInt(const int16 &_Val)
Definition: dt.h:1030
TStr & operator=(const char *CStr)
Definition: dt.h:449
TStr GetHex() const
Definition: dt.h:512
static const char CrCh
Definition: dt.h:946
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:681
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:799
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:1334
int GetSecHashCd() const
Definition: dt.h:1182
bool operator<(const TBool &Bool) const
Definition: dt.h:908
Definition: bd.h:196
static const double PInf
Definition: dt.h:1296
static TStr GetStr(const int64 &Val)
Definition: dt.h:1117
static TStr GetStr(const TCh &Ch)
Definition: dt.h:991
static double GetInRng(const double &Val, const double &Mn, const double &Mx)
Definition: dt.h:1354
uint Val
Definition: dt.h:1148
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:1064
bool operator==(const TBool &Bool) const
Definition: dt.h:907
TStr GetStr() const
Definition: dt.h:1365
TUInt & operator^=(const TUInt &UInt)
Definition: dt.h:1176
bool Filled() const
Definition: dt.h:750
void CompressWs()
Definition: dt.cpp:581
TStr Reverse() const
Definition: dt.h:567
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:1442
TMem(const int &_MxBfL=0)
Definition: dt.h:84
TUInt & operator>>=(const int &ShiftBits)
Definition: dt.h:1177
int Len() const
Definition: dt.h:172
bool operator==(const double &Flt) const _CMPWARN
Definition: dt.h:1420
static const uchar Mx
Definition: dt.h:1002
char * GetBf() const
Definition: dt.h:144
static const TUInt64 Mn
Definition: dt.h:1226
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:1069
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:1457
TUInt64 & operator+=(const TUInt64 &Int)
Definition: dt.h:1244
static char IsUc(const char &Ch)
Definition: dt.h:985
TChA & ToTrunc()
Definition: dt.cpp:568
bool operator!=(const TChA &ChA) const
Definition: dt.h:235
TFlt & operator=(const TFlt &Flt)
Definition: dt.h:1314
static bool Eq6(const double &LFlt, const double &RFlt)
Definition: dt.h:1337
static const int Vals
Definition: dt.h:887
char * Bf
Definition: dt.h:701
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:1181
int BfL
Definition: dt.h:162
TFltRect(const double &_MnX, const double &_MnY, const double &_MxX, const double &_MxY)
Definition: dt.h:1486
TLFlt(TSIn &SIn)
Definition: dt.h:1450
int GetHexInt() const
Definition: dt.h:612
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:961
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:1253
void SplitOnLastCh(TStr &LStr, const char &SplitCh, TStr &RStr) const
Definition: dt.cpp:912
double GetMnX() const
Definition: dt.h:1502
TChA(const char *CStr, const int &StrLen)
Definition: dt.h:211
static TStr GetStr(const uint &Val)
Definition: dt.h:1112
PMem Mem
Definition: dt.h:160
static TStr GetStr(const ldouble &Val, const TStr &FmtStr)
Definition: dt.h:1472
Definition: dt.h:881
char * operator()() const
Definition: dt.h:114
static char GetUc(const char &Ch)
Definition: dt.h:987
TRStr(const char &Ch1, const char &Ch2)
Definition: dt.h:363
TStr Slice(int BChN, int EChNP1) const
Definition: dt.h:547
bool IsStrIn(const TStr &Str) const
Definition: dt.h:555
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:1080
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:560
TStr operator()(const int &BChN, const int &EChNP1) const
Definition: dt.h:548
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:1251
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:1367
int16 Val
Definition: dt.h:1027
int BfL
Definition: dt.h:702
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:1234
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:1432
bool IsUc() const
Definition: dt.h:491
static int GetMn(const int &Int1, const int &Int2, const int &Int3)
Definition: dt.h:1091
bool operator!=(const char &Ch) const
Definition: dt.h:237
uint operator()() const
Definition: dt.h:1171
bool GetNextLnBf(TChA &LnChA)
Definition: dt.cpp:652
static TStr GetStr(const TInt &Int)
Definition: dt.h:1107
Definition: dt.h:1391
TChA(const char *CStr)
Definition: dt.h:209
bool operator<(const TSFlt &SFlt) const
Definition: dt.h:1422
bool operator==(const TUCh &UCh) const
Definition: dt.h:1014
TStr RightOfLast(const char &SplitCh) const
Definition: dt.cpp:894
TCs Cs
Definition: fl.h:44
static const TUInt64 Mx
Definition: dt.h:1227
int GetSeed() const
Definition: dt.h:59
int GetSecHashCd() const
Definition: dt.h:1330
static const uchar Mn
Definition: dt.h:1001
int GetMemUsed() const
Definition: dt.h:911
void Save(TSOut &SOut) const
Definition: dt.h:1305
bool operator<(const TDbStr &DbStr) const
Definition: dt.h:739
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:1321
TUCh()
Definition: dt.h:1005
static bool IsEven(const int &Int)
Definition: dt.h:1085
double GetPowerDev(const double &AlphaSlope)
Definition: dt.h:47
Definition: dt.h:1222
bool operator()() const
Definition: dt.h:910
static const double Eps
Definition: dt.h:1297
bool IsUInt64() const
Definition: dt.h:603
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:1299
static const double Mn
Definition: dt.h:1293
int operator()() const
Definition: dt.h:1068
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:420
Definition: dt.h:346
~TStrIn()
Definition: dt.h:710
char Val
Definition: dt.h:937
Definition: dt.h:997
double GetXLen() const
Definition: dt.h:1508
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:1126
void SaveTxt(const PSOut &SOut) const
Definition: dt.h:671
static TStr GetFNmStr(const TStr &Str, const bool &AlNumOnlyP=true)
Definition: dt.cpp:1531
int GetInt(const int &DfVal) const
Definition: dt.h:580
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:1096