SNAP Library 3.0, User Reference  2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TStr Class Reference

#include <dt.h>

Inherited by TTypeNm< Type >.

Public Member Functions

 TStr ()
 
 TStr (const TStr &Str)
 
 TStr (const TChA &ChA)
 
 TStr (const TSStr &SStr)
 
 TStr (const char *CStr)
 
 TStr (const char &Ch)
 
 TStr (const TMem &Mem)
 
 TStr (const PSIn &SIn)
 
 ~TStr ()
 
 TStr (TSIn &SIn, const bool &IsSmall=false)
 
void Load (TSIn &SIn, const bool &IsSmall=false)
 
void Save (TSOut &SOut, const bool &IsSmall=false) const
 
void LoadXml (const PXmlTok &XmlTok, const TStr &Nm)
 
void SaveXml (TSOut &SOut, const TStr &Nm) const
 
TStroperator= (const TStr &Str)
 
TStroperator= (const TChA &ChA)
 
TStroperator= (const char *CStr)
 
TStroperator= (const char &Ch)
 
TStroperator+= (const TStr &Str)
 
TStroperator+= (const char *CStr)
 
bool operator== (const TStr &Str) const
 
bool operator== (const char *CStr) const
 
bool operator!= (const char *CStr) const
 
bool operator< (const TStr &Str) const
 
char operator[] (const int &ChN) const
 
int GetMemUsed () const
 
char * operator() ()
 
const char * operator() () const
 
char * CStr ()
 
const char * CStr () const
 
void PutCh (const int &ChN, const char &Ch)
 
char GetCh (const int &ChN) const
 
char LastCh () const
 
void Clr ()
 
int Len () const
 
bool Empty () const
 
bool IsUc () const
 
TStrToUc ()
 
TStr GetUc () const
 
int CmpI (const TStr &Str) const
 
bool EqI (const TStr &Str) const
 
bool IsLc () const
 
TStrToLc ()
 
TStr GetLc () const
 
TStrToCap ()
 
TStr GetCap () const
 
TStrToTrunc ()
 
TStr GetTrunc () const
 
TStrConvUsFromYuAscii ()
 
TStr GetUsFromYuAscii () const
 
TStrToHex ()
 
TStr GetHex () const
 
TStrFromHex ()
 
TStr GetFromHex () const
 
TStr GetSubStr (const int &BChN, const int &EChN) const
 
TStr GetSubStr (const int &BChN) const
 
void InsStr (const int &BChN, const TStr &Str)
 
void DelChAll (const char &Ch)
 
void DelSubStr (const int &BChN, const int &EChN)
 
bool DelStr (const TStr &Str)
 
TStr LeftOf (const char &SplitCh) const
 
TStr LeftOfLast (const char &SplitCh) const
 
TStr RightOf (const char &SplitCh) const
 
TStr RightOfLast (const char &SplitCh) const
 
void SplitOnCh (TStr &LStr, const char &SplitCh, TStr &RStr) const
 
void SplitOnLastCh (TStr &LStr, const char &SplitCh, TStr &RStr) const
 
void SplitOnAllCh (const char &SplitCh, TStrV &StrV, const bool &SkipEmpty=true) const
 
void SplitOnAllAnyCh (const TStr &SplitChStr, TStrV &StrV, const bool &SkipEmpty=true) const
 
void SplitOnWs (TStrV &StrV) const
 
void SplitOnNonAlNum (TStrV &StrV) const
 
void SplitOnStr (const TStr &SplitStr, TStrV &StrV) const
 
void SplitOnStr (TStr &LeftStr, const TStr &MidStr, TStr &RightStr) const
 
TStr Mid (const int &BChN, const int &Chs) const
 
TStr Mid (const int &BChN) const
 
TStr Left (const int &EChN) const
 
TStr Right (const int &BChN) const
 
TStr Slice (int BChN, int EChNP1) const
 
TStr operator() (const int &BChN, const int &EChNP1) const
 
int CountCh (const char &Ch, const int &BChN=0) const
 
int SearchCh (const char &Ch, const int &BChN=0) const
 
int SearchChBack (const char &Ch, int BChN=-1) const
 
int SearchStr (const TStr &Str, const int &BChN=0) const
 
bool IsChIn (const char &Ch) const
 
bool IsStrIn (const TStr &Str) const
 
bool IsPrefix (const char *Str) const
 
bool IsPrefix (const TStr &Str) const
 
bool IsSuffix (const char *Str) const
 
bool IsSuffix (const TStr &Str) const
 
int ChangeCh (const char &SrcCh, const char &DstCh, const int &BChN=0)
 
int ChangeChAll (const char &SrcCh, const char &DstCh)
 
int ChangeStr (const TStr &SrcStr, const TStr &DstStr, const int &BChN=0)
 
int ChangeStrAll (const TStr &SrcStr, const TStr &DstStr, const bool &FromStartP=false)
 
TStr Reverse () const
 
int GetPrimHashCd () const
 
int GetSecHashCd () const
 
bool IsBool (bool &Val) const
 
bool IsInt (const bool &Check, const int &MnVal, const int &MxVal, int &Val) const
 
bool IsInt (int &Val) const
 
bool IsInt () const
 
int GetInt () const
 
int GetInt (const int &DfVal) const
 
bool IsUInt (const bool &Check, const uint &MnVal, const uint &MxVal, uint &Val) const
 
bool IsUInt (uint &Val) const
 
bool IsUInt () const
 
uint GetUInt () const
 
uint GetUInt (const uint &DfVal) const
 
bool IsInt64 (const bool &Check, const int64 &MnVal, const int64 &MxVal, int64 &Val) const
 
bool IsInt64 (int64 &Val) const
 
bool IsInt64 () const
 
int64 GetInt64 () const
 
int64 GetInt64 (const int64 &DfVal) const
 
bool IsUInt64 (const bool &Check, const uint64 &MnVal, const uint64 &MxVal, uint64 &Val) const
 
bool IsUInt64 (uint64 &Val) const
 
bool IsUInt64 () const
 
uint64 GetUInt64 () const
 
uint64 GetUInt64 (const uint64 &DfVal) const
 
bool IsHexInt (const bool &Check, const int &MnVal, const int &MxVal, int &Val) const
 
bool IsHexInt (int &Val) const
 
bool IsHexInt () const
 
int GetHexInt () const
 
int GetHexInt (const int &DfVal) const
 
bool IsHexInt64 (const bool &Check, const int64 &MnVal, const int64 &MxVal, int64 &Val) const
 
bool IsHexInt64 (int64 &Val) const
 
bool IsHexInt64 () const
 
int64 GetHexInt64 () const
 
int64 GetHexInt64 (const int64 &DfVal) const
 
bool IsFlt (const bool &Check, const double &MnVal, const double &MxVal, double &Val, const char &DecDelimCh='.') const
 
bool IsFlt (double &Val) const
 
bool IsFlt () const
 
double GetFlt () const
 
double GetFlt (const double &DfVal) const
 
bool IsWord (const bool &WsPrefixP=true, const bool &FirstUcAllowedP=true) const
 
bool IsWs () const
 
bool IsWcMatch (const int &StrBChN, const TStr &WcStr, const int &WcStrBChN, TStrV &StarStrV, const char &StarCh='*', const char &QuestCh='?') const
 
bool IsWcMatch (const TStr &WcStr, TStrV &StarStrV, const char &StarCh='*', const char &QuestCh='?') const
 
bool IsWcMatch (const TStr &WcStr, const char &StarCh, const char &QuestCh) const
 
bool IsWcMatch (const TStr &WcStr, const int &StarStrN, TStr &StarStr) const
 
bool IsWcMatch (const TStr &WcStr) const
 
TStr GetWcMatch (const TStr &WcStr, const int &StarStrN=0) const
 
TStr GetFPath () const
 
TStr GetFBase () const
 
TStr GetFMid () const
 
TStr GetFExt () const
 
void SaveTxt (const PSOut &SOut) const
 
void SaveTxt (const TStr &FNm) const
 
TStr GetStr () const
 
char * GetCStr () const
 

Static Public Member Functions

static TStr GetNrFPath (const TStr &FPath)
 
static TStr GetNrFMid (const TStr &FMid)
 
static TStr GetNrFExt (const TStr &FExt)
 
static TStr GetNrNumFExt (const int &FExtN)
 
static TStr GetNrFNm (const TStr &FNm)
 
static TStr GetNrAbsFPath (const TStr &FPath, const TStr &BaseFPath=TStr())
 
static bool IsAbsFPath (const TStr &FPath)
 
static TStr PutFExt (const TStr &FNm, const TStr &FExt)
 
static TStr PutFExtIfEmpty (const TStr &FNm, const TStr &FExt)
 
static TStr PutFBase (const TStr &FNm, const TStr &FBase)
 
static TStr PutFBaseIfEmpty (const TStr &FNm, const TStr &FBase)
 
static TStr AddToFMid (const TStr &FNm, const TStr &ExtFMid)
 
static TStr GetNumFNm (const TStr &FNm, const int &Num)
 
static TStr GetFNmStr (const TStr &Str, const bool &AlNumOnlyP=true)
 
static TStr LoadTxt (const PSIn &SIn)
 
static TStr LoadTxt (const TStr &FNm)
 
static TStrGetChStr (const char &Ch)
 
static TStrGetDChStr (const char &Ch1, const char &Ch2)
 
static TStr GetStr (const TStr &Str, const char *FmtStr)
 
static TStr GetStr (const TStr &Str, const TStr &FmtStr)
 
static TStr GetStr (const TStrV &StrV, const TStr &DelimiterStr)
 
static TStr Fmt (const char *FmtStr,...)
 
static TStr GetSpaceStr (const int &Spaces)
 
static TStr MkClone (const TStr &Str)
 
static TStr GetNullStr ()
 

Private Member Functions

 TStr (const char &Ch, bool)
 
 TStr (const char &Ch1, const char &Ch2, bool)
 
void Optimize ()
 

Static Private Member Functions

static TRStrGetRStr (const char *CStr)
 

Private Attributes

TRStrRStr
 

Friends

TStr operator+ (const TStr &LStr, const TStr &RStr)
 
TStr operator+ (const TStr &LStr, const char *RCStr)
 

Detailed Description

Definition at line 412 of file dt.h.

Constructor & Destructor Documentation

TStr::TStr ( const char &  Ch,
bool   
)
inlineprivate

Definition at line 416 of file dt.h.

416  {
417  RStr=new TRStr(Ch); RStr->MkRef();}
TRStr * RStr
Definition: dt.h:414
void MkRef()
Definition: dt.h:378
Definition: dt.h:346
TStr::TStr ( const char &  Ch1,
const char &  Ch2,
bool   
)
inlineprivate

Definition at line 418 of file dt.h.

418  {
419  RStr=new TRStr(Ch1, Ch2); RStr->MkRef();}
TRStr * RStr
Definition: dt.h:414
void MkRef()
Definition: dt.h:378
Definition: dt.h:346
TStr::TStr ( )
inline

Definition at line 423 of file dt.h.

TRStr * RStr
Definition: dt.h:414
void MkRef()
Definition: dt.h:378
static TRStr * GetNullRStr()
Definition: dt.h:402
TStr::TStr ( const TStr Str)
inline

Definition at line 424 of file dt.h.

424 {RStr=Str.RStr; RStr->MkRef();}
TRStr * RStr
Definition: dt.h:414
void MkRef()
Definition: dt.h:378
TStr::TStr ( const TChA ChA)
inline

Definition at line 425 of file dt.h.

425 {RStr=GetRStr(ChA.CStr()); RStr->MkRef();}
TRStr * RStr
Definition: dt.h:414
char * CStr()
Definition: dt.h:255
void MkRef()
Definition: dt.h:378
static TRStr * GetRStr(const char *CStr)
Definition: dt.cpp:719
TStr::TStr ( const TSStr SStr)
inline

Definition at line 426 of file dt.h.

426 {RStr=GetRStr(SStr.CStr()); RStr->MkRef();}
TRStr * RStr
Definition: dt.h:414
char * CStr()
Definition: bd.h:531
void MkRef()
Definition: dt.h:378
static TRStr * GetRStr(const char *CStr)
Definition: dt.cpp:719
TStr::TStr ( const char *  CStr)
inline

Definition at line 427 of file dt.h.

427 {RStr=GetRStr(CStr); RStr->MkRef();}
TRStr * RStr
Definition: dt.h:414
void MkRef()
Definition: dt.h:378
static TRStr * GetRStr(const char *CStr)
Definition: dt.cpp:719
char * CStr()
Definition: dt.h:476
TStr::TStr ( const char &  Ch)
inlineexplicit

