SNAP Library 2.4, User Reference  2015-05-11 19:40:56
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 Load(TSIn& SIn) {SIn.Load(Val);}
955  void Save(TSOut& SOut) const {SOut.Save(Val);}
956  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
957  void SaveXml(TSOut& SOut, const TStr& Nm) const;
958 
959  TCh& operator=(const TCh& Ch){Val=Ch.Val; return *this;}
960  bool operator==(const TCh& Ch) const {return Val==Ch.Val;}
961  bool operator<(const TCh& Ch) const {return Val<Ch.Val;}
962  char operator()() const {return Val;}
963  int GetMemUsed() const {return sizeof(TCh);}
964 
965  int GetPrimHashCd() const {return Val;}
966  int GetSecHashCd() const {return Val;}
967 
968  static bool IsWs(const char& Ch){
969  return (Ch==' ')||(Ch==TabCh)||(Ch==CrCh)||(Ch==LfCh);}
970  static bool IsAlpha(const char& Ch){
971  return (('A'<=Ch)&&(Ch<='Z'))||(('a'<=Ch)&&(Ch<='z'));}
972  static bool IsNum(const char& Ch){return ('0'<=Ch)&&(Ch<='9');}
973  static bool IsAlNum(const char& Ch){return IsAlpha(Ch)||IsNum(Ch);}
974  static int GetNum(const char& Ch){Assert(IsNum(Ch)); return Ch-'0';}
975  static bool IsHex(const char& Ch){return
976  (('0'<=Ch)&&(Ch<='9'))||(('A'<=Ch)&&(Ch<='F'))||(('a'<=Ch)&&(Ch<='f'));}
977  static int GetHex(const char& Ch){
978  if (('0'<=Ch)&&(Ch<='9')){return Ch-'0';}
979  else if (('A'<=Ch)&&(Ch<='F')){return Ch-'A'+10;}
980  else if (('a'<=Ch)&&(Ch<='f')){return Ch-'a'+10;}
981  else Fail; return 0;}
982  static char GetHexCh(const int& Val){
983  if ((0<=Val)&&(Val<=9)){return char('0'+char(Val));}
984  else if ((10<=Val)&&(Val<=15)){return char('A'+char(Val-10));}
985  else Fail; return 0;}
986  static char IsUc(const char& Ch){
987  return ('A'<=Ch)&&(Ch<='Z');}
988  static char GetUc(const char& Ch){
989  if (('a'<=Ch)&&(Ch<='z')){return Ch-'a'+'A';} else {return Ch;}}
990  static char GetUsFromYuAscii(const char& Ch);
991 
992  static TStr GetStr(const TCh& Ch){
993  return TStr(Ch.Val);}
994 };
995 
997 // Unsigned-Char
998 class TUCh{
999 public:
1001 public:
1002  static const uchar Mn;
1003  static const uchar Mx;
1004  static const int Vals;
1005 
1006  TUCh(): Val(TCh::NullCh){}
1007  TUCh(const uchar& _Val): Val(_Val){}
1008  operator uchar() const {return Val;}
1009  explicit TUCh(TSIn& SIn){SIn.Load(Val);}
1010  void Save(TSOut& SOut) const {SOut.Save(Val);}
1011  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1012  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1013 
1014  TUCh& operator=(const TUCh& UCh){Val=UCh.Val; return *this;}
1015  bool operator==(const TUCh& UCh) const {return Val==UCh.Val;}
1016  bool operator<(const TUCh& UCh) const {return Val<UCh.Val;}
1017  uchar operator()() const {return Val;}
1018  int GetMemUsed() const {return sizeof(TUCh);}
1019 
1020  int GetPrimHashCd() const {return Val;}
1021  int GetSecHashCd() const {return Val;}
1022 };
1023 
1025 // Short-Integer
1026 class TSInt{
1027 public:
1029 public:
1030  TSInt(): Val(0){}
1031  TSInt(const int16& _Val): Val(_Val){}
1032  operator int16() const {return Val;}
1033  explicit TSInt(TSIn& SIn){SIn.Load(Val);}
1034  void Load(TSIn& SIn){SIn.Load(Val);}
1035  void Save(TSOut& SOut) const {SOut.Save(Val);}
1036  int GetPrimHashCd() const {return Val;}
1037  int GetSecHashCd() const {return Val/0x10;}
1038 };
1039 
1041 // Integer
1042 class TInt{
1043 public:
1044  int Val;
1045 public:
1046  static const int Mn;
1047  static const int Mx;
1048  static const int Kilo;
1049  static const int Mega;
1050  static const int Giga;
1051  static TRnd Rnd;
1052 
1053  TInt(): Val(0){}
1054  TInt(const int& _Val): Val(_Val){}
1055  operator int() const {return Val;}
1056  explicit TInt(TSIn& SIn){SIn.Load(Val);}
1057  void Load(TSIn& SIn){SIn.Load(Val);}
1058  void Save(TSOut& SOut) const {SOut.Save(Val);}
1059  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1060  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1061 
1062  TInt& operator=(const TInt& Int){Val=Int.Val; return *this;}
1063  TInt& operator=(const int& Int){Val=Int; return *this;}
1064  bool operator==(const TInt& Int) const {return Val==Int.Val;}
1065  bool operator==(const int& Int) const {return Val==Int;}
1066  bool operator!=(const int& Int) const {return Val!=Int;}
1067  bool operator<(const TInt& Int) const {return Val<Int.Val;}
1068  bool operator<(const int& Int) const {return Val<Int;}
1069  int operator()() const {return Val;}
1070  TInt& operator+=(const int& Int){Val+=Int; return *this;}
1071  TInt& operator-=(const int& Int){Val-=Int; return *this;}
1072  TInt operator++(int){Val++; return *this;}
1073  TInt operator--(int){Val--; return *this;}
1074  int GetMemUsed() const {return sizeof(TInt);}
1075 
1076  int GetPrimHashCd() const {return Val;}
1077  int GetSecHashCd() const {return Val/0x10;}
1078 
1079  static int Abs(const int& Int){return Int<0?-Int:Int;}
1080  static int Sign(const int& Int){return Int<0?-1:(Int>0?1:0);}
1081  static void Swap(int& Int1, int& Int2){
1082  int SwapInt1=Int1; Int1=Int2; Int2=SwapInt1;}
1083  static int GetRnd(const int& Range=0){return Rnd.GetUniDevInt(Range);}
1084 
1085  static bool IsOdd(const int& Int){return ((Int%2)==1);}
1086  static bool IsEven(const int& Int){return ((Int%2)==0);}
1087 
1088  static int GetMn(const int& Int1, const int& Int2){
1089  return Int1<Int2?Int1:Int2;}
1090  static int GetMx(const int& Int1, const int& Int2){
1091  return Int1>Int2?Int1:Int2;}
1092  static int GetMn(const int& Int1, const int& Int2, const int& Int3){
1093  return GetMn(Int1, GetMn(Int2, Int3));}
1094  static int GetMn(const int& Int1, const int& Int2,
1095  const int& Int3, const int& Int4){
1096  return GetMn(GetMn(Int1, Int2), GetMn(Int3, Int4));}
1097  static int GetMx(const int& Int1, const int& Int2, const int& Int3){
1098  return GetMx(Int1, GetMx(Int2, Int3));}
1099  static int GetMx(const int& Int1, const int& Int2,
1100  const int& Int3, const int& Int4){
1101  return GetMx(GetMx(Int1, Int2), GetMx(Int3, Int4));}
1102  static int GetInRng(const int& Val, const int& Mn, const int& Mx){
1103  IAssert(Mn<=Mx); return Val<Mn?Mn:(Val>Mx?Mx:Val);}
1104 
1105  TStr GetStr() const {return TInt::GetStr(Val);}
1106 
1107  static TStr GetStr(const int& Val){ return TStr::Fmt("%d", Val); }
1108  static TStr GetStr(const TInt& Int){ return GetStr(Int.Val);}
1109  static TStr GetStr(const int& Val, const char* FmtStr);
1110  static TStr GetStr(const int& Val, const TStr& FmtStr){ return GetStr(Val, FmtStr.CStr());}
1111 
1112  //J: So that TInt can convert any kind of integer to a string
1113  static TStr GetStr(const uint& Val){ return TStr::Fmt("%u", Val); }
1114  #ifdef GLib_WIN
1115  static TStr GetStr(const int64& Val) {return TStr::Fmt("%I64d", Val);}
1116  static TStr GetStr(const uint64& Val) {return TStr::Fmt("%I64u", Val);}
1117  #else
1118  static TStr GetStr(const int64& Val) {return TStr::Fmt("%lld", Val);}
1119  static TStr GetStr(const uint64& Val) {return TStr::Fmt("%llu", Val);}
1120  #endif
1121 
1122  static TStr GetHexStr(const int& Val){
1123  char Bf[255]; sprintf(Bf, "%X", Val); return TStr(Bf);}
1124  static TStr GetHexStr(const TInt& Int){
1125  return GetHexStr(Int.Val);}
1126 
1127  static TStr GetKiloStr(const int& Val){
1128  if (Val>=100*1000){return GetStr(Val/1000)+"K";}
1129  else if (Val>=1000){return GetStr(Val/1000)+"."+GetStr((Val%1000)/100)+"K";}
1130  else {return GetStr(Val);}}
1131  static TStr GetMegaStr(const int& Val){
1132  if (Val>=100*1000000){return GetStr(Val/1000000)+"M";}
1133  else if (Val>=1000000){
1134  return GetStr(Val/1000000)+"."+GetStr((Val%1000000)/100000)+"M";}
1135  else {return GetKiloStr(Val);}}
1136 
1137  // frugal
1138  static char* SaveFrugalInt(char *pDest, int i);
1139  static char* LoadFrugalInt(char *pSrc, int& i);
1140  static void TestFrugalInt();
1141  static void SaveFrugalIntV(TSOut& SOut, const TVec<TInt, int>& IntV);
1142  static void LoadFrugalIntV(TSIn& SIn, TVec<TInt, int>& IntV, bool ClrP=true);
1143 };
1144 
1146 // Unsigned-Integer
1147 class TUInt{
1148 public:
1150 public:
1151  static const uint Mn;
1152  static const uint Mx;
1153  static TRnd Rnd;
1154 
1155  TUInt(): Val(0){}
1156  TUInt(const uint& _Val): Val(_Val){}
1157  operator uint() const {return Val;}
1158  explicit TUInt(TSIn& SIn){SIn.Load(Val);}
1159  void Load(TSIn& SIn){SIn.Load(Val);}
1160  void Save(TSOut& SOut) const {SOut.Save(Val);}
1161  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1162  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1163 
1164  TUInt& operator=(const TUInt& UInt){Val=UInt.Val; return *this;}
1165  TUInt& operator=(const uint& _Val){Val=_Val; return *this;}
1166  TUInt operator++(int){Val++; return *this;}
1167  TUInt operator--(int){Val--; return *this;}
1168  //bool operator==(const TUInt& UInt) const {return Val==UInt.Val;}
1169  //bool operator==(const uint& UInt) const {return Val==UInt;}
1170  //bool operator!=(const uint& UInt) const {return Val!=UInt;}
1171  //bool operator<(const TUInt& UInt) const {return Val<UInt.Val;}
1172  uint operator()() const {return Val;}
1173  uint& operator()() {return Val;}
1174  TUInt& operator~(){Val=~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 TUInt& UInt){Val^=UInt.Val; return *this;}
1178  TUInt& operator>>=(const int& ShiftBits){Val>>=ShiftBits; return *this;}
1179  TUInt& operator<<=(const int& ShiftBits){Val<<=ShiftBits; return *this;}
1180  int GetMemUsed() const {return sizeof(TUInt);}
1181 
1182  int GetPrimHashCd() const {return int(Val);}
1183  int GetSecHashCd() const {return Val/0x10;}
1184 
1185  static uint GetRnd(const uint& Range=0){return Rnd.GetUniDevUInt(Range);}
1186 
1187  TStr GetStr() const {return TUInt::GetStr(Val);}
1188  static TStr GetStr(const uint& Val){
1189  char Bf[255]; sprintf(Bf, "%u", Val); return TStr(Bf);}
1190  static TStr GetStr(const TUInt& UInt){
1191  return GetStr(UInt.Val);}
1192  static TStr GetStr(const uint& Val, const char* FmtStr);
1193  static TStr GetStr(const uint& Val, const TStr& FmtStr){
1194  return GetStr(Val, FmtStr.CStr());}
1195 
1196  static TStr GetKiloStr(const uint& Val){
1197  if (Val>100*1000){return GetStr(Val/1000)+"K";}
1198  else if (Val>1000){return GetStr(Val/1000)+"."+GetStr((Val%1000)/100)+"K";}
1199  else {return GetStr(Val);}}
1200  static TStr GetMegaStr(const uint& Val){
1201  if (Val>100*1000000){return GetStr(Val/1000000)+"M";}
1202  else if (Val>1000000){
1203  return GetStr(Val/1000000)+"."+GetStr((Val%1000000)/100000)+"M";}
1204  else {return GetKiloStr(Val);}}
1205 
1206  static uint JavaUIntToCppUInt(const uint& JavaUInt){
1207  uint B1=(JavaUInt & 0xFF000000) >> 24;
1208  uint B2=(JavaUInt & 0x00FF0000) >> 16;
1209  uint B3=(JavaUInt & 0x0000FF00) >> 8;
1210  uint B4=(JavaUInt & 0x000000FF) >> 0;
1211  uint CppUInt=(B4<<24)+(B3<<16)+(B2<<8)+(B1<<0);
1212  return CppUInt;}
1213 
1214  static bool IsIpStr(const TStr& IpStr, uint& Ip, const char& SplitCh = '.');
1215  static bool IsIpStr(const TStr& IpStr, const char& SplitCh = '.') { uint Ip; return IsIpStr(IpStr, Ip, SplitCh); }
1216  static uint GetUIntFromIpStr(const TStr& IpStr, const char& SplitCh = '.');
1217  static TStr GetStrFromIpUInt(const uint& Ip);
1218  static bool IsIpv6Str(const TStr& IpStr, const char& SplitCh = ':');
1219 };
1220 
1222 // Unsigned-Integer-64Bit
1223 class TUInt64{
1224 public:
1226 public:
1227  static const TUInt64 Mn;
1228  static const TUInt64 Mx;
1229 
1230  TUInt64(): Val(0){}
1231  TUInt64(const TUInt64& Int): Val(Int.Val){}
1232  TUInt64(const uint64& Int): Val(Int){}
1233  TUInt64(const uint& MsVal, const uint& LsVal): Val(0){
1234  Val=(((uint64)MsVal) << 32) | ((uint64)LsVal);}
1235  explicit TUInt64(void* Pt): Val(0){
1236  TConv_Pt64Ints32 Conv(Pt); Val=Conv.GetUInt64();}
1237  operator uint64() const {return Val;}
1238  explicit TUInt64(TSIn& SIn){SIn.Load(Val);}
1239  void Load(TSIn& SIn){SIn.Load(Val);}
1240  void Save(TSOut& SOut) const {SOut.Save(Val);}
1241  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1242  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1243 
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-=(const TUInt64& Int){Val-=Int.Val; return *this;}
1247  TUInt64& operator*=(const TUInt64& Int){Val*=Int.Val; return *this;}
1248  TUInt64 operator++(int){Val++; return *this;}
1249  TUInt64 operator--(int){Val--; return *this;}
1250  int GetMemUsed() const {return sizeof(TUInt64);}
1251 
1252  int GetPrimHashCd() const { return (int)GetMsVal() + (int)GetLsVal(); } //TODO: to check
1253  int GetSecHashCd() const { return ((int)GetMsVal() + (int)GetLsVal()) / 0x10; } //TODO: to check
1254 
1255  uint GetMsVal() const {
1256  return (uint)(Val >> 32);}
1257  uint GetLsVal() const {
1258  return (uint)(Val & 0xffffffff);}
1259 
1260  //TStr GetStr() const {return TStr::Fmt("%Lu", Val);}
1261  //static TStr GetStr(const TUInt64& Int){return TStr::Fmt("%Lu", Int.Val);}
1262  //static TStr GetHexStr(const TUInt64& Int){return TStr::Fmt("%LX", Int.Val);}
1263  #ifdef GLib_WIN
1264  TStr GetStr() const {return TStr::Fmt("%I64u", Val);}
1265  static TStr GetStr(const TUInt64& Int){return TStr::Fmt("%I64u", Int.Val);}
1266  static TStr GetHexStr(const TUInt64& Int){return TStr::Fmt("%I64X", Int.Val);}
1267  #else
1268  TStr GetStr() const {return TStr::Fmt("%llu", Val);}
1269  static TStr GetStr(const TUInt64& Int){return TStr::Fmt("%llu", Int.Val);}
1270  static TStr GetHexStr(const TUInt64& Int){return TStr::Fmt("%llX", Int.Val);}
1271  #endif
1272 
1273  static TStr GetKiloStr(const uint64& Val){
1274  if (Val>100*1000){return GetStr(Val/1000)+"K";}
1275  else if (Val>1000){return GetStr(Val/1000)+"."+GetStr((Val%1000)/100)+"K";}
1276  else {return GetStr(Val);}}
1277  static TStr GetMegaStr(const uint64& Val){
1278  if (Val>100*1000000){return GetStr(Val/1000000)+"M";}
1279  else if (Val>1000000){
1280  return GetStr(Val/1000000)+"."+GetStr((Val%1000000)/100000)+"M";}
1281  else {return GetKiloStr(Val);}}
1282  /*static TStr GetGigaStr(const uint64& Val){
1283  if (Val>100*1000000000){return GetStr(Val/1000000000)+"G";}
1284  else if (Val>1000000000){
1285  return GetStr(Val/1000000000)+"."+GetStr((Val%1000000000)/100000000)+"G";}
1286  else {return GetMegaStr(Val);}}*/
1287 };
1288 
1290 // Float
1291 class TFlt{
1292 public:
1293  double Val;
1294 public:
1295  static const double Mn;
1296  static const double Mx;
1297  static const double NInf;
1298  static const double PInf;
1299  static const double Eps;
1300  static const double EpsHalf;
1301  static TRnd Rnd;
1302 
1303  TFlt(): Val(0){}
1304  TFlt(const double& _Val): Val(_Val){}
1305  operator double() const {return Val;}
1306  explicit TFlt(TSIn& SIn){SIn.Load(Val);}
1307  void Save(TSOut& SOut) const {SOut.Save(Val);}
1308  explicit TFlt(TSIn& SIn, const bool& IsTxt){
1309  if (IsTxt){TStr Str(SIn, true); Val=Str.GetFlt(0);} else {SIn.Load(Val);}}
1310  void Load(TSIn& SIn){SIn.Load(Val);}
1311  void Save(TSOut& SOut, const bool& IsTxt) const {
1312  if (IsTxt){GetStr(Val).Save(SOut, true);} else {SOut.Save(Val);}}
1313  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1314  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1315 
1316  TFlt& operator=(const TFlt& Flt){Val=Flt.Val; return *this;}
1317  TFlt& operator=(const double& Flt){Val=Flt; return *this;}
1318  bool operator==(const TFlt& Flt) const _CMPWARN {return Val==Flt.Val;}
1319  bool operator==(const double& Flt) const _CMPWARN {return Val==Flt;}
1320  bool operator!=(const double& Flt) const _CMPWARN {return Val!=Flt;}
1321  double operator()() const {return Val;}
1322  TFlt& operator+=(const double& Flt){Val+=Flt; return *this;}
1323  TFlt& operator-=(const double& Flt){Val-=Flt; return *this;}
1324  TFlt& operator*=(const double& Flt){Val*=Flt; return *this;}
1325  TFlt& operator/=(const double& Flt){Val/=Flt; return *this;}
1326  TFlt operator++(int){Val++; return *this;}
1327  TFlt operator--(int){Val--; return *this;}
1328  int GetMemUsed() const {return sizeof(TFlt);}
1329 
1330  int GetPrimHashCd() const {
1331  int Expn; return int((frexp(Val, &Expn)-0.5)*double(TInt::Mx));}
1332  int GetSecHashCd() const {
1333  int Expn; frexp(Val, &Expn); return Expn;}
1334 
1335  static double Abs(const double& Flt){return Flt<0?-Flt:Flt;}
1336  static int Sign(const double& Flt){return Flt<0?-1:(Flt>0?1:0);}
1337  static int Round(const double& Flt){return int(floor(Flt+0.5));}
1338  static double GetRnd(){return Rnd.GetUniDev();}
1339  static bool Eq6(const double& LFlt, const double& RFlt){
1340  return fabs(LFlt-RFlt)<0.000001;}
1341 
1342  static double GetMn(const double& Flt1, const double& Flt2){
1343  return Flt1<Flt2?Flt1:Flt2;}
1344  static double GetMn(const double& Flt1, const double& Flt2, const double& Flt3){
1345  return GetMn(GetMn(Flt1, Flt2), Flt3); }
1346  static double GetMn(const double& Flt1, const double& Flt2, const double& Flt3, const double& Flt4){
1347  return GetMn(GetMn(Flt1, Flt2), GetMn(Flt3, Flt4)); }
1348 
1349  static double GetMx(const double& Flt1, const double& Flt2){
1350  return Flt1>Flt2?Flt1:Flt2;}
1351  static double GetMx(const double& Flt1, const double& Flt2, const double Flt3){
1352  return GetMx(GetMx(Flt1, Flt2), Flt3); }
1353  static double GetMx(const double& Flt1, const double& Flt2, const double Flt3, const double& Flt4){
1354  return GetMx(GetMx(Flt1, Flt2), GetMx(Flt3, Flt4)); }
1355 
1356  static double GetInRng(const double& Val, const double& Mn, const double& Mx){
1357  IAssert(Mn<=Mx); return Val<Mn?Mn:(Val>Mx?Mx:Val);}
1358 
1359  static bool IsNum(const double& Val){
1360  return (Mn<=Val)&&(Val<=Mx);}
1361  static bool IsNan(const double& Val){
1362  return (Val!=Val);}
1363 
1364  bool IsNum() const { return IsNum(Val); }
1365  bool IsNan() const { return IsNan(Val); }
1366 
1367  TStr GetStr() const {return TFlt::GetStr(Val);}
1368  static TStr GetStr(const double& Val, const int& Width=-1, const int& Prec=-1);
1369  static TStr GetStr(const TFlt& Flt, const int& Width=-1, const int& Prec=-1){
1370  return GetStr(Flt.Val, Width, Prec);}
1371  static TStr GetStr(const double& Val, const char* FmtStr);
1372  static TStr GetStr(const double& Val, const TStr& FmtStr){
1373  return GetStr(Val, FmtStr.CStr());}
1374  static TStr GetPrcStr(const double& RelVal, const double& FullVal){
1375  return GetStr(100*RelVal/FullVal, "%3.0f%%");}
1376 
1377  static TStr GetKiloStr(const double& Val){
1378  if (fabs(Val)>100*1000){return TStr::Fmt("%.0fK", Val/1000);}
1379  else if (fabs(Val)>1000){return TStr::Fmt("%.1fK", Val/1000);}
1380  else {return TStr::Fmt("%.0f", Val);}}
1381  static TStr GetMegaStr(const double& Val){
1382  if (fabs(Val)>100*1000000){return TStr::Fmt("%.0fM", Val/1000000);}
1383  else if (fabs(Val)>1000000){return TStr::Fmt("%.1fM", Val/1000000);}
1384  else {return GetKiloStr(Val);}}
1385  static TStr GetGigaStr(const double& Val){
1386  if (fabs(Val)>100*1000000000.0){return TStr::Fmt("%.0fG", Val/1000000000.0);}
1387  else if (fabs(Val)>1000000000.0){return TStr::Fmt("%.1fG", Val/1000000000.0);}
1388  else {return GetMegaStr(Val);}}
1389 };
1390 
1392 // Ascii-Float
1393 class TAscFlt: public TFlt{
1394 public:
1395  TAscFlt(): TFlt(){}
1396  TAscFlt(const double& Val): TFlt(Val){}
1397  explicit TAscFlt(TSIn& SIn): TFlt(SIn, true){}
1398  void Save(TSOut& SOut) const {TFlt::Save(SOut, true);}
1399 };
1400 
1402 // Short-Float
1403 class TSFlt{
1404 public:
1406 public:
1407  static const sdouble Mn;
1408  static const sdouble Mx;
1409 
1410  TSFlt(): Val(0){}
1411  TSFlt(const sdouble& _Val): Val(sdouble(_Val)){}
1412  //TSFlt(const double& _Val): Val(sdouble(_Val)){}
1413  operator sdouble() const {return Val;}
1414  //operator double() const {return Val;}
1415  explicit TSFlt(TSIn& SIn){SIn.Load(Val);}
1416  void Save(TSOut& SOut) const {SOut.Save(Val);}
1417  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1418  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1419 
1420  TSFlt& operator=(const TSFlt& SFlt){Val=SFlt.Val; return *this;}
1421  bool operator==(const TSFlt& SFlt) const _CMPWARN {return Val==SFlt.Val;}
1422  bool operator==(const double& Flt) const _CMPWARN {return Val==Flt;}
1423  bool operator!=(const double& Flt) const _CMPWARN {return Val!=Flt;}
1424  bool operator<(const TSFlt& SFlt) const {return Val<SFlt.Val;}
1425  sdouble operator()() const {return Val;}
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*=(const double& SFlt){Val*=sdouble(SFlt); return *this;}
1429  TSFlt& operator/=(const double& SFlt){Val/=sdouble(SFlt); return *this;}
1430  TSFlt operator++(int){Val++; return *this;}
1431  TSFlt operator--(int){Val--; return *this;}
1432  int GetMemUsed() const {return sizeof(TSFlt);}
1433 
1434  int GetPrimHashCd() const {
1435  int Expn; return int((frexp(Val, &Expn)-0.5)*double(TInt::Mx));}
1436  int GetSecHashCd() const {
1437  int Expn; frexp(Val, &Expn); return Expn;}
1438 };
1439 
1441 // Long-Float
1442 class TLFlt{
1443 public:
1445 public:
1446  static const ldouble Mn;
1447  static const ldouble Mx;
1448 
1449  TLFlt(): Val(0){}
1450  TLFlt(const ldouble& _Val): Val(_Val){}
1451  operator ldouble() const {return Val;}
1452  explicit TLFlt(TSIn& SIn){SIn.Load(Val);}
1453  void Save(TSOut& SOut) const {SOut.Save(Val);}
1454  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1455  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1456 
1457  TLFlt& operator=(const TLFlt& LFlt){Val=LFlt.Val; return *this;}
1458  bool operator==(const TLFlt& LFlt) const _CMPWARN {return Val==LFlt.Val;}
1459  bool operator==(const ldouble& LFlt) const _CMPWARN {return Val==LFlt;}
1460  bool operator!=(const ldouble& LFlt) const _CMPWARN {return Val!=LFlt;}
1461  bool operator<(const TLFlt& LFlt) const {return Val<LFlt.Val;}
1462  ldouble operator()() const {return Val;}
1463  TLFlt& operator+=(const ldouble& LFlt){Val+=LFlt; return *this;}
1464  TLFlt& operator-=(const ldouble& LFlt){Val-=LFlt; return *this;}
1465  int GetMemUsed() const {return sizeof(TLFlt);}
1466 
1467  int GetPrimHashCd() const {Fail; return 0;}
1468  int GetSecHashCd() const {Fail; return 0;}
1469 
1470  static TStr GetStr(const ldouble& Val, const int& Width=-1, const int& Prec=-1);
1471  static TStr GetStr(const TLFlt& LFlt, const int& Width=-1, const int& Prec=-1){
1472  return GetStr(LFlt.Val, Width, Prec);}
1473  static TStr GetStr(const ldouble& Val, const char* FmtStr);
1474  static TStr GetStr(const ldouble& Val, const TStr& FmtStr){
1475  return GetStr(Val, FmtStr.CStr());}
1476 };
1477 
1479 // Float-Rectangle
1480 class TFltRect{
1481 public:
1483 public:
1485  MnX(), MnY(), MxX(), MxY(){}
1486  TFltRect(const TFltRect& FltRect):
1487  MnX(FltRect.MnX), MnY(FltRect.MnY), MxX(FltRect.MxX), MxY(FltRect.MxY){}
1489  const double& _MnX, const double& _MnY,
1490  const double& _MxX, const double& _MxY):
1491  MnX(_MnX), MnY(_MnY), MxX(_MxX), MxY(_MxY){}
1493  MnX(SIn), MnY(SIn), MxX(SIn), MxY(SIn){}
1494  void Save(TSOut& SOut) const {
1495  MnX.Save(SOut); MnY.Save(SOut); MxX.Save(SOut); MxY.Save(SOut);}
1496  void LoadXml(const PXmlTok& XmlTok, const TStr& Nm);
1497  void SaveXml(TSOut& SOut, const TStr& Nm) const;
1498 
1499  TFltRect& operator=(const TFltRect& FltRect){
1500  MnX=FltRect.MnX; MnY=FltRect.MnY; MxX=FltRect.MxX; MxY=FltRect.MxY;
1501  return *this;}
1502 
1503  // get coordinates
1504  double GetMnX() const {return MnX;}
1505  double GetMnY() const {return MnY;}
1506  double GetMxX() const {return MxX;}
1507  double GetMxY() const {return MxY;}
1508 
1509  // get lengths
1510  double GetXLen() const {return MxX-MnX;}
1511  double GetYLen() const {return MxY-MnY;}
1512 
1513  // get centers
1514  double GetXCenter() const {return MnX+(MxX-MnX)/2;}
1515  double GetYCenter() const {return MnY+(MxY-MnY)/2;}
1516 
1517  // tests
1518  bool IsXYIn(const double& X, const double& Y) const {
1519  return (MnX<=X)&&(X<=MxX)&&(MnY<=Y)&&(Y<=MxY);}
1520  static bool Intersection(const TFltRect& Rect1, const TFltRect& Rect2);
1521 
1522  // string
1523  TStr GetStr() const;
1524 };
1525 
TSFlt & operator/=(const double &SFlt)
Definition: dt.h:1429
#define IAssert(Cond)
Definition: bd.h:262
TChAIn & operator=(const TChAIn &)
int GetPrimHashCd() const
Definition: dt.h:1076
static int CmpI(const char *CStr1, const char *CStr2)
Definition: dt.cpp:699
bool operator==(const double &Flt) const _CMPWARN
Definition: dt.h:1319
static bool IsHex(const char &Ch)
Definition: dt.h:975
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:1166
TStr(const char &Ch, bool)
Definition: dt.h:416
TFlt & operator*=(const double &Flt)
Definition: dt.h:1324
void Save(TSOut &SOut) const
Definition: dt.h:1398
int SearchCh(const char &Ch, const int &BChN=0) const
Definition: dt.cpp:1043
static TStr GetHexStr(const int &Val)
Definition: dt.h:1122
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:1297
ldouble operator()() const
Definition: dt.h:1462
TMemOut(const PMem &_Mem)
Definition: dt.cpp:334
TUInt()
Definition: dt.h:1155
static TStr GetPrcStr(const double &RelVal, const double &FullVal)
Definition: dt.h:1374
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:1457
TUInt64 operator--(int)
Definition: dt.h:1249
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:1353
static PMem New(const PMem &Mem)
Definition: dt.h:96
static const uint Mn
Definition: dt.h:1151
TStr GetStr() const
Definition: dt.h:1105
#define IAssertR(Cond, Reason)
Definition: bd.h:265
static const int Kilo
Definition: dt.h:1048
static TStr GetSpaceStr(const int &Spaces)
Definition: dt.cpp:1608
char Pop()
Definition: dt.h:139
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:1910
static const int r
Definition: dt.h:15
int GetSecHashCd() const
Definition: dt.h:966
bool IsInt64() const
Definition: dt.h:594
TLFlt(const ldouble &_Val)
Definition: dt.h:1450
TStr(const TChA &ChA)
Definition: dt.h:425
TSFlt(TSIn &SIn)
Definition: dt.h:1415
uint GetLsVal() const
Definition: dt.h:1257
static PSOut New(const TStr &FNm, const bool &Append=false)
Definition: fl.cpp:442
static uint JavaUIntToCppUInt(const uint &JavaUInt)
Definition: dt.h:1206
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:1270
void Save(TSOut &SOut) const
Definition: dt.h:733
int GetPrimHashCd() const
Definition: dt.h:965
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:1009
static TStr GetMegaStr(const int &Val)
Definition: dt.h:1131
void Save(TSOut &SOut) const
Definition: dt.h:1494
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:1505
static TStr GetStr(const uint64 &Val)
Definition: dt.h:1119
static int GetInRng(const int &Val, const int &Mn, const int &Mx)
Definition: dt.h:1102
int GetNextSeed()
Definition: dt.h:17
static TStr GetKiloStr(const uint64 &Val)
Definition: dt.h:1273
static bool IsNum(const char &Ch)
Definition: dt.h:972
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:1480
TSInt(TSIn &SIn)
Definition: dt.h:1033
static const sdouble Mn
Definition: dt.h:1407
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:1110
TSFlt & operator-=(const double &SFlt)
Definition: dt.h:1427
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:1094
TStr GetFPath() const
Definition: dt.cpp:1389
TFltRect & operator=(const TFltRect &FltRect)
Definition: dt.h:1499
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:1044
sdouble Val
Definition: dt.h:1405
static const uint Mx
Definition: dt.h:1152
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:1325
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:1833
void Save(TSOut &SOut) const
Definition: dt.h:1058
bool IsFlt(double &Val) const
Definition: dt.h:627
static double GetMx(const double &Flt1, const double &Flt2)
Definition: dt.h:1349
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:1007
unsigned int uint
Definition: bd.h:11
bool IsXYIn(const double &X, const double &Y) const
Definition: dt.h:1518
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:1372
static TStr GetStr(const TUInt64 &Int)
Definition: dt.h:1269
static int GetMx(const int &Int1, const int &Int2)
Definition: dt.h:1090
TUInt64(const TUInt64 &Int)
Definition: dt.h:1231
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:1047
TRnd(TSIn &SIn)
Definition: dt.h:22
#define Fail
Definition: bd.h:238
bool operator!=(const double &Flt) const _CMPWARN
Definition: dt.h:1423
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:1460
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:1428
void PutCh(const int &ChN, const char &Ch)
Definition: dt.h:278
static char GetHexCh(const int &Val)
Definition: dt.h:982
TFlt(TSIn &SIn)
Definition: dt.h:1306
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:1010
double Val
Definition: dt.h:1293
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:1300
TUInt64 operator++(int)
Definition: dt.h:1248
TCh(const char &_Val)
Definition: dt.h:951
bool IsPrefix(const TStr &Str) const
Definition: dt.h:557
int GetPrimHashCd() const
Definition: dt.h:1467
TFlt & operator=(const double &Flt)
Definition: dt.h:1317
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:1359
static void SaveFrugalIntV(TSOut &SOut, const TVec< TInt, int > &IntV)
Definition: dt.cpp:2018
static TStr GetMegaStr(const double &Val)
Definition: dt.h:1381
TInt & operator-=(const int &Int)
Definition: dt.h:1071
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:1014
uint64 GetUniDevUInt64(const uint64 &Range=0)
Definition: dt.cpp:57
bool Empty() const
Definition: dt.h:749
TInt operator--(int)
Definition: dt.h:1073
void Save(TSOut &SOut) const
Definition: dt.h:1035
static const bool Mx
Definition: dt.h:886
TSFlt()
Definition: dt.h:1410
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:1232
virtual int GetBf(const void *Bf, const TSize &BfL)=0
static int GetHex(const char &Ch)
Definition: dt.h:977
double GetMxY() const
Definition: dt.h:1507
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:1322
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:1176
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:963
int SearchStr(const TChA &Str, const int &BChN=0) const
Definition: dt.cpp:485
static bool IsIpv6Str(const TStr &IpStr, const char &SplitCh= ':')
Definition: dt.cpp:2122
sdouble operator()() const
Definition: dt.h:1425
static double GetMn(const double &Flt1, const double &Flt2, const double &Flt3)
Definition: dt.h:1344
bool operator==(const char &Ch) const
Definition: dt.h:234
bool operator==(const TSFlt &SFlt) const _CMPWARN
Definition: dt.h:1421
TStr & operator=(const char &Ch)
Definition: dt.h:451
bool operator==(const TInt &Int) const
Definition: dt.h:1064
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:1021
static TStr GetKiloStr(const uint &Val)
Definition: dt.h:1196
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:1239
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:1482
uint & operator()()
Definition: dt.h:1173
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:1193
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:1051
TStr & ToCap()
Definition: dt.cpp:764
bool operator!=(const int &Int) const
Definition: dt.h:1066
TLFlt & operator+=(const ldouble &LFlt)
Definition: dt.h:1463
TLFlt & operator-=(const ldouble &LFlt)
Definition: dt.h:1464
static TStr GetStr(const uint &Val)
Definition: dt.h:1188
static const double Mx
Definition: dt.h:1296
int ChangeChAll(const char &SrcCh, const char &DstCh)
Definition: dt.cpp:1113
double GetXCenter() const
Definition: dt.h:1514
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:1395
TCh(TSIn &SIn)
Definition: dt.h:953
static const TStr YStr
Definition: dt.h:893
Definition: dt.h:1442
int GetSecHashCd() const
Definition: dt.h:746
static double GetMx(const double &Flt1, const double &Flt2, const double Flt3)
Definition: dt.h:1351
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:1291
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:1446
bool operator==(const TCh &Ch) const
Definition: dt.h:960
bool IsStrIn(const TStr &Str) const
Definition: dt.h:292
int PutCh(const char &Ch)
Definition: dt.h:193
void SaveXml(TSOut &SOut, const TStr &Nm) const
Definition: dt.cpp:746
int GetMemUsed() const
Definition: dt.h:1250
Definition: fl.h:58
TInt & operator=(const TInt &Int)
Definition: dt.h:1062
int GetPrimHashCd() const
Definition: dt.h:1330
static const int Giga
Definition: dt.h:1050
TUInt64(TSIn &SIn)
Definition: dt.h:1238
char GetCh()
Definition: dt.h:337
Definition: dt.h:182
int GetSecHashCd() const
Definition: dt.h:1436
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:1190
static TStr GetMegaStr(const uint &Val)
Definition: dt.h:1200
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:1486
void SplitOnCh(TStr &LStr, const char &SplitCh, TStr &RStr) const
Definition: dt.cpp:901
TInt(TSIn &SIn)
Definition: dt.h:1056
void Optimize()
Definition: dt.cpp:729
void Save(TSOut &SOut, const bool &IsTxt) const
Definition: dt.h:1311
static const TStr FalseStr
Definition: dt.h:890
int GetPrimHashCd() const
Definition: dt.h:1020
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:1049
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:1080
void DelLastCh()
Definition: dt.h:263
TSFlt & operator+=(const double &SFlt)
Definition: dt.h:1426
void Reverse()
Definition: dt.cpp:440
static TStr GetMegaStr(const uint64 &Val)
Definition: dt.h:1277
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:1160
uint GetUInt() const
Definition: dt.h:587
bool IsInt(int &Val) const
Definition: dt.h:577
TAscFlt(const double &Val)
Definition: dt.h:1396
int GetSecHashCd() const
Definition: dt.h:1468
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
void Load(TSIn &SIn)
Definition: dt.h:954
static double GetMn(const double &Flt1, const double &Flt2, const double &Flt3, const double &Flt4)
Definition: dt.h:1346
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:1811
static const int Mn
Definition: dt.h:1046
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:1377
int BfL
Definition: dt.h:79
TUInt & operator<<=(const int &ShiftBits)
Definition: dt.h:1179
int SearchChBack(const char &Ch, int BChN=-1) const
Definition: dt.cpp:477
static bool IsWs(const char &Ch)
Definition: dt.h:968
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:1252
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:1036
int GetMemUsed() const
Definition: dt.h:1328
TUInt(const uint &_Val)
Definition: dt.h:1156
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:1088
Definition: dt.h:698
void Save(TSOut &SOut) const
Definition: dt.h:1416
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:1164
TMem(const void *_Bf, const int &_BfL)
Definition: dt.h:88
TInt()
Definition: dt.h:1053
int GetSecHashCd() const
Definition: dt.h:1077
void Save(TSOut &SOut, const bool &IsSmall=false) const
Definition: dt.h:440
TFlt MnY
Definition: dt.h:1482
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:1304
~TMem()
Definition: dt.h:99
TSFlt & operator=(const TSFlt &SFlt)
Definition: dt.h:1420
static TStr Get01Str(const bool &Val)
Definition: dt.h:926
bool operator==(const TFlt &Flt) const _CMPWARN
Definition: dt.h:1318
void Load(bool &Bool)
Definition: fl.h:84
TSFlt(const sdouble &_Val)
Definition: dt.h:1411
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:1034
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:1174
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:1124
TFlt MxY
Definition: dt.h:1482
TMemIn(const TMem &_Mem, const int &_BfC=0)
Definition: dt.cpp:315
static bool IsIpStr(const TStr &IpStr, const char &SplitCh= '.')
Definition: dt.h:1215
static int GetNum(const char &Ch)
Definition: dt.h:974
static TStr GetStr(const TLFlt &LFlt, const int &Width=-1, const int &Prec=-1)
Definition: dt.h:1471
TStr GetStr() const
Definition: dt.h:1187
uint GetUniDevUInt(const uint &Range=0)
Definition: dt.cpp:45
TUInt64 & operator=(const TUInt64 &Int)
Definition: dt.h:1244
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:1057
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:1085
Definition: lx.h:251
void Save(TSOut &SOut) const
Definition: dt.h:1453
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:1240
Definition: dt.h:1403
TStr & ConvUsFromYuAscii()
Definition: dt.cpp:779
int GetSecHashCd() const
Definition: dt.cpp:611
int GetMemUsed() const
Definition: dt.h:1465
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:1327
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:1017
TFlt(TSIn &SIn, const bool &IsTxt)
Definition: dt.h:1308
TCh()
Definition: dt.h:950
TUInt & operator&=(const TUInt &UInt)
Definition: dt.h:1175
bool operator==(const TVoid &) const
Definition: dt.h:874
void Load(TSIn &SIn)
Definition: dt.h:1159
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:1004
bool operator<(const int &Int) const
Definition: dt.h:1068
TStr & operator=(const TStr &Str)
Definition: dt.h:445
double GetYLen() const
Definition: dt.h:1511
void Trunc(const int &_BfL)
Definition: dt.h:136
TInt(const int &_Val)
Definition: dt.h:1054
bool operator<(const TCh &Ch) const
Definition: dt.h:961
bool operator!=(const double &Flt) const _CMPWARN
Definition: dt.h:1320
bool operator<(const TUCh &UCh) const
Definition: dt.h:1016
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:1408
bool operator<(const TChA &ChA) const
Definition: dt.h:238
TDbStr()
Definition: dt.h:728
static TStr GetStr(const int &Val)
Definition: dt.h:1107
int GetMemUsed() const
Definition: dt.h:1432
TUInt64 & operator-=(const TUInt64 &Int)
Definition: dt.h:1246
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:1364
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:1385
TCh & operator=(const TCh &Ch)
Definition: dt.h:959
TLFlt()
Definition: dt.h:1449
unsigned char uchar
Definition: bd.h:10
TChA(TSIn &SIn)
Definition: dt.h:220
double GetMxX() const
Definition: dt.h:1506
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:1233
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:1458
int GetMemUsed() const
Definition: dt.h:1180
void Trunc()
Definition: dt.cpp:420
bool operator<(const TVoid &) const
Definition: dt.h:875
TFlt()
Definition: dt.h:1303
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:1018
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:1026
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:1185
TDbStr(const TStr &_Str1)
Definition: dt.h:730
int GetSecHashCd() const
Definition: dt.h:1037
TRnd(const int &_Seed=1, const int &Steps=0)
Definition: dt.h:20
static double Abs(const double &Flt)
Definition: dt.h:1335
static double GetUniDevStep(const int &Seed, const int &Steps)
Definition: dt.h:64
static int Round(const double &Flt)
Definition: dt.h:1337
TFlt operator++(int)
Definition: dt.h:1326
Definition: dt.h:1042
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:1431
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:1165
static const TStr YesStr
Definition: dt.h:895
Definition: dt.h:201
TUInt operator--(int)
Definition: dt.h:1167
static TStr GetNumFNm(const TStr &FNm, const int &Num)
Definition: dt.cpp:1527
uchar Val
Definition: dt.h:1000
void Save(TSOut &SOut) const
Definition: dt.h:955
static int Abs(const int &Int)
Definition: dt.h:1079
TUInt64()
Definition: dt.h:1230
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:1461
Definition: dt.h:1147
TFltRect()
Definition: dt.h:1484
bool IsNan() const
Definition: dt.h:1365
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:1083
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:973
static int GetMx(const int &Int1, const int &Int2, const int &Int3, const int &Int4)
Definition: dt.h:1099
void Save(TSOut &SOut, const bool &IsSmall) const
Definition: dt.h:371
float sdouble
Definition: bd.h:15
TFlt MxX
Definition: dt.h:1482
TStr LeftOf(const char &SplitCh) const
Definition: dt.cpp:873
TInt & operator=(const int &Int)
Definition: dt.h:1063
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:1515
TInt operator++(int)
Definition: dt.h:1072
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:1342
TStr GetStr() const
Definition: dt.h:1268
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:1158
TStr & operator+=(const TStr &Str)
Definition: dt.h:453
TFltRect(TSIn &SIn)
Definition: dt.h:1492
TBool()
Definition: dt.h:897
static const ldouble Mx
Definition: dt.h:1447
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:1430
~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:970
Definition: dt.h:412
TSInt()
Definition: dt.h:1030
TChA & operator=(const TChA &ChA)
Definition: dt.cpp:366
int GetMemUsed() const
Definition: dt.h:1074
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:1225
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:1338
TStr LeftOfLast(const char &SplitCh) const
Definition: dt.cpp:880
bool operator<(const TInt &Int) const
Definition: dt.h:1067
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:1361
double operator()() const
Definition: dt.h:1321
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:1153
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:1397
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:1310
bool IsUInt(uint &Val) const
Definition: dt.h:585
TSInt(const int16 &_Val)
Definition: dt.h:1031
TStr & operator=(const char *CStr)
Definition: dt.h:449
TStr GetHex() const
Definition: dt.h:512
static const char CrCh
Definition: dt.h:946
TUInt64 & operator*=(const TUInt64 &Int)
Definition: dt.h:1247
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:1336
int GetSecHashCd() const
Definition: dt.h:1183
bool operator<(const TBool &Bool) const
Definition: dt.h:908
Definition: bd.h:196
static const double PInf
Definition: dt.h:1298
static TStr GetStr(const int64 &Val)
Definition: dt.h:1118
static TStr GetStr(const TCh &Ch)
Definition: dt.h:992
static double GetInRng(const double &Val, const double &Mn, const double &Mx)
Definition: dt.h:1356
uint Val
Definition: dt.h:1149
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:1065
bool operator==(const TBool &Bool) const
Definition: dt.h:907
TStr GetStr() const
Definition: dt.h:1367
TUInt & operator^=(const TUInt &UInt)
Definition: dt.h:1177
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:1444
TMem(const int &_MxBfL=0)
Definition: dt.h:84
TUInt & operator>>=(const int &ShiftBits)
Definition: dt.h:1178
int Len() const
Definition: dt.h:172
bool operator==(const double &Flt) const _CMPWARN
Definition: dt.h:1422
static const uchar Mx
Definition: dt.h:1003
char * GetBf() const
Definition: dt.h:144
static const TUInt64 Mn
Definition: dt.h:1227
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:1070
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:1459
TUInt64 & operator+=(const TUInt64 &Int)
Definition: dt.h:1245
static char IsUc(const char &Ch)
Definition: dt.h:986
TChA & ToTrunc()
Definition: dt.cpp:568
bool operator!=(const TChA &ChA) const
Definition: dt.h:235
TFlt & operator=(const TFlt &Flt)
Definition: dt.h:1316
static bool Eq6(const double &LFlt, const double &RFlt)
Definition: dt.h:1339
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:1182
int BfL
Definition: dt.h:162
TFltRect(const double &_MnX, const double &_MnY, const double &_MxX, const double &_MxY)
Definition: dt.h:1488
TLFlt(TSIn &SIn)
Definition: dt.h:1452
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:962
void LoadXml(const PXmlTok &XmlTok, const TStr &Nm)
Definition: dt.cpp:2303
int GetBf(const void *LBf, const TSize &LBfL)
Definition: dt.cpp:644
uint GetMsVal() const
Definition: dt.h:1255
void SplitOnLastCh(TStr &LStr, const char &SplitCh, TStr &RStr) const
Definition: dt.cpp:912
double GetMnX() const
Definition: dt.h:1504
TChA(const char *CStr, const int &StrLen)
Definition: dt.h:211
static TStr GetStr(const uint &Val)
Definition: dt.h:1113
PMem Mem
Definition: dt.h:160
static TStr GetStr(const ldouble &Val, const TStr &FmtStr)
Definition: dt.h:1474
Definition: dt.h:881
char * operator()() const
Definition: dt.h:114
static char GetUc(const char &Ch)
Definition: dt.h:988
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:1081
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:1253
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:1369
int16 Val
Definition: dt.h:1028
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:1235
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:1434
bool IsUc() const
Definition: dt.h:491
static int GetMn(const int &Int1, const int &Int2, const int &Int3)
Definition: dt.h:1092
bool operator!=(const char &Ch) const
Definition: dt.h:237
uint operator()() const
Definition: dt.h:1172
bool GetNextLnBf(TChA &LnChA)
Definition: dt.cpp:652
static TStr GetStr(const TInt &Int)
Definition: dt.h:1108
Definition: dt.h:1393
TChA(const char *CStr)
Definition: dt.h:209
bool operator<(const TSFlt &SFlt) const
Definition: dt.h:1424
bool operator==(const TUCh &UCh) const
Definition: dt.h:1015
TStr RightOfLast(const char &SplitCh) const
Definition: dt.cpp:894
TCs Cs
Definition: fl.h:44
static const TUInt64 Mx
Definition: dt.h:1228
int GetSeed() const
Definition: dt.h:59
int GetSecHashCd() const
Definition: dt.h:1332
static const uchar Mn
Definition: dt.h:1002
int GetMemUsed() const
Definition: dt.h:911
void Save(TSOut &SOut) const
Definition: dt.h:1307
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:1323
TUCh()
Definition: dt.h:1006
static bool IsEven(const int &Int)
Definition: dt.h:1086
double GetPowerDev(const double &AlphaSlope)
Definition: dt.h:47
Definition: dt.h:1223
bool operator()() const
Definition: dt.h:910
static const double Eps
Definition: dt.h:1299
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:1301
static const double Mn
Definition: dt.h:1295
int operator()() const
Definition: dt.h:1069
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:998
double GetXLen() const
Definition: dt.h:1510
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:1127
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:1097