Definition at line 428 of file dt.h.

428 {RStr=GetChStr(Ch).RStr; RStr->MkRef();}
TRStr * RStr
Definition: dt.h:414
void MkRef()
Definition: dt.h:378
static TStr & GetChStr(const char &Ch)
Definition: dt.cpp:1551
TStr::TStr ( const TMem Mem)
inline

Definition at line 429 of file dt.h.

429  {
430  RStr=new TRStr(Mem.Len()); RStr->MkRef();
431  memcpy(CStr(), Mem(), Mem.Len()); Optimize();}
TRStr * RStr
Definition: dt.h:414
int Len() const
Definition: dt.h:134
void Optimize()
Definition: dt.cpp:729
void MkRef()
Definition: dt.h:378
char * CStr()
Definition: dt.h:476
Definition: dt.h:346
TStr::TStr ( const PSIn SIn)
inlineexplicit

Definition at line 432 of file dt.h.

432  {
433  int SInLen=SIn->Len(); RStr=new TRStr(SInLen); RStr->MkRef();
434  SIn->GetBf(CStr(), SInLen); Optimize();}
TRStr * RStr
Definition: dt.h:414
virtual int GetBf(const void *Bf, const TSize &BfL)=0
void Optimize()
Definition: dt.cpp:729
void MkRef()
Definition: dt.h:378
char * CStr()
Definition: dt.h:476
virtual int Len() const =0
Definition: dt.h:346
TStr::~TStr ( )
inline

Definition at line 435 of file dt.h.

435 {RStr->UnRef();}
TRStr * RStr
Definition: dt.h:414
void UnRef()
Definition: dt.h:379
TStr::TStr ( TSIn SIn,
const bool &  IsSmall = false 
)
inlineexplicit

Definition at line 436 of file dt.h.

436  :
437  RStr(new TRStr(SIn, IsSmall)){RStr->MkRef(); Optimize();}
TRStr * RStr
Definition: dt.h:414
void Optimize()
Definition: dt.cpp:729
void MkRef()
Definition: dt.h:378
Definition: dt.h:346

Member Function Documentation

TStr TStr::AddToFMid ( const TStr FNm,
const TStr ExtFMid 
)
static

Definition at line 1523 of file dt.cpp.

1523  {
1524  return FNm.GetFPath()+FNm.GetFMid()+ExtFMid+FNm.GetFExt();
1525 }
TStr GetFMid() const
Definition: dt.cpp:1403
TStr GetFPath() const
Definition: dt.cpp:1389
TStr GetFExt() const
Definition: dt.cpp:1421
int TStr::ChangeCh ( const char &  SrcCh,
const char &  DstCh,
const int &  BChN = 0 
)

Definition at line 1107 of file dt.cpp.

1107  {
1108  int ChN=SearchCh(SrcCh, BChN);
1109  if (ChN!=-1){PutCh(ChN, DstCh);}
1110  return ChN;
1111 }
int SearchCh(const char &Ch, const int &BChN=0) const
Definition: dt.cpp:1043
void PutCh(const int &ChN, const char &Ch)
Definition: dt.h:479
int TStr::ChangeChAll ( const char &  SrcCh,
const char &  DstCh 
)

Definition at line 1113 of file dt.cpp.

1113  {
1114  int FirstChN=SearchCh(SrcCh);
1115  if (FirstChN==-1){
1116  return 0;
1117  } else {
1118  TRStr* NewRStr=new TRStr(RStr->CStr());
1119  RStr->UnRef(); RStr=NewRStr; RStr->MkRef();
1120  char* ThisBf=CStr(); int StrLen=Len(); int Changes=0;
1121  for (int ChN=FirstChN; ChN<StrLen; ChN++){
1122  // slow: if (GetCh(ChN)==SrcCh){RStr->PutCh(ChN, DstCh); Changes++;}
1123  if (ThisBf[ChN]==SrcCh){ThisBf[ChN]=DstCh; Changes++;}
1124  }
1125  Optimize();
1126  return Changes;
1127  }
1128 }
int SearchCh(const char &Ch, const int &BChN=0) const
Definition: dt.cpp:1043
TRStr * RStr
Definition: dt.h:414
int Len() const
Definition: dt.h:487
const char * CStr() const
Definition: dt.h:381
void UnRef()
Definition: dt.h:379
void Optimize()
Definition: dt.cpp:729
void MkRef()
Definition: dt.h:378
char * CStr()
Definition: dt.h:476
Definition: dt.h:346
int TStr::ChangeStr ( const TStr SrcStr,
const TStr DstStr,
const int &  BChN = 0 
)

Definition at line 1130 of file dt.cpp.

1130  {
1131  int ChN=SearchStr(SrcStr, BChN);
1132  if (ChN==-1){
1133  return -1;
1134  } else {
1135  DelSubStr(ChN, ChN+SrcStr.Len()-1);
1136  InsStr(ChN, DstStr);
1137  return ChN;
1138  }
1139 }
int Len() const
Definition: dt.h:487
int SearchStr(const TStr &Str, const int &BChN=0) const
Definition: dt.cpp:1065
void DelSubStr(const int &BChN, const int &EChN)
Definition: dt.cpp:850
void InsStr(const int &BChN, const TStr &Str)
Definition: dt.cpp:825
int TStr::ChangeStrAll ( const TStr SrcStr,
const TStr DstStr,
const bool &  FromStartP = false 
)

Definition at line 1141 of file dt.cpp.

1141  {
1142  const int DstStrLen=DstStr.Len();
1143  int Changes=0-1; int BChN=0-DstStrLen;
1144  do {
1145  Changes++;
1146  if (FromStartP){BChN=0-DstStrLen;}
1147  BChN+=DstStrLen;
1148  BChN=ChangeStr(SrcStr, DstStr, BChN);
1149  } while (BChN!=-1);
1150  return Changes;
1151 }
int Len() const
Definition: dt.h:487
int ChangeStr(const TStr &SrcStr, const TStr &DstStr, const int &BChN=0)
Definition: dt.cpp:1130
void TStr::Clr ( )
inline

Definition at line 486 of file dt.h.

TRStr * RStr
Definition: dt.h:414
void UnRef()
Definition: dt.h:379
void MkRef()
Definition: dt.h:378
static TRStr * GetNullRStr()
Definition: dt.h:402
int TStr::CmpI ( const TStr Str) const
inline

Definition at line 494 of file dt.h.

494 {return TRStr::CmpI(CStr(), Str.CStr());}
static int CmpI(const char *CStr1, const char *CStr2)
Definition: dt.cpp:699
char * CStr()
Definition: dt.h:476
TStr & TStr::ConvUsFromYuAscii ( )

Definition at line 779 of file dt.cpp.

779  {
780  TRStr* NewRStr=new TRStr(RStr->CStr()); NewRStr->ConvUsFromYuAscii();
781  RStr->UnRef(); RStr=NewRStr; RStr->MkRef();
782  Optimize(); return *this;
783 }
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
void UnRef()
Definition: dt.h:379
void Optimize()
Definition: dt.cpp:729
void MkRef()
Definition: dt.h:378
void ConvUsFromYuAscii()
Definition: dt.cpp:693
Definition: dt.h:346
int TStr::CountCh ( const char &  Ch,
const int &  BChN = 0 
) const

Definition at line 1033 of file dt.cpp.

1033  {
1034  const int ThisLen=Len();
1035  const char* ThisBf=CStr();
1036  int Chs=0;
1037  for (int ChN=TInt::GetMx(BChN, 0); ChN<ThisLen; ChN++){
1038  if (ThisBf[ChN]==Ch){Chs++;}
1039  }
1040  return Chs;
1041 }
int Len() const
Definition: dt.h:487
static int GetMx(const int &Int1, const int &Int2)
Definition: dt.h:1092
char * CStr()
Definition: dt.h:476
char* TStr::CStr ( )
inline

Definition at line 476 of file dt.h.

476 {return RStr->CStr();}
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
const char* TStr::CStr ( ) const
inline

Definition at line 477 of file dt.h.

477 {return RStr->CStr();}
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
void TStr::DelChAll ( const char &  Ch)

Definition at line 840 of file dt.cpp.

840  {
841  TChA ChA(*this);
842  int ChN=ChA.SearchCh(Ch);
843  while (ChN!=-1){
844  ChA.Del(ChN);
845  ChN=ChA.SearchCh(Ch);
846  }
847  *this=ChA;
848 }
Definition: dt.h:201
bool TStr::DelStr ( const TStr Str)

Definition at line 863 of file dt.cpp.

863  {
864  int ChN=SearchStr(Str);
865  if (ChN==-1){
866  return false;
867  } else {
868  DelSubStr(ChN, ChN+Str.Len()-1);
869  return true;
870  }
871 }
int Len() const
Definition: dt.h:487
int SearchStr(const TStr &Str, const int &BChN=0) const
Definition: dt.cpp:1065
void DelSubStr(const int &BChN, const int &EChN)
Definition: dt.cpp:850
void TStr::DelSubStr ( const int &  BChN,
const int &  EChN 
)

Definition at line 850 of file dt.cpp.

850  {
851  int BChN=TInt::GetMx(_BChN, 0);
852  int EChN=TInt::GetMn(_EChN, Len()-1);
853  int Chs=Len()-(EChN-BChN+1);
854  if (Chs==0){Clr();}
855  else if (Chs<Len()){
856  char* Bf=new char[Chs+1]; strncpy(Bf, CStr(), BChN);
857  strncpy(Bf+BChN, CStr()+EChN+1, Len()-EChN-1); Bf[Chs]=0;
858  TStr Str(Bf); delete[] Bf;
859  *this=Str;
860  }
861 }
int Len() const
Definition: dt.h:487
static int GetMx(const int &Int1, const int &Int2)
Definition: dt.h:1092
void Clr()
Definition: dt.h:486
static int GetMn(const int &Int1, const int &Int2)
Definition: dt.h:1090
Definition: dt.h:412
char * CStr()
Definition: dt.h:476
bool TStr::Empty ( ) const
inline

Definition at line 488 of file dt.h.

488 {return RStr->Empty();}
TRStr * RStr
Definition: dt.h:414
bool Empty() const
Definition: dt.h:383
bool TStr::EqI ( const TStr Str) const
inline

Definition at line 495 of file dt.h.

495 {return TRStr::CmpI(CStr(), Str.CStr())==0;}
static int CmpI(const char *CStr1, const char *CStr2)
Definition: dt.cpp:699
char * CStr()
Definition: dt.h:476
TStr TStr::Fmt ( const char *  FmtStr,
  ... 
)
static

Definition at line 1599 of file dt.cpp.

1599  {
1600  char Bf[10*1024];
1601  va_list valist;
1602  va_start(valist, FmtStr);
1603  const int RetVal=vsnprintf(Bf, 10*1024-2, FmtStr, valist);
1604  va_end(valist);
1605  return RetVal!=-1 ? TStr(Bf) : TStr::GetNullStr();
1606 }
static TStr GetNullStr()
Definition: dt.cpp:1626
Definition: dt.h:412
TStr()
Definition: dt.h:423
TStr & TStr::FromHex ( )

Definition at line 798 of file dt.cpp.

798  {
799  int StrLen=Len(); IAssert(StrLen%2==0);
800  TChA ChA; int ChN=0;
801  while (ChN<StrLen){
802  char MshCh=RStr->Bf[ChN]; ChN++;
803  char LshCh=RStr->Bf[ChN]; ChN++;
804  uchar Ch=uchar(TCh::GetHex(MshCh)*16+TCh::GetHex(LshCh));
805  ChA+=Ch;
806  }
807  *this=ChA;
808  return *this;
809 }
#define IAssert(Cond)
Definition: bd.h:262
TRStr * RStr
Definition: dt.h:414
int Len() const
Definition: dt.h:487
static int GetHex(const char &Ch)
Definition: dt.h:979
char * Bf
Definition: dt.h:348
unsigned char uchar
Definition: bd.h:10
Definition: dt.h:201
TStr TStr::GetCap ( ) const
inline

Definition at line 502 of file dt.h.

502 {return TStr(*this).ToCap();}
TStr()
Definition: dt.h:423
char TStr::GetCh ( const int &  ChN) const
inline

Definition at line 483 of file dt.h.

483 {return RStr->GetCh(ChN);}
TRStr * RStr
Definition: dt.h:414
char GetCh(const int &ChN) const
Definition: dt.h:388
TStr & TStr::GetChStr ( const char &  Ch)
static

Definition at line 1551 of file dt.cpp.

1551  {
1552  static char MnCh=char(CHAR_MIN);
1553  static char MxCh=char(CHAR_MAX);
1554  static int Chs=int(MxCh)-int(MnCh)+1;
1555  static TStrV ChStrV;
1556  if (ChStrV.Empty()){
1557  ChStrV.Gen(Chs);
1558  for (int ChN=0; ChN<Chs; ChN++){
1559  ChStrV[ChN]=TStr(char(MnCh+ChN), true);}
1560  }
1561  return ChStrV[int(Ch-MnCh)];
1562 }
bool Empty() const
Tests whether the vector is empty.
Definition: ds.h:542
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:495
TStr()
Definition: dt.h:423
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:429
char* TStr::GetCStr ( ) const
inline

Definition at line 685 of file dt.h.

685  {
686  char* Bf=new char[Len()+1]; strcpy(Bf, CStr()); return Bf;}
int Len() const
Definition: dt.h:487
char * CStr()
Definition: dt.h:476
TStr & TStr::GetDChStr ( const char &  Ch1,
const char &  Ch2 
)
static

Definition at line 1564 of file dt.cpp.

1564  {
1565  Fail; // temporary
1566  static TStrVV DChStrVV;
1567  if (DChStrVV.Empty()){
1568  DChStrVV.Gen(TCh::Vals, TCh::Vals);
1569  for (int Ch1N=0; Ch1N<TCh::Vals; Ch1N++){
1570  for (int Ch2N=0; Ch2N<TCh::Vals; Ch2N++){
1571  DChStrVV.At(Ch1N, Ch2N)=
1572  TStr(char(TCh::Mn+Ch1N), char(TCh::Mn+Ch2N), true);
1573  }
1574  }
1575  }
1576  return DChStrVV.At(int(Ch1-TCh::Mn), int(Ch2-TCh::Mn));
1577 }
#define Fail
Definition: bd.h:238
Definition: ds.h:2157
static const char Mn
Definition: dt.h:939
bool Empty() const
Definition: ds.h:2179
void Gen(const int &_XDim, const int &_YDim)
Definition: ds.h:2181
static const int Vals
Definition: dt.h:941
TStr()
Definition: dt.h:423
const TVal & At(const int &X, const int &Y) const
Definition: ds.h:2190
TStr TStr::GetFBase ( ) const

Definition at line 1396 of file dt.cpp.

1396  {
1397  int ThisLen=Len(); const char* ThisBf=CStr();
1398  int ChN=ThisLen-1;
1399  while ((ChN>=0)&&(ThisBf[ChN]!='/')&&(ThisBf[ChN]!='\\')){ChN--;}
1400  return GetSubStr(ChN+1, ThisLen);
1401 }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
char * CStr()
Definition: dt.h:476
TStr TStr::GetFExt ( ) const

Definition at line 1421 of file dt.cpp.

1421  {
1422  int ThisLen=Len(); const char* ThisBf=CStr();
1423  int ChN=ThisLen-1;
1424  while ((ChN>=0)&&(ThisBf[ChN]!='/')&&(ThisBf[ChN]!='\\')&&
1425  (ThisBf[ChN]!='.')){ChN--;}
1426  if ((ChN>=0)&&(ThisBf[ChN]=='.')){return GetSubStr(ChN, Len());}
1427  else {return TStr();}
1428 }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
char * CStr()
Definition: dt.h:476
TStr()
Definition: dt.h:423
double TStr::GetFlt ( ) const
inline

Definition at line 628 of file dt.h.

628  {
629  double Val; IAssert(IsFlt(false, 0, 0, Val)); return Val;}
#define IAssert(Cond)
Definition: bd.h:262
bool IsFlt() const
Definition: dt.h:627
double TStr::GetFlt ( const double &  DfVal) const
inline

Definition at line 630 of file dt.h.

630  {
631  double Val; if (IsFlt(false, 0, 0, Val)){return Val;} else {return DfVal;}}
bool IsFlt() const
Definition: dt.h:627
TStr TStr::GetFMid ( ) const

Definition at line 1403 of file dt.cpp.

1403  {
1404  int ThisLen=Len(); const char* ThisBf=CStr();
1405  int ChN=ThisLen-1;
1406  while ((ChN>=0)&&(ThisBf[ChN]!='/')&&(ThisBf[ChN]!='\\')&&(ThisBf[ChN]!='.')){
1407  ChN--;}
1408  if (ChN<0){
1409  return *this;
1410  } else {
1411  if (ThisBf[ChN]=='.'){
1412  int EChN= --ChN;
1413  while ((ChN>=0)&&(ThisBf[ChN]!='/')&&(ThisBf[ChN]!='\\')){ChN--;}
1414  return GetSubStr(ChN+1, EChN);
1415  } else {
1416  return GetSubStr(ChN+1, ThisLen);
1417  }
1418  }
1419 }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
char * CStr()
Definition: dt.h:476
TStr TStr::GetFNmStr ( const TStr Str,
const bool &  AlNumOnlyP = true 
)
static

Definition at line 1531 of file dt.cpp.

1531  {
1532  TChA FNm=Str;
1533  for (int ChN=0; ChN<FNm.Len(); ChN++){
1534  uchar Ch=FNm[ChN];
1535  if (AlNumOnlyP){
1536  if (
1537  (('0'<=Ch)&&(Ch<='9'))||
1538  (('A'<=Ch)&&(Ch<='Z'))||
1539  (('a'<=Ch)&&(Ch<='z'))||
1540  (Ch=='-')||(Ch=='_')){}
1541  else {Ch='_';}
1542  } else {
1543  if ((Ch<=' ')||(Ch=='/')||(Ch=='\\')||(Ch==':')||(Ch=='.')){
1544  Ch='_';}
1545  }
1546  FNm.PutCh(ChN, Ch);
1547  }
1548  return FNm;
1549 }
void PutCh(const int &ChN, const char &Ch)
Definition: dt.h:278
int Len() const
Definition: dt.h:259
unsigned char uchar
Definition: bd.h:10
Definition: dt.h:201
TStr TStr::GetFPath ( ) const

Definition at line 1389 of file dt.cpp.

1389  {
1390  int ThisLen=Len(); const char* ThisBf=CStr();
1391  int ChN=ThisLen-1;
1392  while ((ChN>=0)&&(ThisBf[ChN]!='/')&&(ThisBf[ChN]!='\\')){ChN--;}
1393  return GetSubStr(0, ChN);
1394 }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
char * CStr()
Definition: dt.h:476
TStr TStr::GetFromHex ( ) const
inline

Definition at line 514 of file dt.h.

514 {return TStr(*this).FromHex();}
TStr()
Definition: dt.h:423
TStr TStr::GetHex ( ) const
inline

Definition at line 512 of file dt.h.

512 {return TStr(*this).ToHex();}
TStr()
Definition: dt.h:423
int TStr::GetHexInt ( ) const
inline

Definition at line 611 of file dt.h.

611  {
612  int Val; IAssert(IsHexInt(false, 0, 0, Val)); return Val;}
#define IAssert(Cond)
Definition: bd.h:262
bool IsHexInt() const
Definition: dt.h:610
int TStr::GetHexInt ( const int &  DfVal) const
inline

Definition at line 613 of file dt.h.

613  {
614  int Val; if (IsHexInt(false, 0, 0, Val)){return Val;} else {return DfVal;}}
bool IsHexInt() const
Definition: dt.h:610
int64 TStr::GetHexInt64 ( ) const
inline

Definition at line 619 of file dt.h.

619  {
620  int64 Val; IAssert(IsHexInt64(false, 0, 0, Val)); return Val;}
#define IAssert(Cond)
Definition: bd.h:262
bool IsHexInt64() const
Definition: dt.h:618
long long int64
Definition: bd.h:27
int64 TStr::GetHexInt64 ( const int64 DfVal) const
inline

Definition at line 621 of file dt.h.

621  {
622  int64 Val; if (IsHexInt64(false, 0, 0, Val)){return Val;} else {return DfVal;}}
bool IsHexInt64() const
Definition: dt.h:618
long long int64
Definition: bd.h:27
int TStr::GetInt ( ) const
inline

Definition at line 578 of file dt.h.

578 {int Val; IAssertR(IsInt(false, 0, 0, Val), *this); return Val;}
#define IAssertR(Cond, Reason)
Definition: bd.h:265
bool IsInt() const
Definition: dt.h:577
int TStr::GetInt ( const int &  DfVal) const
inline

Definition at line 579 of file dt.h.

579  {
580  int Val; if (IsInt(false, 0, 0, Val)){return Val;} else {return DfVal;}}
bool IsInt() const
Definition: dt.h:577
int64 TStr::GetInt64 ( ) const
inline

Definition at line 594 of file dt.h.

594  {
595  int64 Val; IAssert(IsInt64(false, 0, 0, Val)); return Val;}
#define IAssert(Cond)
Definition: bd.h:262
bool IsInt64() const
Definition: dt.h:593
long long int64
Definition: bd.h:27
int64 TStr::GetInt64 ( const int64 DfVal) const
inline

Definition at line 596 of file dt.h.

596  {
597  int64 Val; if (IsInt64(false, 0, 0, Val)){return Val;} else {return DfVal;}}
bool IsInt64() const
Definition: dt.h:593
long long int64
Definition: bd.h:27
TStr TStr::GetLc ( ) const
inline

Definition at line 499 of file dt.h.

499 {return TStr(*this).ToLc();}
TStr()
Definition: dt.h:423
int TStr::GetMemUsed ( ) const
inline

Definition at line 472 of file dt.h.

472 {return int(sizeof(TRStr*)+RStr->GetMemUsed());}
TRStr * RStr
Definition: dt.h:414
int GetMemUsed() const
Definition: dt.h:376
Definition: dt.h:346
TStr TStr::GetNrAbsFPath ( const TStr FPath,
const TStr BaseFPath = TStr() 
)
static

Definition at line 1471 of file dt.cpp.

1471  {
1472  TStr NrBaseFPath;
1473  if (BaseFPath.Empty()){
1474  NrBaseFPath=GetNrFPath(TDir::GetCurDir());
1475  } else {
1476  NrBaseFPath=GetNrFPath(BaseFPath);
1477  }
1478  IAssert(IsAbsFPath(NrBaseFPath));
1479  TStr NrFPath=GetNrFPath(FPath);
1480  TStr NrAbsFPath;
1481  if (IsAbsFPath(NrFPath)){
1482  NrAbsFPath=NrFPath;
1483  } else {
1484  NrAbsFPath=GetNrFPath(NrBaseFPath+NrFPath);
1485  }
1486  NrAbsFPath.ChangeStrAll("/./", "/");
1487  NrAbsFPath.ChangeStrAll("\\.\\", "\\");
1488  return NrAbsFPath;
1489 }
#define IAssert(Cond)
Definition: bd.h:262
static TStr GetCurDir()
Definition: xfl.cpp:233
int ChangeStrAll(const TStr &SrcStr, const TStr &DstStr, const bool &FromStartP=false)
Definition: dt.cpp:1141
static TStr GetNrFPath(const TStr &FPath)
Definition: dt.cpp:1430
Definition: dt.h:412
bool Empty() const
Definition: dt.h:488
static bool IsAbsFPath(const TStr &FPath)
Definition: dt.cpp:1491
TStr TStr::GetNrFExt ( const TStr FExt)
static

Definition at line 1455 of file dt.cpp.

1455  {
1456  if (FExt.Empty()||(FExt[0]=='.')){return FExt;}
1457  else {return TStr(".")+FExt;}
1458 }
bool Empty() const
Definition: dt.h:488
TStr()
Definition: dt.h:423
TStr TStr::GetNrFMid ( const TStr FMid)
static

Definition at line 1445 of file dt.cpp.

1445  {
1446  TChA NrFMid;
1447  int FMidLen=FMid.Len();
1448  for (int ChN=0; ChN<FMidLen; ChN++){
1449  char Ch=FMid[ChN];
1450  if (TCh::IsAlNum(Ch)){NrFMid+=Ch;} else {NrFMid+='_';}
1451  }
1452  return NrFMid;
1453 }
int Len() const
Definition: dt.h:487
Definition: dt.h:201
static bool IsAlNum(const char &Ch)
Definition: dt.h:975
TStr TStr::GetNrFNm ( const TStr FNm)
static

Definition at line 1467 of file dt.cpp.

1467  {
1468  return GetNrFPath(FNm.GetFPath())+FNm.GetFMid()+GetNrFExt(FNm.GetFExt());
1469 }
TStr GetFMid() const
Definition: dt.cpp:1403
TStr GetFPath() const
Definition: dt.cpp:1389
TStr GetFExt() const
Definition: dt.cpp:1421
static TStr GetNrFPath(const TStr &FPath)
Definition: dt.cpp:1430
static TStr GetNrFExt(const TStr &FExt)
Definition: dt.cpp:1455
TStr TStr::GetNrFPath ( const TStr FPath)
static

Definition at line 1430 of file dt.cpp.

1430  {
1431  TChA NrFPath(FPath.Len()+4); NrFPath+=FPath;
1432  NrFPath.ChangeCh('\\', '/');
1433  if (NrFPath.Empty()){NrFPath="./";}
1434  if ((NrFPath.Len()>=2)&&isalpha(NrFPath[0])&&(NrFPath[1]==':')){
1435  if (NrFPath.Len()==2){NrFPath+="./";}
1436  if ((NrFPath[2]!='.')&&(NrFPath[2]!='/')){NrFPath.Ins(2, "./");}
1437  if (NrFPath[NrFPath.Len()-1]!='/'){NrFPath+="/";}
1438  } else {
1439  if ((NrFPath[0]!='.')&&(NrFPath[0]!='/')){NrFPath.Ins(0, "./");}
1440  if (NrFPath[NrFPath.Len()-1]!='/'){NrFPath+="/";}
1441  }
1442  return NrFPath;
1443 }
int Len() const
Definition: dt.h:487
Definition: dt.h:201
int ChangeCh(const char &SrcCh, const char &DstCh, const int &BChN=0)
Definition: dt.cpp:1107
TStr TStr::GetNrNumFExt ( const int &  FExtN)
static

Definition at line 1460 of file dt.cpp.

1460  {
1461  TStr FExtNStr=TInt::GetStr(FExtN);
1462  while (FExtNStr.Len()<3){
1463  FExtNStr=TStr("0")+FExtNStr;}
1464  return FExtNStr;
1465 }
TStr GetStr() const
Definition: dt.h:1107
int Len() const
Definition: dt.h:487
Definition: dt.h:412
TStr()
Definition: dt.h:423
TStr TStr::GetNullStr ( )
static

Definition at line 1626 of file dt.cpp.

1626  {
1627  static TStr NullStr="";
1628  return NullStr;
1629 }
Definition: dt.h:412
TStr TStr::GetNumFNm ( const TStr FNm,
const int &  Num 
)
static

Definition at line 1527 of file dt.cpp.

1527  {
1528  return FNm.GetFPath()+FNm.GetFMid()+TInt::GetStr(Num, "%03d")+FNm.GetFExt();
1529 }
TStr GetStr() const
Definition: dt.h:1107
TStr GetFMid() const
Definition: dt.cpp:1403
TStr GetFPath() const
Definition: dt.cpp:1389
TStr GetFExt() const
Definition: dt.cpp:1421
int TStr::GetPrimHashCd ( ) const
inline

Definition at line 569 of file dt.h.

569 {return RStr->GetPrimHashCd();}
TRStr * RStr
Definition: dt.h:414
int GetPrimHashCd() const
Definition: dt.cpp:709
TRStr * TStr::GetRStr ( const char *  CStr)
staticprivate

Definition at line 719 of file dt.cpp.

719  {
720  int CStrLen;
721  if (CStr==NULL){CStrLen=0;} else {CStrLen=int(strlen(CStr));}
722  if (CStrLen==0){return TRStr::GetNullRStr();}
723  // next lines are not multi-threading safe
724  //else if (CStrLen==1){return GetChStr(CStr[0]).RStr;}
725  //else if (CStrLen==2){return GetDChStr(CStr[0], CStr[1]).RStr;}
726  else {return new TRStr(CStr);}
727 }
static TRStr * GetNullRStr()
Definition: dt.h:402
char * CStr()
Definition: dt.h:476
Definition: dt.h:346
int TStr::GetSecHashCd ( ) const
inline

Definition at line 570 of file dt.h.

570 {return RStr->GetSecHashCd();}
TRStr * RStr
Definition: dt.h:414
int GetSecHashCd() const
Definition: dt.cpp:713
TStr TStr::GetSpaceStr ( const int &  Spaces)
static

Definition at line 1608 of file dt.cpp.

1608  {
1609  static TStrV SpaceStrV;
1610  if (SpaceStrV.Len()==0){
1611  for (int SpaceStrN=0; SpaceStrN<10; SpaceStrN++){
1612  TChA SpaceChA;
1613  for (int ChN=0; ChN<SpaceStrN; ChN++){SpaceChA+=' ';}
1614  SpaceStrV.Add(SpaceChA);
1615  }
1616  }
1617  if ((0<=Spaces)&&(Spaces<SpaceStrV.Len())){
1618  return SpaceStrV[Spaces];
1619  } else {
1620  TChA SpaceChA;
1621  for (int ChN=0; ChN<Spaces; ChN++){SpaceChA+=' ';}
1622  return SpaceChA;
1623  }
1624 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
Definition: dt.h:201
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:429
TStr TStr::GetStr ( ) const
inline

Definition at line 678 of file dt.h.

678 {return *this;}
TStr TStr::GetStr ( const TStr Str,
const char *  FmtStr 
)
static

Definition at line 1579 of file dt.cpp.

1579  {
1580  if (FmtStr==NULL){
1581  return Str;
1582  } else {
1583  char Bf[1000];
1584  sprintf(Bf, FmtStr, Str.CStr());
1585  return TStr(Bf);
1586  }
1587 }
char * CStr()
Definition: dt.h:476
TStr()
Definition: dt.h:423
static TStr TStr::GetStr ( const TStr Str,
const TStr FmtStr 
)
inlinestatic

Definition at line 680 of file dt.h.

680  {
681  return GetStr(Str, FmtStr.CStr());}
TStr GetStr() const
Definition: dt.h:678
char * CStr()
Definition: dt.h:476
TStr TStr::GetStr ( const TStrV StrV,
const TStr DelimiterStr 
)
static

Definition at line 1589 of file dt.cpp.

1589  {
1590  if (StrV.Empty()){return TStr();}
1591  TChA ResStr=StrV[0];
1592  for (int StrN=1; StrN<StrV.Len(); StrN++){
1593  ResStr+=DelimiterStr;
1594  ResStr+=StrV[StrN];
1595  }
1596  return ResStr;
1597 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
bool Empty() const
Tests whether the vector is empty.
Definition: ds.h:542
Definition: dt.h:201
TStr()
Definition: dt.h:423
TStr TStr::GetSubStr ( const int &  BChN,
const int &  EChN 
) const

Definition at line 811 of file dt.cpp.

811  {
812  int StrLen=Len();
813  int BChN=TInt::GetMx(_BChN, 0);
814  int EChN=TInt::GetMn(_EChN, StrLen-1);
815  int Chs=EChN-BChN+1;
816  if (Chs<=0){return TStr();}
817  else if (Chs==StrLen){return *this;}
818  else {
819  char* Bf=new char[Chs+1]; strncpy(Bf, CStr()+BChN, Chs); Bf[Chs]=0;
820  TStr Str(Bf); delete[] Bf;
821  return Str;
822  }
823 }
int Len() const
Definition: dt.h:487
static int GetMx(const int &Int1, const int &Int2)
Definition: dt.h:1092
static int GetMn(const int &Int1, const int &Int2)
Definition: dt.h:1090
Definition: dt.h:412
char * CStr()
Definition: dt.h:476
TStr()
Definition: dt.h:423
TStr TStr::GetSubStr ( const int &  BChN) const
inline

Definition at line 517 of file dt.h.

517 { return GetSubStr(BChN, Len()-1); }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
TStr TStr::GetTrunc ( ) const
inline

Definition at line 506 of file dt.h.

506 {return TStr(*this).ToTrunc();}
TStr()
Definition: dt.h:423
TStr TStr::GetUc ( ) const
inline

Definition at line 493 of file dt.h.

493 {return TStr(*this).ToUc();}
TStr()
Definition: dt.h:423
uint TStr::GetUInt ( ) const
inline

Definition at line 586 of file dt.h.

586 {uint Val; IAssert(IsUInt(false, 0, 0, Val)); return Val;}
#define IAssert(Cond)
Definition: bd.h:262
bool IsUInt() const
Definition: dt.h:585
unsigned int uint
Definition: bd.h:11
uint TStr::GetUInt ( const uint DfVal) const
inline

Definition at line 587 of file dt.h.

587  {
588  uint Val; if (IsUInt(false, 0, 0, Val)){return Val;} else {return DfVal;}}
bool IsUInt() const
Definition: dt.h:585
unsigned int uint
Definition: bd.h:11
uint64 TStr::GetUInt64 ( ) const
inline

Definition at line 603 of file dt.h.

603  {
604  uint64 Val; IAssert(IsUInt64(false, 0, 0, Val)); return Val;}
#define IAssert(Cond)
Definition: bd.h:262
unsigned long long uint64
Definition: bd.h:38
bool IsUInt64() const
Definition: dt.h:602
uint64 TStr::GetUInt64 ( const uint64 DfVal) const
inline

Definition at line 605 of file dt.h.

605  {
606  uint64 Val; if (IsUInt64(false, 0, 0, Val)){return Val;} else {return DfVal;}}
unsigned long long uint64
Definition: bd.h:38
bool IsUInt64() const
Definition: dt.h:602
TStr TStr::GetUsFromYuAscii ( ) const
inline

Definition at line 509 of file dt.h.

509 {return TStr(*this).ConvUsFromYuAscii();}
TStr()
Definition: dt.h:423
TStr TStr::GetWcMatch ( const TStr WcStr,
const int &  StarStrN = 0 
) const

Definition at line 1379 of file dt.cpp.

1379  {
1380  TStrV StarStrV;
1381  if (IsWcMatch(WcStr, StarStrV)&&(StarStrV.Len()>=StarStrN)){
1382  IAssert(StarStrN>=0);
1383  return StarStrV[StarStrV.Len()-StarStrN-1];
1384  } else {
1385  return "";
1386  }
1387 }
#define IAssert(Cond)
Definition: bd.h:262
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
bool IsWcMatch(const int &StrBChN, const TStr &WcStr, const int &WcStrBChN, TStrV &StarStrV, const char &StarCh='*', const char &QuestCh='?') const
Definition: dt.cpp:1311
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:429
void TStr::InsStr ( const int &  BChN,
const TStr Str 
)

Definition at line 825 of file dt.cpp.

825  {
826  int ThisLen=Len();
827  IAssert((0<=BChN)&&(BChN<=ThisLen));
828  TStr NewStr;
829  if (BChN==0){
830  NewStr=Str+*this;
831  } else
832  if (BChN==ThisLen){
833  NewStr=*this+Str;
834  } else {
835  NewStr=GetSubStr(0, BChN-1)+Str+GetSubStr(BChN, ThisLen-1);
836  }
837  *this=NewStr;
838 }
#define IAssert(Cond)
Definition: bd.h:262
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
Definition: dt.h:412
bool TStr::IsAbsFPath ( const TStr FPath)
static

Definition at line 1491 of file dt.cpp.

1491  {
1492  if ((FPath.Len()>=3)&&isalpha(FPath[0])&&(FPath[1]==':')&&
1493  ((FPath[2]=='/')||(FPath[2]=='\\'))){
1494  return true;
1495  }
1496  return false;
1497 }
int Len() const
Definition: dt.h:487
bool TStr::IsBool ( bool &  Val) const

Definition at line 1153 of file dt.cpp.

1153  {
1154  if (operator==("T")){Val=true; return true;}
1155  else if (operator==("F")){Val=false; return true;}
1156  else {return false;}
1157 }
bool TStr::IsChIn ( const char &  Ch) const
inline

Definition at line 553 of file dt.h.

553 {return SearchCh(Ch)!=-1;}
int SearchCh(const char &Ch, const int &BChN=0) const
Definition: dt.cpp:1043
bool TStr::IsFlt ( const bool &  Check,
const double &  MnVal,
const double &  MxVal,
double &  Val,
const char &  DecDelimCh = '.' 
) const

Definition at line 1265 of file dt.cpp.

1266  {
1267  // parsing format {ws} [+/-] +{d} ([.]{d}) ([E|e] [+/-] +{d})
1268  TChRet Ch(TStrIn::New(*this));
1269  while (TCh::IsWs(Ch.GetCh())){}
1270  if ((Ch()=='+')||(Ch()=='-')){Ch.GetCh();}
1271  if (!TCh::IsNum(Ch())&&Ch()!=DecDelimCh){return false;}
1272  while (TCh::IsNum(Ch.GetCh())){}
1273  if (Ch()==DecDelimCh){
1274  Ch.GetCh();
1275  while (TCh::IsNum(Ch.GetCh())){}
1276  }
1277  if ((Ch()=='e')||(Ch()=='E')){
1278  Ch.GetCh();
1279  if ((Ch()=='+')||(Ch()=='-')){Ch.GetCh();}
1280  if (!TCh::IsNum(Ch())){return false;}
1281  while (TCh::IsNum(Ch.GetCh())){}
1282  }
1283  if (!Ch.Eof()){return false;}
1284  double _Val=atof(CStr());
1285  if (Check&&((_Val<MnVal)||(_Val>MxVal))){
1286  return false;
1287  } else {
1288  Val=_Val; return true;
1289  }
1290 }
static bool IsNum(const char &Ch)
Definition: dt.h:974
static bool IsWs(const char &Ch)
Definition: dt.h:970
static PSIn New(const TStr &Str)
Definition: dt.h:708
char * CStr()
Definition: dt.h:476
Definition: fl.h:482
bool TStr::IsFlt ( double &  Val) const
inline

Definition at line 626 of file dt.h.

626 {return IsFlt(false, 0, 0, Val);}
bool IsFlt() const
Definition: dt.h:627
bool TStr::IsFlt ( ) const
inline

Definition at line 627 of file dt.h.

627 {double Val; return IsFlt(false, 0, 0, Val);}
bool IsFlt() const
Definition: dt.h:627
bool TStr::IsHexInt ( const bool &  Check,
const int &  MnVal,
const int &  MxVal,
int &  Val 
) const

Definition at line 1190 of file dt.cpp.

1190  {
1191  // parsing format {ws} [+/-][0x] +{XXX}
1192  int _Val=0;
1193  bool Minus=false;
1194  TChRet Ch(TStrIn::New(*this));
1195  while (TCh::IsWs(Ch.GetCh())){}
1196  if (Ch()=='+'){Minus=false; Ch.GetCh();}
1197  if (Ch()=='-'){Minus=true; Ch.GetCh();}
1198  if (Ch()=='0'){
1199  Ch.GetCh();
1200  if (tolower(Ch())=='x' ){
1201  Ch.GetCh(); if (Ch.Eof()){return false;}
1202  }
1203  }
1204  if (!Ch.Eof() && !TCh::IsHex(Ch())){return false;}
1205  if (!Ch.Eof()) _Val = TCh::GetHex(Ch());
1206  while (TCh::IsHex(Ch.GetCh())){_Val=16*_Val+TCh::GetHex(Ch());}
1207  if (Minus){_Val=-_Val;}
1208  if (Check&&((_Val<MnVal)||(_Val>MxVal))){return false;}
1209  if (Ch.Eof()){Val=_Val; return true;} else {return false;}
1210 }
static bool IsHex(const char &Ch)
Definition: dt.h:977
static int GetHex(const char &Ch)
Definition: dt.h:979
static bool IsWs(const char &Ch)
Definition: dt.h:970
static PSIn New(const TStr &Str)
Definition: dt.h:708
Definition: fl.h:482
bool TStr::IsHexInt ( int &  Val) const
inline

Definition at line 609 of file dt.h.

609 {return IsHexInt(false, 0, 0, Val);}
bool IsHexInt() const
Definition: dt.h:610
bool TStr::IsHexInt ( ) const
inline

Definition at line 610 of file dt.h.

610 {int Val; return IsHexInt(false, 0, 0, Val);}
bool IsHexInt() const
Definition: dt.h:610
bool TStr::IsHexInt64 ( const bool &  Check,
const int64 MnVal,
const int64 MxVal,
int64 Val 
) const

Definition at line 1243 of file dt.cpp.

1244  {
1245  // parsing format {ws} [+/-][0x] +{XXX}
1246  int64 _Val=0;
1247  bool Minus=false;
1248  TChRet Ch(TStrIn::New(*this));
1249  while (TCh::IsWs(Ch.GetCh())){}
1250  if (Ch()=='+'){Minus=false; Ch.GetCh();}
1251  if (Ch()=='-'){Minus=true; Ch.GetCh();}
1252  if (Ch()=='0'){
1253  Ch.GetCh();
1254  if (tolower(Ch())=='x' ){
1255  Ch.GetCh(); if (Ch.Eof()){return false;}
1256  }
1257  }
1258  if (!Ch.Eof()) _Val=TCh::GetHex(Ch());
1259  while (TCh::IsHex(Ch.GetCh())){_Val=16*_Val+TCh::GetHex(Ch());}
1260  if (Minus){_Val=-_Val;}
1261  if (Check&&((_Val<MnVal)||(_Val>MxVal))){return false;}
1262  if (Ch.Eof()){Val=_Val; return true;} else {return false;}
1263 }
static bool IsHex(const char &Ch)
Definition: dt.h:977
static int GetHex(const char &Ch)
Definition: dt.h:979
static bool IsWs(const char &Ch)
Definition: dt.h:970
static PSIn New(const TStr &Str)
Definition: dt.h:708
long long int64
Definition: bd.h:27
Definition: fl.h:482
bool TStr::IsHexInt64 ( int64 Val) const
inline

Definition at line 617 of file dt.h.

617 {return IsHexInt64(false, 0, 0, Val);}
bool IsHexInt64() const
Definition: dt.h:618
bool TStr::IsHexInt64 ( ) const
inline

Definition at line 618 of file dt.h.

618 {int64 Val; return IsHexInt64(false, 0, 0, Val);}
bool IsHexInt64() const
Definition: dt.h:618
long long int64
Definition: bd.h:27
bool TStr::IsInt ( const bool &  Check,
const int &  MnVal,
const int &  MxVal,
int &  Val 
) const

Definition at line 1159 of file dt.cpp.

1160  {
1161  // parsing format {ws} [+/-] +{ddd}
1162  int _Val=0;
1163  bool Minus=false;
1164  TChRet Ch(TStrIn::New(*this));
1165  while (TCh::IsWs(Ch.GetCh())){}
1166  if (Ch()=='+'){Minus=false; Ch.GetCh();}
1167  if (Ch()=='-'){Minus=true; Ch.GetCh();}
1168  if (!TCh::IsNum(Ch())){return false;}
1169  _Val=TCh::GetNum(Ch());
1170  while (TCh::IsNum(Ch.GetCh())){_Val=10*_Val+TCh::GetNum(Ch());}
1171  if (Minus){_Val=-_Val;}
1172  if (Check&&((_Val<MnVal)||(_Val>MxVal))){return false;}
1173  if (Ch.Eof()){Val=_Val; return true;} else {return false;}
1174 }
static bool IsNum(const char &Ch)
Definition: dt.h:974
static bool IsWs(const char &Ch)
Definition: dt.h:970
static PSIn New(const TStr &Str)
Definition: dt.h:708
static int GetNum(const char &Ch)
Definition: dt.h:976
Definition: fl.h:482
bool TStr::IsInt ( int &  Val) const
inline

Definition at line 576 of file dt.h.

576 {return IsInt(false, 0, 0, Val);}
bool IsInt() const
Definition: dt.h:577
bool TStr::IsInt ( ) const
inline

Definition at line 577 of file dt.h.

577 {int Val; return IsInt(false, 0, 0, Val);}
bool IsInt() const
Definition: dt.h:577
bool TStr::IsInt64 ( const bool &  Check,
const int64 MnVal,
const int64 MxVal,
int64 Val 
) const

Definition at line 1212 of file dt.cpp.

1213  {
1214  // parsing format {ws} [+/-] +{ddd}
1215  int64 _Val=0;
1216  bool Minus=false;
1217  TChRet Ch(TStrIn::New(*this));
1218  while (TCh::IsWs(Ch.GetCh())){}
1219  if (Ch()=='+'){Minus=false; Ch.GetCh();}
1220  if (Ch()=='-'){Minus=true; Ch.GetCh();}
1221  if (!TCh::IsNum(Ch())){return false;}
1222  _Val=TCh::GetNum(Ch());
1223  while (TCh::IsNum(Ch.GetCh())){_Val=10*_Val+TCh::GetNum(Ch());}
1224  if (Minus){_Val=-_Val;}
1225  if (Check&&((_Val<MnVal)||(_Val>MxVal))){return false;}
1226  if (Ch.Eof()){Val=_Val; return true;} else {return false;}
1227 }
static bool IsNum(const char &Ch)
Definition: dt.h:974
static bool IsWs(const char &Ch)
Definition: dt.h:970
static PSIn New(const TStr &Str)
Definition: dt.h:708
static int GetNum(const char &Ch)
Definition: dt.h:976
long long int64
Definition: bd.h:27
Definition: fl.h:482
bool TStr::IsInt64 ( int64 Val) const
inline

Definition at line 592 of file dt.h.

592 {return IsInt64(false, 0, 0, Val);}
bool IsInt64() const
Definition: dt.h:593
bool TStr::IsInt64 ( ) const
inline

Definition at line 593 of file dt.h.

593 {int64 Val; return IsInt64(false, 0, 0, Val);}
bool IsInt64() const
Definition: dt.h:593
long long int64
Definition: bd.h:27
bool TStr::IsLc ( ) const
inline

Definition at line 497 of file dt.h.

497 {return RStr->IsLc();}
bool IsLc() const
Definition: dt.cpp:672
TRStr * RStr
Definition: dt.h:414
bool TStr::IsPrefix ( const char *  Str) const

Definition at line 1081 of file dt.cpp.

1081  {
1082  size_t len = strlen(Str);
1083  size_t thisLen = Len();
1084  if (len > thisLen) {
1085  return false;
1086  } else {
1087  size_t minLen = MIN(len, thisLen);
1088  int cmp = strncmp(Str, RStr->Bf, minLen);
1089  return cmp == 0;
1090  }
1091 }
TRStr * RStr
Definition: dt.h:414
int Len() const
Definition: dt.h:487
char * Bf
Definition: dt.h:348
#define MIN(a, b)
Definition: bd.h:346
bool TStr::IsPrefix ( const TStr Str) const
inline

Definition at line 556 of file dt.h.

556  {
557  return IsPrefix(Str.CStr());}
bool IsPrefix(const char *Str) const
Definition: dt.cpp:1081
char * CStr()
Definition: dt.h:476
bool TStr::IsStrIn ( const TStr Str) const
inline

Definition at line 554 of file dt.h.

554 {return SearchStr(Str)!=-1;}
int SearchStr(const TStr &Str, const int &BChN=0) const
Definition: dt.cpp:1065
bool TStr::IsSuffix ( const char *  Str) const

Definition at line 1093 of file dt.cpp.

1093  {
1094  size_t len = strlen(Str);
1095  size_t thisLen = Len();
1096  if (len > thisLen) {
1097  // too long to be a suffix anyway
1098  return false;
1099  } else {
1100  // move to the point in the buffer where we would expect the suffix to be
1101  const char *ending = RStr->Bf + thisLen - len;
1102  int cmp = strncmp(Str, ending, len);
1103  return cmp == 0;
1104  }
1105 }
TRStr * RStr
Definition: dt.h:414
int Len() const
Definition: dt.h:487
char * Bf
Definition: dt.h:348
bool TStr::IsSuffix ( const TStr Str) const
inline

Definition at line 559 of file dt.h.

559  {
560  return IsSuffix(Str.CStr());}
bool IsSuffix(const char *Str) const
Definition: dt.cpp:1093
char * CStr()
Definition: dt.h:476
bool TStr::IsUc ( ) const
inline

Definition at line 491 of file dt.h.

491 {return RStr->IsUc();}
TRStr * RStr
Definition: dt.h:414
bool IsUc() const
Definition: dt.cpp:660
bool TStr::IsUInt ( const bool &  Check,
const uint MnVal,
const uint MxVal,
uint Val 
) const

Definition at line 1176 of file dt.cpp.

1177  {
1178  // parsing format {ws} [+]{ddd}
1179  uint _Val=0;
1180  TChRet Ch(TStrIn::New(*this));
1181  while (TCh::IsWs(Ch.GetCh())){}
1182  if (Ch()=='+'){Ch.GetCh();}
1183  if (!TCh::IsNum(Ch())){return false;}
1184  _Val=TCh::GetNum(Ch());
1185  while (TCh::IsNum(Ch.GetCh())){_Val=10*_Val+TCh::GetNum(Ch());}
1186  if (Check&&((_Val<MnVal)||(_Val>MxVal))){return false;}
1187  if (Ch.Eof()){Val=_Val; return true;} else {return false;}
1188 }
static bool IsNum(const char &Ch)
Definition: dt.h:974
unsigned int uint
Definition: bd.h:11
static bool IsWs(const char &Ch)
Definition: dt.h:970
static PSIn New(const TStr &Str)
Definition: dt.h:708
static int GetNum(const char &Ch)
Definition: dt.h:976
Definition: fl.h:482
bool TStr::IsUInt ( uint Val) const
inline

Definition at line 584 of file dt.h.

584 {return IsUInt(false, 0, 0, Val);}
bool IsUInt() const
Definition: dt.h:585
bool TStr::IsUInt ( ) const
inline

Definition at line 585 of file dt.h.

585 {uint Val; return IsUInt(false, 0, 0, Val);}
bool IsUInt() const
Definition: dt.h:585
unsigned int uint
Definition: bd.h:11
bool TStr::IsUInt64 ( const bool &  Check,
const uint64 MnVal,
const uint64 MxVal,
uint64 Val 
) const

Definition at line 1229 of file dt.cpp.

1230  {
1231  // parsing format {ws} [+]{ddd}
1232  uint64 _Val=0;
1233  TChRet Ch(TStrIn::New(*this));
1234  while (TCh::IsWs(Ch.GetCh())){}
1235  if (Ch()=='+'){Ch.GetCh();}
1236  if (!TCh::IsNum(Ch())){return false;}
1237  _Val=TCh::GetNum(Ch());
1238  while (TCh::IsNum(Ch.GetCh())){_Val=10*_Val+TCh::GetNum(Ch());}
1239  if (Check&&((_Val<MnVal)||(_Val>MxVal))){return false;}
1240  if (Ch.Eof()){Val=_Val; return true;} else {return false;}
1241 }
static bool IsNum(const char &Ch)
Definition: dt.h:974
static bool IsWs(const char &Ch)
Definition: dt.h:970
unsigned long long uint64
Definition: bd.h:38
static PSIn New(const TStr &Str)
Definition: dt.h:708
static int GetNum(const char &Ch)
Definition: dt.h:976
Definition: fl.h:482
bool TStr::IsUInt64 ( uint64 Val) const
inline

Definition at line 601 of file dt.h.

601 {return IsUInt64(false, 0, 0, Val);}
bool IsUInt64() const
Definition: dt.h:602
bool TStr::IsUInt64 ( ) const
inline

Definition at line 602 of file dt.h.

602 {uint64 Val; return IsUInt64(false, 0, 0, Val);}
unsigned long long uint64
Definition: bd.h:38
bool IsUInt64() const
Definition: dt.h:602
bool TStr::IsWcMatch ( const int &  StrBChN,
const TStr WcStr,
const int &  WcStrBChN,
TStrV StarStrV,
const char &  StarCh = '*',
const char &  QuestCh = '?' 
) const

Definition at line 1311 of file dt.cpp.

1313  {
1314  int StrLen=Len(); int WcStrLen=WcStr.Len();
1315  int StrChN=StrBChN; int WcStrChN=WcStrBChN;
1316  while ((StrChN<StrLen)&&(WcStrChN<WcStrLen)){
1317  if ((WcStr[WcStrChN]==QuestCh)||(GetCh(StrChN)==WcStr[WcStrChN])){
1318  StrChN++; WcStrChN++;
1319  } else
1320  if (WcStr[WcStrChN]==StarCh){
1321  TChA StarChA; // string substituted by star character
1322  for (int AfterStrChN=StrChN; AfterStrChN<=StrLen; AfterStrChN++){
1323  if (AfterStrChN>StrChN){
1324  StarChA+=GetCh(AfterStrChN-1);}
1325  if (IsWcMatch(AfterStrChN, WcStr, WcStrChN+1, StarStrV, StarCh, QuestCh)){
1326  StarStrV.Add(StarChA); return true;
1327  }
1328  }
1329  return false;
1330  } else {
1331  return false;
1332  }
1333  }
1334  if (StrChN==StrLen){
1335  for (int AfterWcStrChN=WcStrChN; AfterWcStrChN<WcStrLen; AfterWcStrChN++){
1336  if (WcStr[AfterWcStrChN]!=StarCh){return false;}}
1337  return true;
1338  } else {
1339  return false;
1340  }
1341 }
int Len() const
Definition: dt.h:487
bool IsWcMatch(const int &StrBChN, const TStr &WcStr, const int &WcStrBChN, TStrV &StarStrV, const char &StarCh='*', const char &QuestCh='?') const
Definition: dt.cpp:1311
char GetCh(const int &ChN) const
Definition: dt.h:483
Definition: dt.h:201
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
bool TStr::IsWcMatch ( const TStr WcStr,
TStrV StarStrV,
const char &  StarCh = '*',
const char &  QuestCh = '?' 
) const

Definition at line 1343 of file dt.cpp.

1344  {
1345  bool WcMatch=IsWcMatch(0, WcStr, 0, StarStrV, StarCh, QuestCh);
1346  if (WcMatch){
1347  StarStrV.Reverse();
1348  return true;
1349  } else {
1350  return false;
1351  }
1352 }
bool IsWcMatch(const int &StrBChN, const TStr &WcStr, const int &WcStrBChN, TStrV &StarStrV, const char &StarCh='*', const char &QuestCh='?') const
Definition: dt.cpp:1311
void Reverse()
Reverses the order of the elements in the vector.
Definition: ds.h:1286
bool TStr::IsWcMatch ( const TStr WcStr,
const char &  StarCh,
const char &  QuestCh 
) const

Definition at line 1354 of file dt.cpp.

1355  {
1356  TStrV StarStrV;
1357  return IsWcMatch(0, WcStr, 0, StarStrV, StarCh, QuestCh);
1358 }
bool IsWcMatch(const int &StrBChN, const TStr &WcStr, const int &WcStrBChN, TStrV &StarStrV, const char &StarCh='*', const char &QuestCh='?') const
Definition: dt.cpp:1311
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:429
bool TStr::IsWcMatch ( const TStr WcStr,
const int &  StarStrN,
TStr StarStr 
) const

Definition at line 1360 of file dt.cpp.

1360  {
1361  TStrV StarStrV;
1362  if (IsWcMatch(WcStr, StarStrV)){
1363  if (StarStrV.Len()>StarStrN){
1364  StarStr=StarStrV[StarStrV.Len()-StarStrN-1];
1365  } else {
1366  StarStr="";
1367  }
1368  return true;
1369  } else {
1370  return false;
1371  }
1372 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
bool IsWcMatch(const int &StrBChN, const TStr &WcStr, const int &WcStrBChN, TStrV &StarStrV, const char &StarCh='*', const char &QuestCh='?') const
Definition: dt.cpp:1311
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:429
bool TStr::IsWcMatch ( const TStr WcStr) const

Definition at line 1374 of file dt.cpp.

1374  {
1375  TStrV StarStrV;
1376  return IsWcMatch(0, WcStr, 0, StarStrV);
1377 }
bool IsWcMatch(const int &StrBChN, const TStr &WcStr, const int &WcStrBChN, TStrV &StarStrV, const char &StarCh='*', const char &QuestCh='?') const
Definition: dt.cpp:1311
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:429
bool TStr::IsWord ( const bool &  WsPrefixP = true,
const bool &  FirstUcAllowedP = true 
) const

Definition at line 1292 of file dt.cpp.

1292  {
1293  // parsing format {ws} (A-Z,a-z) *{A-Z,a-z,0-9}
1294  TChRet Ch(TStrIn::New(*this));
1295  if (WsPrefixP){while (TCh::IsWs(Ch.GetCh())){}}
1296  else {Ch.GetCh();}
1297  if (!TCh::IsAlpha(Ch())){return false;}
1298  else if (!FirstUcAllowedP&&(TCh::IsUc(Ch()))){return false;}
1299  while (TCh::IsAlNum(Ch.GetCh())){}
1300  if (!Ch.Eof()){return false;}
1301  return true;
1302 }
static bool IsWs(const char &Ch)
Definition: dt.h:970
static PSIn New(const TStr &Str)
Definition: dt.h:708
static bool IsAlNum(const char &Ch)
Definition: dt.h:975
static bool IsAlpha(const char &Ch)
Definition: dt.h:972
static char IsUc(const char &Ch)
Definition: dt.h:988
Definition: fl.h:482
bool TStr::IsWs ( ) const

Definition at line 1304 of file dt.cpp.

1304  {
1305  // if string is just a bunch of whitespace chars
1306  TChRet Ch(TStrIn::New(*this));
1307  while (TCh::IsWs(Ch.GetCh())){}
1308  return Ch.Eof();
1309 }
static bool IsWs(const char &Ch)
Definition: dt.h:970
static PSIn New(const TStr &Str)
Definition: dt.h:708
Definition: fl.h:482
char TStr::LastCh ( ) const
inline

Definition at line 484 of file dt.h.

484 {return GetCh(Len()-1);}
int Len() const
Definition: dt.h:487
char GetCh(const int &ChN) const
Definition: dt.h:483
TStr TStr::Left ( const int &  EChN) const
inline

Definition at line 544 of file dt.h.

544 { return EChN>0 ? GetSubStr(0, EChN-1) : GetSubStr(0, Len()+EChN-1);}
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
TStr TStr::LeftOf ( const char &  SplitCh) const

Definition at line 873 of file dt.cpp.

873  {
874  int ThisLen=Len(); const char* ThisBf=CStr();
875  int ChN=0;
876  while ((ChN<ThisLen)&&(ThisBf[ChN]!=SplitCh)){ChN++;}
877  return (ChN==ThisLen) ? "" : GetSubStr(0, ChN-1);
878 }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
char * CStr()
Definition: dt.h:476
TStr TStr::LeftOfLast ( const char &  SplitCh) const

Definition at line 880 of file dt.cpp.

880  {
881  const char* ThisBf=CStr();
882  int ChN=Len()-1;
883  while ((ChN>=0)&&(ThisBf[ChN]!=SplitCh)){ChN--;}
884  return (ChN==-1) ? "" : GetSubStr(0, ChN-1);
885 }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
char * CStr()
Definition: dt.h:476
int TStr::Len ( ) const
inline

Definition at line 487 of file dt.h.

487 {return RStr->Len();}
TRStr * RStr
Definition: dt.h:414
int Len() const
Definition: dt.h:384
void TStr::Load ( TSIn SIn,
const bool &  IsSmall = false 
)
inline

Definition at line 438 of file dt.h.

438  {
439  *this=TStr(SIn, IsSmall);}
TStr()
Definition: dt.h:423
static TStr TStr::LoadTxt ( const PSIn SIn)
inlinestatic

Definition at line 666 of file dt.h.

666  {
667  return TStr(SIn);}
TStr()
Definition: dt.h:423
static TStr TStr::LoadTxt ( const TStr FNm)
inlinestatic

Definition at line 668 of file dt.h.

668  {
669  PSIn SIn=TFIn::New(FNm); return LoadTxt(SIn);}
static PSIn New(const TStr &FNm)
Definition: fl.cpp:290
static TStr LoadTxt(const PSIn &SIn)
Definition: dt.h:666
void TStr::LoadXml ( const PXmlTok XmlTok,
const TStr Nm 
)

Definition at line 740 of file dt.cpp.

740  {
741  XLoadHd(Nm);
742  TStr TokStr=XmlTok->GetTokStr(false);
743  operator=(TokStr);
744 }
#define XLoadHd(Nm)
Definition: bd.h:312
TStr & operator=(const TStr &Str)
Definition: dt.h:445
Definition: dt.h:412
TStr TStr::Mid ( const int &  BChN,
const int &  Chs 
) const
inline

Definition at line 539 of file dt.h.

539 { return GetSubStr(BChN, BChN+Chs-1); }
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
TStr TStr::Mid ( const int &  BChN) const
inline

Definition at line 540 of file dt.h.

540 {return GetSubStr(BChN, Len()-1); }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
static TStr TStr::MkClone ( const TStr Str)
inlinestatic

Definition at line 688 of file dt.h.

688 {return TStr(Str.CStr());}
char * CStr()
Definition: dt.h:476
TStr()
Definition: dt.h:423
bool TStr::operator!= ( const char *  CStr) const
inline

Definition at line 467 of file dt.h.

467  {
468  return strcmp(RStr->CStr(), CStr)!=0;}
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
char * CStr()
Definition: dt.h:476
char* TStr::operator() ( )
inline

Definition at line 474 of file dt.h.

474 {return RStr->CStr();}
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
const char* TStr::operator() ( ) const
inline

Definition at line 475 of file dt.h.

475 {return RStr->CStr();}
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
TStr TStr::operator() ( const int &  BChN,
const int &  EChNP1 
) const
inline

Definition at line 547 of file dt.h.

547 {return Slice(BChN, EChNP1);}
TStr Slice(int BChN, int EChNP1) const
Definition: dt.h:546
TStr& TStr::operator+= ( const TStr Str)
inline

Definition at line 453 of file dt.h.

453  {
454  TRStr* NewRStr=new TRStr(RStr->CStr(), Str.RStr->CStr());
455  RStr->UnRef(); RStr=NewRStr; RStr->MkRef();
456  Optimize(); return *this;}
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
void UnRef()
Definition: dt.h:379
void Optimize()
Definition: dt.cpp:729
void MkRef()
Definition: dt.h:378
Definition: dt.h:346
TStr& TStr::operator+= ( const char *  CStr)
inline

Definition at line 457 of file dt.h.

457  {
458  TRStr* NewRStr=new TRStr(RStr->CStr(), CStr);
459  RStr->UnRef(); RStr=NewRStr; RStr->MkRef();
460  Optimize(); return *this;}
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
void UnRef()
Definition: dt.h:379
void Optimize()
Definition: dt.cpp:729
void MkRef()
Definition: dt.h:378
char * CStr()
Definition: dt.h:476
Definition: dt.h:346
bool TStr::operator< ( const TStr Str) const
inline

Definition at line 469 of file dt.h.

469  {
470  return strcmp(RStr->CStr(), Str.RStr->CStr())<0;}
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
TStr& TStr::operator= ( const TStr Str)
inline

Definition at line 445 of file dt.h.

445  {
446  if (this!=&Str){RStr->UnRef(); RStr=Str.RStr; RStr->MkRef();} return *this;}
TRStr * RStr
Definition: dt.h:414
void UnRef()
Definition: dt.h:379
void MkRef()
Definition: dt.h:378
TStr& TStr::operator= ( const TChA ChA)
inline

Definition at line 447 of file dt.h.

447  {
448  RStr->UnRef(); RStr=GetRStr(ChA.CStr()); RStr->MkRef(); return *this;}
TRStr * RStr
Definition: dt.h:414
void UnRef()
Definition: dt.h:379
char * CStr()
Definition: dt.h:255
void MkRef()
Definition: dt.h:378
static TRStr * GetRStr(const char *CStr)
Definition: dt.cpp:719
TStr& TStr::operator= ( const char *  CStr)
inline

Definition at line 449 of file dt.h.

449  {
450  RStr->UnRef(); RStr=GetRStr(CStr); RStr->MkRef(); return *this;}
TRStr * RStr
Definition: dt.h:414
void UnRef()
Definition: dt.h:379
void MkRef()
Definition: dt.h:378
static TRStr * GetRStr(const char *CStr)
Definition: dt.cpp:719
char * CStr()
Definition: dt.h:476
TStr& TStr::operator= ( const char &  Ch)
inline

Definition at line 451 of file dt.h.

451  {
452  RStr->UnRef(); RStr=GetChStr(Ch).RStr; RStr->MkRef(); return *this;}
TRStr * RStr
Definition: dt.h:414
void UnRef()
Definition: dt.h:379
void MkRef()
Definition: dt.h:378
static TStr & GetChStr(const char &Ch)
Definition: dt.cpp:1551
bool TStr::operator== ( const TStr Str) const
inline

Definition at line 461 of file dt.h.

461  {
462  return (RStr==Str.RStr)||(strcmp(RStr->CStr(), Str.RStr->CStr())==0);}
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
bool TStr::operator== ( const char *  CStr) const
inline

Definition at line 463 of file dt.h.

463  {
464  return strcmp(RStr->CStr(), CStr)==0;}
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
char * CStr()
Definition: dt.h:476
char TStr::operator[] ( const int &  ChN) const
inline

Definition at line 471 of file dt.h.

471 {return RStr->GetCh(ChN);}
TRStr * RStr
Definition: dt.h:414
char GetCh(const int &ChN) const
Definition: dt.h:388
void TStr::Optimize ( )
private

Definition at line 729 of file dt.cpp.

729  {
730  char* CStr=RStr->CStr(); int CStrLen=int(strlen(CStr));
731  TRStr* NewRStr;
732  if (CStrLen==0){NewRStr=TRStr::GetNullRStr();}
733  // next lines are not multi-threading safe
734  //else if (CStrLen==1){NewRStr=GetChStr(CStr[0]).RStr;}
735  //else if (CStrLen==2){NewRStr=GetDChStr(CStr[0], CStr[1]).RStr;}
736  else {NewRStr=RStr;}
737  NewRStr->MkRef(); RStr->UnRef(); RStr=NewRStr;
738 }
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
void UnRef()
Definition: dt.h:379
void MkRef()
Definition: dt.h:378
static TRStr * GetNullRStr()
Definition: dt.h:402
char * CStr()
Definition: dt.h:476
Definition: dt.h:346
void TStr::PutCh ( const int &  ChN,
const char &  Ch 
)
inline

Definition at line 479 of file dt.h.

479  {
480  TRStr* NewRStr=new TRStr(RStr->CStr());
481  RStr->UnRef(); RStr=NewRStr; RStr->MkRef();
482  RStr->PutCh(ChN, Ch); Optimize();}
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
void UnRef()
Definition: dt.h:379
void Optimize()
Definition: dt.cpp:729
void MkRef()
Definition: dt.h:378
void PutCh(const int &ChN, const char &Ch)
Definition: dt.h:386
Definition: dt.h:346
TStr TStr::PutFBase ( const TStr FNm,
const TStr FBase 
)
static

Definition at line 1511 of file dt.cpp.

1511  {
1512  return FNm.GetFPath()+FBase;
1513 }
TStr GetFPath() const
Definition: dt.cpp:1389
TStr TStr::PutFBaseIfEmpty ( const TStr FNm,
const TStr FBase 
)
static

Definition at line 1515 of file dt.cpp.

1515  {
1516  if (FNm.GetFBase().Empty()){
1517  return FNm.GetFPath()+FBase;
1518  } else {
1519  return FNm;
1520  }
1521 }
TStr GetFPath() const
Definition: dt.cpp:1389
bool Empty() const
Definition: dt.h:488
TStr GetFBase() const
Definition: dt.cpp:1396
TStr TStr::PutFExt ( const TStr FNm,
const TStr FExt 
)
static

Definition at line 1499 of file dt.cpp.

1499  {
1500  return FNm.GetFPath()+FNm.GetFMid()+FExt;
1501 }
TStr GetFMid() const
Definition: dt.cpp:1403
TStr GetFPath() const
Definition: dt.cpp:1389
TStr TStr::PutFExtIfEmpty ( const TStr FNm,
const TStr FExt 
)
static

Definition at line 1503 of file dt.cpp.

1503  {
1504  if (FNm.GetFExt().Empty()){
1505  return FNm.GetFPath()+FNm.GetFMid()+FExt;
1506  } else {
1507  return FNm;
1508  }
1509 }
TStr GetFMid() const
Definition: dt.cpp:1403
TStr GetFPath() const
Definition: dt.cpp:1389
TStr GetFExt() const
Definition: dt.cpp:1421
bool Empty() const
Definition: dt.h:488
TStr TStr::Reverse ( ) const
inline

Definition at line 566 of file dt.h.

566  {
567  TChA ChA(*this); ChA.Reverse(); return ChA;}
Definition: dt.h:201
TStr TStr::Right ( const int &  BChN) const
inline

Definition at line 545 of file dt.h.

545 {return BChN>=0 ? GetSubStr(BChN, Len()-1) : GetSubStr(Len()+BChN, Len()-1);}
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
TStr TStr::RightOf ( const char &  SplitCh) const

Definition at line 887 of file dt.cpp.

887  {
888  int ThisLen=Len(); const char* ThisBf=CStr();
889  int ChN=0;
890  while ((ChN<ThisLen)&&(ThisBf[ChN]!=SplitCh)){ChN++;}
891  return (ChN==ThisLen) ? "" : GetSubStr(ChN+1, ThisLen-1);
892 }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
char * CStr()
Definition: dt.h:476
TStr TStr::RightOfLast ( const char &  SplitCh) const

Definition at line 894 of file dt.cpp.

894  {
895  int ThisLen=Len(); const char* ThisBf=CStr();
896  int ChN=Len()-1;
897  while ((ChN>=0)&&(ThisBf[ChN]!=SplitCh)){ChN--;}
898  return (ChN==-1) ? "" : GetSubStr(ChN+1, ThisLen-1);
899 }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
char * CStr()
Definition: dt.h:476
void TStr::Save ( TSOut SOut,
const bool &  IsSmall = false 
) const
inline

Definition at line 440 of file dt.h.

440  {
441  RStr->Save(SOut, IsSmall);}
TRStr * RStr
Definition: dt.h:414
void Save(TSOut &SOut, const bool &IsSmall) const
Definition: dt.h:371
void TStr::SaveTxt ( const PSOut SOut) const
inline

Definition at line 670 of file dt.h.

670  {
671  SOut->SaveBf(CStr(), Len());}
int Len() const
Definition: dt.h:487
char * CStr()
Definition: dt.h:476
void TStr::SaveTxt ( const TStr FNm) const
inline

Definition at line 672 of file dt.h.

672  {
673  PSOut SOut=TFOut::New(FNm); SaveTxt(SOut);}
static PSOut New(const TStr &FNm, const bool &Append=false)
Definition: fl.cpp:442
Definition: bd.h:196
void SaveTxt(const PSOut &SOut) const
Definition: dt.h:670
void TStr::SaveXml ( TSOut SOut,
const TStr Nm 
) const

Definition at line 746 of file dt.cpp.

746  {
747  TStr XmlStr=TXmlLx::GetXmlStrFromPlainStr(*this);
748  if (XmlStr.Empty()){XSaveBETag(Nm);}
749  else {XSaveHd(Nm); SOut.PutStr(XmlStr);}
750 }
#define XSaveHd(Nm)
Definition: bd.h:318
#define XSaveBETag(Nm)
Definition: bd.h:324
Definition: dt.h:412
bool Empty() const
Definition: dt.h:488
int PutStr(const char *CStr)
Definition: fl.cpp:117
static TStr GetXmlStrFromPlainStr(const TChA &PlainChA)
Definition: xml.cpp:968
int TStr::SearchCh ( const char &  Ch,
const int &  BChN = 0 
) const

Definition at line 1043 of file dt.cpp.

1043  {
1044  int ThisLen=Len(); const char* ThisBf=CStr();
1045  int ChN=TInt::GetMx(BChN, 0);
1046  while (ChN<ThisLen){
1047  if (ThisBf[ChN]==Ch){return ChN;}
1048  ChN++;
1049  }
1050  return -1;
1051 }
int Len() const
Definition: dt.h:487
static int GetMx(const int &Int1, const int &Int2)
Definition: dt.h:1092
char * CStr()
Definition: dt.h:476
int TStr::SearchChBack ( const char &  Ch,
int  BChN = -1 
) const

Definition at line 1053 of file dt.cpp.

1053  {
1054  const int StrLen=Len();
1055  if (BChN==-1||BChN>=StrLen){BChN=StrLen-1;}
1056  const char* ThisBf=CStr();
1057  const char* Pt=ThisBf + BChN;
1058  while (Pt>=ThisBf) {
1059  if (*Pt==Ch){return (int)(Pt-ThisBf);}
1060  Pt--;
1061  }
1062  return -1;
1063 }
int Len() const
Definition: dt.h:487
char * CStr()
Definition: dt.h:476
int TStr::SearchStr ( const TStr Str,
const int &  BChN = 0 
) const

Definition at line 1065 of file dt.cpp.

1065  {
1066  int NrBChN=TInt::GetMx(BChN, 0);
1067  const char* StrPt=strstr((const char*)CStr()+NrBChN, Str.CStr());
1068  if (StrPt==NULL){return -1;}
1069  else {return int(StrPt-CStr());}
1070 /* // slow implementation
1071  int ThisLen=Len(); int StrLen=Str.Len();
1072  int ChN=TInt::GetMx(BChN, 0);
1073  while (ChN<ThisLen-StrLen+1){
1074  if (strncmp(CStr()+ChN, Str.CStr(), StrLen)==0){
1075  return ChN;}
1076  ChN++;
1077  }
1078  return -1;*/
1079 }
static int GetMx(const int &Int1, const int &Int2)
Definition: dt.h:1092
char * CStr()
Definition: dt.h:476
TStr TStr::Slice ( int  BChN,
int  EChNP1 
) const
inline

Definition at line 546 of file dt.h.

546 { if(BChN<0){BChN=Len()+BChN;} if(EChNP1<=0){EChNP1=Len()+EChNP1;} return GetSubStr(BChN, EChNP1-1); }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
void TStr::SplitOnAllAnyCh ( const TStr SplitChStr,
TStrV StrV,
const bool &  SkipEmpty = true 
) const

Definition at line 944 of file dt.cpp.

945  {
946  // reset string output-vector
947  StrV.Clr();
948  // prepare working-copy of string
949  char* Bf=new char[Len()+1];
950  strcpy(Bf, CStr());
951  char* CurStrBf=Bf; // pointer to current string
952  // prepare pointer to split-char-string
953  const char* SplitChBf=SplitChStr.CStr();
954  forever{
955  char* BfC=CurStrBf; // set the counter for working-string
956  while (*BfC!=0){
957  const char* SplitChBfC=SplitChBf; // set counter for split-char-string
958  while ((*SplitChBfC!=0)&&(*SplitChBfC!=*BfC)){SplitChBfC++;}
959  if (*SplitChBfC!=0){break;} // if split-char found
960  BfC++;
961  }
962  bool IsEnd=(*BfC==0);
963  *BfC=0;
964  if ((BfC>CurStrBf)||(!SkipEmpty)){StrV.Add(TStr(CurStrBf));}
965  if (IsEnd){break;}
966  CurStrBf=BfC+1;
967  }
968  // delete working-copy
969  delete[] Bf;
970 }
int Len() const
Definition: dt.h:487
#define forever
Definition: bd.h:6
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:971
char * CStr()
Definition: dt.h:476
TStr()
Definition: dt.h:423
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TStr::SplitOnAllCh ( const char &  SplitCh,
TStrV StrV,
const bool &  SkipEmpty = true 
) const

Definition at line 926 of file dt.cpp.

927  {
928  StrV.Clr();
929  char* Bf=new char[Len()+1];
930  strcpy(Bf, CStr());
931  char* CurStrBf=Bf;
932  forever{
933  char* BfC=CurStrBf;
934  while ((*BfC!=0)&&(*BfC!=SplitCh)){BfC++;}
935  bool IsEnd=(*BfC=='\0');
936  *BfC=0;
937  if ((BfC>CurStrBf)||(!SkipEmpty)){StrV.Add(TStr(CurStrBf));}
938  if (IsEnd){break;}
939  CurStrBf=BfC+1;
940  }
941  delete[] Bf;
942 }
int Len() const
Definition: dt.h:487
#define forever
Definition: bd.h:6
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:971
char * CStr()
Definition: dt.h:476
TStr()
Definition: dt.h:423
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TStr::SplitOnCh ( TStr LStr,
const char &  SplitCh,
TStr RStr 
) const

Definition at line 901 of file dt.cpp.

901  {
902  int ThisLen=Len(); const char* ThisBf=CStr();
903  int ChN=0;
904  while ((ChN<ThisLen)&&(ThisBf[ChN]!=SplitCh)){ChN++;}
905  if (ChN==ThisLen){
906  LStr=GetSubStr(0, ThisLen-1); RStr="";
907  } else {
908  LStr=GetSubStr(0, ChN-1); RStr=GetSubStr(ChN+1, ThisLen-1);
909  }
910 }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
char * CStr()
Definition: dt.h:476
void TStr::SplitOnLastCh ( TStr LStr,
const char &  SplitCh,
TStr RStr 
) const

Definition at line 912 of file dt.cpp.

912  {
913  int ThisLen=Len(); const char* ThisBf=CStr();
914  int ChN=Len()-1;
915  while ((ChN>=0)&&(ThisBf[ChN]!=SplitCh)){ChN--;}
916  if (ChN==-1){
917  LStr=""; RStr=*this;
918  } else
919  if (ChN==0){
920  LStr=""; RStr=GetSubStr(1, ThisLen-1);
921  } else {
922  LStr=GetSubStr(0, ChN-1); RStr=GetSubStr(ChN+1, ThisLen-1);
923  }
924 }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
char * CStr()
Definition: dt.h:476
void TStr::SplitOnNonAlNum ( TStrV StrV) const

Definition at line 990 of file dt.cpp.

990  {
991  StrV.Clr();
992  char* Bf=new char[Len()+1];
993  strcpy(Bf, CStr());
994  char* StrBf=Bf;
995  forever{
996  while ((*StrBf!=0)&&(!TCh::IsAlNum(*StrBf))){StrBf++;}
997  char* BfC=StrBf;
998  while ((*BfC!=0)&&(TCh::IsAlNum(*BfC))){BfC++;}
999  bool IsEnd=(*BfC=='\0');
1000  *BfC=0;
1001  if (BfC>StrBf){StrV.Add(TStr(StrBf));}
1002  if (IsEnd){break;}
1003  StrBf=BfC+1;
1004  }
1005  delete[] Bf;
1006 }
int Len() const
Definition: dt.h:487
#define forever
Definition: bd.h:6
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:971
static bool IsAlNum(const char &Ch)
Definition: dt.h:975
char * CStr()
Definition: dt.h:476
TStr()
Definition: dt.h:423
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TStr::SplitOnStr ( const TStr SplitStr,
TStrV StrV 
) const

Definition at line 1008 of file dt.cpp.

1008  {
1009  StrV.Clr();
1010  int SplitStrLen=SplitStr.Len();
1011  int PrevChN=0; int ChN=0;
1012  while ((ChN=SearchStr(SplitStr, ChN))!=-1){
1013  // extract & add string
1014  TStr SubStr=GetSubStr(PrevChN, ChN-1);
1015  StrV.Add(SubStr);
1016  PrevChN=ChN=ChN+SplitStrLen;
1017  }
1018  // add last string
1019  TStr LastSubStr=GetSubStr(PrevChN, Len()-1);
1020  StrV.Add(LastSubStr);
1021 }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:971
int SearchStr(const TStr &Str, const int &BChN=0) const
Definition: dt.cpp:1065
Definition: dt.h:412
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void TStr::SplitOnStr ( TStr LeftStr,
const TStr MidStr,
TStr RightStr 
) const

Definition at line 1023 of file dt.cpp.

1023  {
1024  const int ChN=SearchStr(MidStr);
1025  if (ChN==-1){
1026  LeftStr=*this; RightStr=GetNullStr();
1027  } else {
1028  LeftStr=GetSubStr(0, ChN-1);
1029  RightStr=GetSubStr(ChN+MidStr.Len(), Len()-1);
1030  }
1031 }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
int SearchStr(const TStr &Str, const int &BChN=0) const
Definition: dt.cpp:1065
static TStr GetNullStr()
Definition: dt.cpp:1626
void TStr::SplitOnWs ( TStrV StrV) const

Definition at line 972 of file dt.cpp.

972  {
973  StrV.Clr();
974  char* Bf=new char[Len()+1];
975  strcpy(Bf, CStr());
976  char* StrBf=Bf;
977  forever{
978  while ((*StrBf!=0)&&(TCh::IsWs(*StrBf))){StrBf++;}
979  char* BfC=StrBf;
980  while ((*BfC!=0)&&(!TCh::IsWs(*BfC))){BfC++;}
981  bool IsEnd=(*BfC=='\0');
982  *BfC=0;
983  if (BfC>StrBf){StrV.Add(TStr(StrBf));}
984  if (IsEnd){break;}
985  StrBf=BfC+1;
986  }
987  delete[] Bf;
988 }
int Len() const
Definition: dt.h:487
#define forever
Definition: bd.h:6
static bool IsWs(const char &Ch)
Definition: dt.h:970
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:971
char * CStr()
Definition: dt.h:476
TStr()
Definition: dt.h:423
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
TStr & TStr::ToCap ( )

Definition at line 764 of file dt.cpp.

764  {
765  TRStr* NewRStr=new TRStr(RStr->CStr()); NewRStr->ToCap();
766  RStr->UnRef(); RStr=NewRStr; RStr->MkRef();
767  Optimize(); return *this;
768 }
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
void ToCap()
Definition: dt.cpp:685
void UnRef()
Definition: dt.h:379
void Optimize()
Definition: dt.cpp:729
void MkRef()
Definition: dt.h:378
Definition: dt.h:346
TStr & TStr::ToHex ( )

Definition at line 785 of file dt.cpp.

785  {
786  TChA ChA;
787  int StrLen=Len();
788  for (int ChN=0; ChN<StrLen; ChN++){
789  uchar Ch=uchar(RStr->Bf[ChN]);
790  char MshCh=TCh::GetHexCh((Ch/16)%16);
791  char LshCh=TCh::GetHexCh(Ch%16);
792  ChA+=MshCh; ChA+=LshCh;
793  }
794  *this=ChA;
795  return *this;
796 }
TRStr * RStr
Definition: dt.h:414
int Len() const
Definition: dt.h:487
static char GetHexCh(const int &Val)
Definition: dt.h:984
char * Bf
Definition: dt.h:348
unsigned char uchar
Definition: bd.h:10
Definition: dt.h:201
TStr & TStr::ToLc ( )

Definition at line 758 of file dt.cpp.

758  {
759  TRStr* NewRStr=new TRStr(RStr->CStr()); NewRStr->ToLc();
760  RStr->UnRef(); RStr=NewRStr; RStr->MkRef();
761  Optimize(); return *this;
762 }
TRStr * RStr
Definition: dt.h:414
void ToLc()
Definition: dt.cpp:679
const char * CStr() const
Definition: dt.h:381
void UnRef()
Definition: dt.h:379
void Optimize()
Definition: dt.cpp:729
void MkRef()
Definition: dt.h:378
Definition: dt.h:346
TStr & TStr::ToTrunc ( )

Definition at line 770 of file dt.cpp.

770  {
771  int ThisLen=Len(); char* ThisBf=CStr();
772  int BChN=0; int EChN=ThisLen-1;
773  while ((BChN<ThisLen)&&TCh::IsWs(ThisBf[BChN])){BChN++;}
774  while ((EChN>=0)&&TCh::IsWs(ThisBf[EChN])){EChN--;}
775  *this=GetSubStr(BChN, EChN);
776  return *this;
777 }
int Len() const
Definition: dt.h:487
TStr GetSubStr(const int &BChN, const int &EChN) const
Definition: dt.cpp:811
static bool IsWs(const char &Ch)
Definition: dt.h:970
char * CStr()
Definition: dt.h:476
TStr & TStr::ToUc ( )

Definition at line 752 of file dt.cpp.

752  {
753  TRStr* NewRStr=new TRStr(RStr->CStr()); NewRStr->ToUc();
754  RStr->UnRef(); RStr=NewRStr; RStr->MkRef();
755  Optimize(); return *this;
756 }
TRStr * RStr
Definition: dt.h:414
const char * CStr() const
Definition: dt.h:381
void UnRef()
Definition: dt.h:379
void Optimize()
Definition: dt.cpp:729
void MkRef()
Definition: dt.h:378
void ToUc()
Definition: dt.cpp:667
Definition: dt.h:346

Friends And Related Function Documentation

TStr operator+ ( const TStr LStr,
const TStr RStr 
)
friend

Definition at line 1631 of file dt.cpp.

1631  {
1632  if (LStr.Empty()){return RStr;}
1633  else if (RStr.Empty()){return LStr;}
1634  else {return TStr(LStr)+=RStr;}
1635 }
TRStr * RStr
Definition: dt.h:414
bool Empty() const
Definition: dt.h:488
TStr()
Definition: dt.h:423
TStr operator+ ( const TStr LStr,
const char *  RCStr 
)
friend

Definition at line 1637 of file dt.cpp.

1637  {
1638  return TStr(LStr)+=RCStr;
1639 }
TStr()
Definition: dt.h:423

Member Data Documentation

TRStr* TStr::RStr
private

Definition at line 414 of file dt.h.


The documentation for this class was generated from the following files: