SNAP Library 6.0, Developer Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
TChA Class Reference

#include <dt.h>

Public Member Functions

 TChA (const int &_MxBfL=256)
 
 TChA (const char *CStr)
 
 TChA (const char *CStr, const int &StrLen)
 
 TChA (const TChA &ChA)
 
 TChA (const TStr &Str)
 
 TChA (const TMem &Mem)
 
 ~TChA ()
 
 TChA (TSIn &SIn)
 
void Load (TSIn &SIn)
 
void Save (TSOut &SOut, const bool &SaveCompact=true) const
 
void LoadXml (const PXmlTok &XmlTok, const TStr &Nm)
 
void SaveXml (TSOut &SOut, const TStr &Nm) const
 
TChAoperator= (const TChA &ChA)
 
TChAoperator= (const TStr &Str)
 
TChAoperator= (const char *CStr)
 
bool operator== (const TChA &ChA) const
 
bool operator== (const char *_CStr) const
 
bool operator== (const char &Ch) const
 
bool operator!= (const TChA &ChA) const
 
bool operator!= (const char *_CStr) const
 
bool operator!= (const char &Ch) const
 
bool operator< (const TChA &ChA) const
 
TChAoperator+= (const TMem &Mem)
 
TChAoperator+= (const TChA &ChA)
 
TChAoperator+= (const TStr &Str)
 
TChAoperator+= (const char *CStr)
 
TChAoperator+= (const char &Ch)
 
char operator[] (const int &ChN) const
 
char & operator[] (const int &ChN)
 
int GetMemUsed () const
 
char * operator() ()
 
const char * operator() () const
 
char * CStr ()
 
const char * CStr () const
 
void Clr ()
 
int Len () const
 
bool Empty () const
 
void Ins (const int &BChN, const char *CStr)
 
void Del (const int &ChN)
 
void DelLastCh ()
 
void Push (const char &Ch)
 
char Pop ()
 
void Trunc ()
 
void Trunc (const int &_BfL)
 
void Reverse ()
 
void AddCh (const char &Ch, const int &MxLen=-1)
 
void AddChTo (const char &Ch, const int &ToChN)
 
void AddBf (char *NewBf, const int &BfS)
 
void PutCh (const int &ChN, const char &Ch)
 
char GetCh (const int &ChN) const
 
char LastCh () const
 
char LastLastCh () const
 
TChA GetSubStr (const int &BChN, const int &EChN) 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 TChA &Str, const int &BChN=0) const
 
int SearchStr (const TStr &Str, const int &BChN=0) const
 
int SearchStr (const char *CStr, const int &BChN=0) const
 
bool IsStrIn (const TStr &Str) const
 
bool IsPrefix (const char *CStr, const int &BChN=0) const
 
bool IsPrefix (const TStr &Str) const
 
bool IsPrefix (const TChA &Str) const
 
bool IsSuffix (const char *CStr) const
 
bool IsSuffix (const TStr &Str) const
 
bool IsSuffix (const TChA &Str) const
 
bool IsChIn (const char &Ch) const
 
void ChangeCh (const char &SrcCh, const char &DstCh)
 
TChAToUc ()
 
TChAToLc ()
 
TChAToTrunc ()
 
void CompressWs ()
 
void Swap (const int &ChN1, const int &ChN2)
 
void Swap (TChA &ChA)
 
int GetPrimHashCd () const
 
int GetSecHashCd () const
 
void SaveTxt (const PSOut &SOut) const
 

Static Public Member Functions

static void LoadTxt (const PSIn &SIn, TChA &ChA)
 

Private Member Functions

void Resize (const int &_MxBfL)
 

Private Attributes

int MxBfL
 
int BfL
 
char * Bf
 

Detailed Description

Definition at line 201 of file dt.h.

Constructor & Destructor Documentation

TChA::TChA ( const int &  _MxBfL = 256)
inlineexplicit

Definition at line 207 of file dt.h.

Referenced by GetSubStr().

207  {
208  Bf=new char[(MxBfL=_MxBfL)+1]; Bf[BfL=0]=0;}
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
int BfL
Definition: dt.h:203

Here is the caller graph for this function:

TChA::TChA ( const char *  CStr)
inline

Definition at line 209 of file dt.h.

209  {
210  Bf=new char[(MxBfL=BfL=int(strlen(CStr)))+1]; strcpy(Bf, CStr);}
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
char * CStr()
Definition: dt.h:255
int BfL
Definition: dt.h:203
TChA::TChA ( const char *  CStr,
const int &  StrLen 
)
inline

Definition at line 211 of file dt.h.

211  : MxBfL(StrLen), BfL(StrLen) {
212  Bf=new char[StrLen+1]; strncpy(Bf, CStr, StrLen); Bf[StrLen]=0;}
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
char * CStr()
Definition: dt.h:255
int BfL
Definition: dt.h:203
TChA::TChA ( const TChA ChA)
inline

Definition at line 213 of file dt.h.

References BfL, CStr(), and MxBfL.

213  {
214  Bf=new char[(MxBfL=ChA.MxBfL)+1]; BfL=ChA.BfL; strcpy(Bf, ChA.CStr());}
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
char * CStr()
Definition: dt.h:255
int BfL
Definition: dt.h:203

Here is the call graph for this function:

TChA::TChA ( const TStr Str)

Definition at line 356 of file dt.cpp.

References Bf, BfL, TStr::CStr(), TStr::Len(), and MxBfL.

356  {
357  Bf=new char[(MxBfL=BfL=Str.Len())+1];
358  strcpy(Bf, Str.CStr());
359 }
int Len() const
Definition: dt.h:490
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
int BfL
Definition: dt.h:203
char * CStr()
Definition: dt.h:479

Here is the call graph for this function:

TChA::TChA ( const TMem Mem)
inline

Definition at line 216 of file dt.h.

References CStr(), TMem::Len(), and MxBfL.

216  {
217  Bf=new char[(MxBfL=BfL=Mem.Len())+1]; Bf[MxBfL]=0;
218  memcpy(CStr(), Mem(), Mem.Len());}
int Len() const
Definition: dt.h:134
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
char * CStr()
Definition: dt.h:255
int BfL
Definition: dt.h:203

Here is the call graph for this function:

TChA::~TChA ( )
inline

Definition at line 219 of file dt.h.

References Bf.

219 {delete[] Bf;}
char * Bf
Definition: dt.h:204
TChA::TChA ( TSIn SIn)
inlineexplicit

Definition at line 220 of file dt.h.

References TSIn::Load().

220  {
221  SIn.Load(MxBfL); SIn.Load(BfL); SIn.Load(Bf, MxBfL, BfL);}
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
void Load(bool &Bool)
Definition: fl.h:84
int BfL
Definition: dt.h:203

Here is the call graph for this function:

Member Function Documentation

void TChA::AddBf ( char *  NewBf,
const int &  BfS 
)
inline

Definition at line 275 of file dt.h.

References BfL, and Resize().

Referenced by TZipIn::GetNextLnBf(), and TFIn::GetNextLnBf().

275  {
276  if ((BfL+BfS+1)>MxBfL){Resize(BfL+BfS+1);}
277  strncpy(Bf+BfL,NewBf,BfS); BfL+=BfS; Bf[BfL]=0;}
void Resize(const int &_MxBfL)
Definition: dt.cpp:348
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
int BfL
Definition: dt.h:203

Here is the call graph for this function:

Here is the caller graph for this function:

void TChA::AddCh ( const char &  Ch,
const int &  MxLen = -1 
)
inline
void TChA::AddChTo ( const char &  Ch,
const int &  ToChN 
)
inline

Definition at line 273 of file dt.h.

References AddCh(), and Len().

273  {
274  while (Len()<ToChN){AddCh(Ch);}}
void AddCh(const char &Ch, const int &MxLen=-1)
Definition: dt.h:271
int Len() const
Definition: dt.h:259

Here is the call graph for this function:

void TChA::ChangeCh ( const char &  SrcCh,
const char &  DstCh 
)

Definition at line 537 of file dt.cpp.

References Bf, and Len().

Referenced by TMem::GetAsStr().

537  {
538  int StrLen=Len();
539  for (int ChN=0; ChN<StrLen; ChN++){if (Bf[ChN]==SrcCh){Bf[ChN]=DstCh;}}
540 }
int Len() const
Definition: dt.h:259
char * Bf
Definition: dt.h:204

Here is the call graph for this function:

Here is the caller graph for this function:

void TChA::CompressWs ( )

Definition at line 581 of file dt.cpp.

References GetCh(), TCh::IsWs(), Len(), PutCh(), and Trunc().

581  {
582  int StrLen=Len(); int SrcChN=0; int DstChN=0;
583  while ((SrcChN<StrLen)&&TCh::IsWs(GetCh(SrcChN))){SrcChN++;}
584  while (SrcChN<StrLen){
585  if ((TCh::IsWs(GetCh(SrcChN)))&&(DstChN>0)&&(TCh::IsWs(GetCh(DstChN-1)))){
586  SrcChN++;
587  } else {
588  PutCh(DstChN, GetCh(SrcChN)); SrcChN++; DstChN++;
589  }
590  }
591  if ((DstChN>0)&&(TCh::IsWs(GetCh(DstChN-1)))){DstChN--;}
592  Trunc(DstChN);
593 }
void PutCh(const int &ChN, const char &Ch)
Definition: dt.h:278
int Len() const
Definition: dt.h:259
static bool IsWs(const char &Ch)
Definition: dt.h:1063
char GetCh(const int &ChN) const
Definition: dt.h:280
void Trunc()
Definition: dt.cpp:420

Here is the call graph for this function:

int TChA::CountCh ( const char &  Ch,
const int &  BChN = 0 
) const

Definition at line 462 of file dt.cpp.

References Bf, TInt::GetMx(), and Len().

462  {
463  int ChN=TInt::GetMx(BChN, 0);
464  const int ThisLen=Len();
465  int Cnt = 0;
466  while (ChN<ThisLen){if (Bf[ChN]==Ch){ Cnt++;} ChN++;}
467  return Cnt;
468 }
static int GetMx(const int &Int1, const int &Int2)
Definition: dt.h:1185
int Len() const
Definition: dt.h:259
char * Bf
Definition: dt.h:204

Here is the call graph for this function:

const char* TChA::CStr ( ) const
inline

Definition at line 256 of file dt.h.

References Bf.

256 {return Bf;}
char * Bf
Definition: dt.h:204
void TChA::Del ( const int &  ChN)

Definition at line 414 of file dt.cpp.

References Assert, Bf, and BfL.

Referenced by TStr::DelChAll().

414  {
415  Assert((0<=ChN)&&(ChN<BfL));
416  memmove(Bf+ChN, Bf+ChN+1, BfL-ChN);
417  BfL--;
418 }
char * Bf
Definition: dt.h:204
#define Assert(Cond)
Definition: bd.h:251
int BfL
Definition: dt.h:203

Here is the caller graph for this function:

void TChA::DelLastCh ( )
inline

Definition at line 263 of file dt.h.

References Pop().

Referenced by TSsParserMP::GetLnStr(), and TSsParser::GetLnStr().

263 {Pop();}
char Pop()
Definition: dt.h:265

Here is the call graph for this function:

Here is the caller graph for this function:

char TChA::GetCh ( const int &  ChN) const
inline

Definition at line 280 of file dt.h.

References operator[]().

Referenced by CompressWs(), SearchChBack(), Swap(), ToTrunc(), and Trunc().

280 {return operator[](ChN);}
char operator[](const int &ChN) const
Definition: dt.h:247

Here is the call graph for this function:

Here is the caller graph for this function:

int TChA::GetMemUsed ( ) const
inline

Definition at line 251 of file dt.h.

251 {return int(2*sizeof(int)+sizeof(char*)+sizeof(char)*MxBfL);}
int MxBfL
Definition: dt.h:203
int TChA::GetPrimHashCd ( ) const

Definition at line 607 of file dt.cpp.

References CStr(), and TStrHashF_DJB::GetPrimHashCd().

607  {
609 }
char * CStr()
Definition: dt.h:255
static int GetPrimHashCd(const char *p)
Definition: hash.h:1253

Here is the call graph for this function:

int TChA::GetSecHashCd ( ) const

Definition at line 611 of file dt.cpp.

References CStr(), and TStrHashF_DJB::GetSecHashCd().

611  {
613 }
static int GetSecHashCd(const char *p)
Definition: hash.h:1256
char * CStr()
Definition: dt.h:255

Here is the call graph for this function:

TChA TChA::GetSubStr ( const int &  BChN,
const int &  EChN 
) const

Definition at line 448 of file dt.cpp.

References CStr(), TInt::GetMn(), TInt::GetMx(), TStr::GetNullStr(), Len(), and TChA().

Referenced by TStrUtil::GetDomNm(), TStrUtil::GetDomNm2(), TStrUtil::GetNormalizedUrl(), TStrUtil::GetShorStr(), TStrUtil::GetWebsiteNm(), and TStrUtil::StripEnd().

448  {
449  int BChN=TInt::GetMx(_BChN, 0);
450  int EChN=TInt::GetMn(_EChN, Len()-1);
451  int Chs=EChN-BChN+1;
452  if (Chs<=0){return TStr::GetNullStr();}
453  else if (Chs==Len()){return *this;}
454  else {
455  //char* Bf=new char[Chs+1]; strncpy(Bf, CStr()+BChN, Chs); Bf[Chs]=0;
456  //TStr Str(Bf); delete[] Bf;
457  //return Str;
458  return TChA(CStr()+BChN, Chs);
459  }
460 }
static int GetMx(const int &Int1, const int &Int2)
Definition: dt.h:1185
int Len() const
Definition: dt.h:259
static int GetMn(const int &Int1, const int &Int2)
Definition: dt.h:1183
char * CStr()
Definition: dt.h:255
TChA(const int &_MxBfL=256)
Definition: dt.h:207
static TStr GetNullStr()
Definition: dt.cpp:1626

Here is the call graph for this function:

Here is the caller graph for this function:

void TChA::Ins ( const int &  BChN,
const char *  CStr 
)

Definition at line 407 of file dt.cpp.

References Assert, Bf, BfL, and Resize().

Referenced by TTm::GetTmFromIdStr().

407  {
408  Assert((0<=BChN)&&(BChN<=BfL)); //** ali je <= v (BChN<=BfL) upravicen?
409  int CStrLen=int(strlen(CStr)); Resize(BfL+CStrLen);
410  memmove(Bf+BChN+CStrLen, Bf+BChN, BfL-BChN+1);
411  memmove(Bf+BChN, CStr, CStrLen); BfL+=CStrLen;
412 }
void Resize(const int &_MxBfL)
Definition: dt.cpp:348
char * Bf
Definition: dt.h:204
char * CStr()
Definition: dt.h:255
#define Assert(Cond)
Definition: bd.h:251
int BfL
Definition: dt.h:203

Here is the call graph for this function:

Here is the caller graph for this function:

bool TChA::IsChIn ( const char &  Ch) const
inline

Definition at line 300 of file dt.h.

References SearchCh().

300 {return SearchCh(Ch)!=-1;}
int SearchCh(const char &Ch, const int &BChN=0) const
Definition: dt.cpp:470

Here is the call graph for this function:

bool TChA::IsPrefix ( const char *  CStr,
const int &  BChN = 0 
) const

Definition at line 499 of file dt.cpp.

References Bf, CStr(), and Len().

Referenced by TStrUtil::GetDomNm(), TStrUtil::GetDomNm2(), TStrUtil::GetNormalizedUrl(), TStrUtil::GetWebsiteNm(), and IsPrefix().

499  {
500  if (BChN+(int)strlen(CStr)>Len()){return false;}
501  const char* B = Bf+BChN;
502  const char* C = CStr;
503  while (*C!=0 && *B==*C) {
504  B++; C++;
505  }
506  if (*C==0){return true;}
507  else {return false;}
508 }
int Len() const
Definition: dt.h:259
char * Bf
Definition: dt.h:204
char * CStr()
Definition: dt.h:255

Here is the call graph for this function:

Here is the caller graph for this function:

bool TChA::IsPrefix ( const TStr Str) const

Definition at line 510 of file dt.cpp.

References TStr::CStr(), and IsPrefix().

510  {
511  return IsPrefix(Str.CStr());
512 }
bool IsPrefix(const char *CStr, const int &BChN=0) const
Definition: dt.cpp:499
char * CStr()
Definition: dt.h:479

Here is the call graph for this function:

bool TChA::IsPrefix ( const TChA Str) const

Definition at line 514 of file dt.cpp.

References CStr(), and IsPrefix().

514  {
515  return IsPrefix(Str.CStr());
516 }
char * CStr()
Definition: dt.h:255
bool IsPrefix(const char *CStr, const int &BChN=0) const
Definition: dt.cpp:499

Here is the call graph for this function:

bool TChA::IsStrIn ( const TStr Str) const
inline

Definition at line 292 of file dt.h.

References SearchStr().

292 {return SearchStr(Str)!=-1;}
int SearchStr(const TChA &Str, const int &BChN=0) const
Definition: dt.cpp:485

Here is the call graph for this function:

bool TChA::IsSuffix ( const char *  CStr) const

Definition at line 518 of file dt.cpp.

References Bf, and Len().

Referenced by TStrUtil::GetWebsiteNm(), and IsSuffix().

518  {
519  if ((int)strlen(CStr) > Len()) { return false; }
520  const char* E = Bf+Len()-1;
521  const char* C = CStr+strlen(CStr)-1;
522  while (C >= CStr && *E==*C) {
523  E--; C--;
524  }
525  if (C+1 == CStr) { return true; }
526  else { return false; }
527 }
int Len() const
Definition: dt.h:259
char * Bf
Definition: dt.h:204
char * CStr()
Definition: dt.h:255

Here is the call graph for this function:

Here is the caller graph for this function:

bool TChA::IsSuffix ( const TStr Str) const

Definition at line 529 of file dt.cpp.

References TStr::CStr(), and IsSuffix().

529  {
530  return IsSuffix(Str.CStr());
531 }
bool IsSuffix(const char *CStr) const
Definition: dt.cpp:518
char * CStr()
Definition: dt.h:479

Here is the call graph for this function:

bool TChA::IsSuffix ( const TChA Str) const

Definition at line 533 of file dt.cpp.

References CStr(), and IsSuffix().

533  {
534  return IsSuffix(Str.CStr());
535 }
char * CStr()
Definition: dt.h:255
bool IsSuffix(const char *CStr) const
Definition: dt.cpp:518

Here is the call graph for this function:

char TChA::LastCh ( ) const
inline

Definition at line 281 of file dt.h.

References Assert.

Referenced by TXmlLx::GetCDSect(), TUStr::GetChTypeStr(), THtmlLx::GetSym(), TXmlLx::GetSym(), TXmlObjSer::GetTagNm(), THtmlDoc::GetTxtLnDoc(), TSs::LoadTxtFldV(), and TXmlLx::ToNrSpacing().

281 { Assert(1<=BfL); return Bf[BfL-1]; }
char * Bf
Definition: dt.h:204
#define Assert(Cond)
Definition: bd.h:251
int BfL
Definition: dt.h:203

Here is the caller graph for this function:

char TChA::LastLastCh ( ) const
inline

Definition at line 282 of file dt.h.

References Assert.

Referenced by TXmlLx::GetCDSect(), and TXmlLx::GetSym().

282 { Assert(2<=BfL); return Bf[BfL-2]; }
char * Bf
Definition: dt.h:204
#define Assert(Cond)
Definition: bd.h:251
int BfL
Definition: dt.h:203

Here is the caller graph for this function:

void TChA::Load ( TSIn SIn)
inline

Definition at line 222 of file dt.h.

References Bf, and TSIn::Load().

222  { delete[] Bf;
223  SIn.Load(MxBfL); SIn.Load(BfL); SIn.Load(Bf, MxBfL, BfL);}
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
void Load(bool &Bool)
Definition: fl.h:84
int BfL
Definition: dt.h:203

Here is the call graph for this function:

void TChA::LoadTxt ( const PSIn SIn,
TChA ChA 
)
static

Definition at line 616 of file dt.cpp.

References Bf, BfL, CStr(), TSIn::GetBf(), TSIn::Len(), and MxBfL.

616  {
617  delete[] ChA.Bf;
618  ChA.Bf=new char[(ChA.MxBfL=ChA.BfL=SIn->Len())+1];
619  SIn->GetBf(ChA.CStr(), SIn->Len()); ChA.Bf[ChA.BfL]=0;
620 }
virtual int Len() const =0
virtual int GetBf(const void *Bf, const TSize &BfL)=0
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
char * CStr()
Definition: dt.h:255
int BfL
Definition: dt.h:203

Here is the call graph for this function:

void TChA::LoadXml ( const PXmlTok XmlTok,
const TStr Nm 
)
bool TChA::operator!= ( const TChA ChA) const
inline

Definition at line 235 of file dt.h.

References CStr().

235 {return strcmp(CStr(), ChA.CStr())!=0;}
char * CStr()
Definition: dt.h:255

Here is the call graph for this function:

bool TChA::operator!= ( const char *  _CStr) const
inline

Definition at line 236 of file dt.h.

References CStr().

236 {return strcmp(CStr(), _CStr)!=0;}
char * CStr()
Definition: dt.h:255

Here is the call graph for this function:

bool TChA::operator!= ( const char &  Ch) const
inline

Definition at line 237 of file dt.h.

237 {return !((BfL==1)&&(Bf[0]==Ch));}
char * Bf
Definition: dt.h:204
int BfL
Definition: dt.h:203
char* TChA::operator() ( )
inline

Definition at line 253 of file dt.h.

References Bf.

253 {return Bf;}
char * Bf
Definition: dt.h:204
const char* TChA::operator() ( ) const
inline

Definition at line 254 of file dt.h.

References Bf.

254 {return Bf;}
char * Bf
Definition: dt.h:204
TChA & TChA::operator+= ( const TMem Mem)

Definition at line 387 of file dt.cpp.

References Bf, BfL, TMem::GetBf(), TMem::Len(), and Resize().

Referenced by AddCh(), and Push().

387  {
388  Resize(BfL+Mem.Len());
389  strcpy(Bf+BfL, Mem.GetBf()); BfL+=Mem.Len(); return *this;
390 }
void Resize(const int &_MxBfL)
Definition: dt.cpp:348
int Len() const
Definition: dt.h:134
char * Bf
Definition: dt.h:204
int BfL
Definition: dt.h:203
char * GetBf() const
Definition: dt.h:144

Here is the call graph for this function:

Here is the caller graph for this function:

TChA & TChA::operator+= ( const TChA ChA)

Definition at line 392 of file dt.cpp.

References Bf, BfL, CStr(), Len(), and Resize().

392  {
393  Resize(BfL+ChA.Len());
394  strcpy(Bf+BfL, ChA.CStr()); BfL+=ChA.Len(); return *this;
395 }
void Resize(const int &_MxBfL)
Definition: dt.cpp:348
int Len() const
Definition: dt.h:259
char * Bf
Definition: dt.h:204
char * CStr()
Definition: dt.h:255
int BfL
Definition: dt.h:203

Here is the call graph for this function:

TChA & TChA::operator+= ( const TStr Str)

Definition at line 397 of file dt.cpp.

References Bf, BfL, TStr::CStr(), TStr::Len(), and Resize().

397  {
398  Resize(BfL+Str.Len());
399  strcpy(Bf+BfL, Str.CStr()); BfL+=Str.Len(); return *this;
400 }
int Len() const
Definition: dt.h:490
void Resize(const int &_MxBfL)
Definition: dt.cpp:348
char * Bf
Definition: dt.h:204
int BfL
Definition: dt.h:203
char * CStr()
Definition: dt.h:479

Here is the call graph for this function:

TChA & TChA::operator+= ( const char *  CStr)

Definition at line 402 of file dt.cpp.

References Bf, BfL, and Resize().

402  {
403  int CStrLen=(int)strlen(CStr); Resize(BfL+CStrLen);
404  strcpy(Bf+BfL, CStr); BfL+=CStrLen; return *this;
405 }
void Resize(const int &_MxBfL)
Definition: dt.cpp:348
char * Bf
Definition: dt.h:204
char * CStr()
Definition: dt.h:255
int BfL
Definition: dt.h:203

Here is the call graph for this function:

TChA& TChA::operator+= ( const char &  Ch)
inline

Definition at line 244 of file dt.h.

References BfL, and Resize().

244  {
245  if (BfL==MxBfL){Resize(BfL+1);}
246  Bf[BfL]=Ch; BfL++; Bf[BfL]=0; return *this;}
void Resize(const int &_MxBfL)
Definition: dt.cpp:348
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
int BfL
Definition: dt.h:203

Here is the call graph for this function:

bool TChA::operator< ( const TChA ChA) const
inline

Definition at line 238 of file dt.h.

References CStr().

238 {return strcmp(CStr(), ChA.CStr())<0;}
char * CStr()
Definition: dt.h:255

Here is the call graph for this function:

TChA & TChA::operator= ( const TChA ChA)

Definition at line 366 of file dt.cpp.

References Bf, BfL, CStr(), and MxBfL.

366  {
367  if (this!=&ChA){
368  if (ChA.BfL>MxBfL){delete[] Bf; Bf=new char[(MxBfL=ChA.BfL)+1];}
369  BfL=ChA.BfL; strcpy(Bf, ChA.CStr());
370  }
371  return *this;
372 }
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
char * CStr()
Definition: dt.h:255
int BfL
Definition: dt.h:203

Here is the call graph for this function:

TChA & TChA::operator= ( const TStr Str)

Definition at line 374 of file dt.cpp.

References Bf, BfL, TStr::CStr(), TStr::Len(), and MxBfL.

374  {
375  if (Str.Len()>MxBfL){delete[] Bf; Bf=new char[(MxBfL=Str.Len())+1];}
376  BfL=Str.Len(); strcpy(Bf, Str.CStr());
377  return *this;
378 }
int Len() const
Definition: dt.h:490
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
int BfL
Definition: dt.h:203
char * CStr()
Definition: dt.h:479

Here is the call graph for this function:

TChA & TChA::operator= ( const char *  CStr)

Definition at line 380 of file dt.cpp.

References Bf, BfL, and MxBfL.

380  {
381  int CStrLen=int(strlen(CStr));
382  if (CStrLen>MxBfL){delete[] Bf; Bf=new char[(MxBfL=CStrLen)+1];}
383  BfL=CStrLen; strcpy(Bf, CStr);
384  return *this;
385 }
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
char * CStr()
Definition: dt.h:255
int BfL
Definition: dt.h:203
bool TChA::operator== ( const TChA ChA) const
inline

Definition at line 232 of file dt.h.

References CStr().

232 {return strcmp(CStr(), ChA.CStr())==0;}
char * CStr()
Definition: dt.h:255

Here is the call graph for this function:

bool TChA::operator== ( const char *  _CStr) const
inline

Definition at line 233 of file dt.h.

References CStr().

233 {return strcmp(CStr(), _CStr)==0;}
char * CStr()
Definition: dt.h:255

Here is the call graph for this function:

bool TChA::operator== ( const char &  Ch) const
inline

Definition at line 234 of file dt.h.

234 {return (BfL==1)&&(Bf[0]==Ch);}
char * Bf
Definition: dt.h:204
int BfL
Definition: dt.h:203
char TChA::operator[] ( const int &  ChN) const
inline

Definition at line 247 of file dt.h.

References Assert.

Referenced by GetCh().

247  {
248  Assert((0<=ChN)&&(ChN<BfL)); return Bf[ChN];}
char * Bf
Definition: dt.h:204
#define Assert(Cond)
Definition: bd.h:251
int BfL
Definition: dt.h:203

Here is the caller graph for this function:

char& TChA::operator[] ( const int &  ChN)
inline

Definition at line 249 of file dt.h.

References Assert.

249  {
250  Assert((0<=ChN)&&(ChN<BfL)); return Bf[ChN];}
char * Bf
Definition: dt.h:204
#define Assert(Cond)
Definition: bd.h:251
int BfL
Definition: dt.h:203
char TChA::Pop ( )
inline

Definition at line 265 of file dt.h.

References BfL, and IAssert.

Referenced by THttpResp::AddFldVal(), DelLastCh(), TXmlLx::GetCDSect(), THtmlLx::GetCh(), TXmlLx::GetCh(), THtmlLx::GetFullBTagStr(), THtmlLx::GetSym(), TILx::GetSym(), TXmlObjSer::GetTagNm(), TSs::LoadTxtFldV(), THtmlLx::PutCh(), and TXmlLx::ToNrSpacing().

265 {IAssert(BfL>0); BfL--; char Ch=Bf[BfL]; Bf[BfL]=0; return Ch;}
#define IAssert(Cond)
Definition: bd.h:262
char * Bf
Definition: dt.h:204
int BfL
Definition: dt.h:203

Here is the caller graph for this function:

void TChA::Push ( const char &  Ch)
inline

Definition at line 264 of file dt.h.

References operator+=().

Referenced by TXmlParser::GetSym(), TXmlLx::PutCh(), and THtmlLx::PutCh().

264 {operator+=(Ch);}
TChA & operator+=(const TMem &Mem)
Definition: dt.cpp:387

Here is the call graph for this function:

Here is the caller graph for this function:

void TChA::PutCh ( const int &  ChN,
const char &  Ch 
)
inline

Definition at line 278 of file dt.h.

References Assert.

Referenced by CompressWs(), TStr::GetFNmStr(), THtmlLxChDef::GetLcChA(), TXmlObjSer::GetTagNm(), THtmlLxChDef::GetUcChA(), TXmlLx::GetUsAsciiStrFromXmlStr(), THttpLx::IsRespStatusLn(), TSs::SaveTxt(), Swap(), TXmlLx::ToNrSpacing(), ToTrunc(), and Trunc().

278  {
279  Assert((0<=ChN)&&(ChN<BfL)); Bf[ChN]=Ch;}
char * Bf
Definition: dt.h:204
#define Assert(Cond)
Definition: bd.h:251
int BfL
Definition: dt.h:203

Here is the caller graph for this function:

void TChA::Resize ( const int &  _MxBfL)
private

Definition at line 348 of file dt.cpp.

References Bf, IAssert, and MxBfL.

Referenced by AddBf(), Ins(), and operator+=().

348  {
349  if (_MxBfL<=MxBfL){return;}
350  else {if (MxBfL*2<_MxBfL){MxBfL=_MxBfL;} else {MxBfL*=2;}}
351  char* NewBf=new char[MxBfL+1]; IAssert(NewBf!=NULL);
352  strcpy(NewBf, Bf);
353  delete[] Bf; Bf=NewBf;
354 }
#define IAssert(Cond)
Definition: bd.h:262
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203

Here is the caller graph for this function:

void TChA::Reverse ( )

Definition at line 440 of file dt.cpp.

References Bf, and BfL.

Referenced by TUrl::GetDmNm(), and TStr::Reverse().

440  {
441  for (int ChN=0; ChN<BfL/2; ChN++){
442  char Ch=Bf[ChN];
443  Bf[ChN]=Bf[BfL-ChN-1];
444  Bf[BfL-ChN-1]=Ch;
445  }
446 }
char * Bf
Definition: dt.h:204
int BfL
Definition: dt.h:203

Here is the caller graph for this function:

void TChA::Save ( TSOut SOut,
const bool &  SaveCompact = true 
) const
inline

Definition at line 224 of file dt.h.

References TSOut::Save().

224  { //J:
225  SOut.Save(SaveCompact?BfL:MxBfL); SOut.Save(BfL); SOut.Save(Bf, BfL);}
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
int BfL
Definition: dt.h:203
void Save(const bool &Bool)
Definition: fl.h:173

Here is the call graph for this function:

void TChA::SaveTxt ( const PSOut SOut) const

Definition at line 622 of file dt.cpp.

References CStr(), Len(), and TSOut::SaveBf().

622  {
623  SOut->SaveBf(CStr(), Len());
624 }
int Len() const
Definition: dt.h:259
char * CStr()
Definition: dt.h:255

Here is the call graph for this function:

void TChA::SaveXml ( TSOut SOut,
const TStr Nm 
) const

Definition at line 361 of file dt.cpp.

References BfL, TInt::GetStr(), TXmlLx::GetXmlStrFromPlainStr(), TSOut::PutStr(), and XSaveHdArg.

361  {
362  XSaveHdArg(Nm, "BfL", TInt::GetStr(BfL));
364 }
TStr GetStr() const
Definition: dt.h:1200
#define XSaveHdArg(Nm, ArgNm, ArgVal)
Definition: bd.h:321
int BfL
Definition: dt.h:203
int PutStr(const char *CStr)
Definition: fl.cpp:117
static TStr GetXmlStrFromPlainStr(const TChA &PlainChA)
Definition: xml.cpp:968

Here is the call graph for this function:

int TChA::SearchCh ( const char &  Ch,
const int &  BChN = 0 
) const

Definition at line 470 of file dt.cpp.

References Bf, TInt::GetMx(), and Len().

Referenced by TStr::DelChAll(), TStrUtil::GetDomNm(), TStrUtil::GetWebsiteNm(), and IsChIn().

470  {
471  int ChN=TInt::GetMx(BChN, 0);
472  const int ThisLen=Len();
473  while (ChN<ThisLen){if (Bf[ChN]==Ch){return ChN;} ChN++;}
474  return -1;
475 }
static int GetMx(const int &Int1, const int &Int2)
Definition: dt.h:1185
int Len() const
Definition: dt.h:259
char * Bf
Definition: dt.h:204

Here is the call graph for this function:

Here is the caller graph for this function:

int TChA::SearchChBack ( const char &  Ch,
int  BChN = -1 
) const

Definition at line 477 of file dt.cpp.

References GetCh(), and Len().

Referenced by TStrUtil::GetDomNm().

477  {
478  if (BChN >= Len() || BChN < 0) { BChN = Len()-1; }
479  for (int i = BChN; i >= 0; i--) {
480  if (GetCh(i) == Ch) { return i; }
481  }
482  return -1;
483 }
int Len() const
Definition: dt.h:259
char GetCh(const int &ChN) const
Definition: dt.h:280

Here is the call graph for this function:

Here is the caller graph for this function:

int TChA::SearchStr ( const TChA Str,
const int &  BChN = 0 
) const

Definition at line 485 of file dt.cpp.

References CStr().

Referenced by TStrUtil::GetWebsiteNm(), IsStrIn(), and SearchStr().

485  {
486  return SearchStr(Str.CStr(), BChN);
487 }
int SearchStr(const TChA &Str, const int &BChN=0) const
Definition: dt.cpp:485
char * CStr()
Definition: dt.h:255

Here is the call graph for this function:

Here is the caller graph for this function:

int TChA::SearchStr ( const TStr Str,
const int &  BChN = 0 
) const

Definition at line 489 of file dt.cpp.

References TStr::CStr(), and SearchStr().

489  {
490  return SearchStr(Str.CStr(), BChN);
491 }
int SearchStr(const TChA &Str, const int &BChN=0) const
Definition: dt.cpp:485
char * CStr()
Definition: dt.h:479

Here is the call graph for this function:

int TChA::SearchStr ( const char *  CStr,
const int &  BChN = 0 
) const

Definition at line 493 of file dt.cpp.

References Bf.

493  {
494  const char* BegPos=strstr(Bf+BChN, CStr);
495  if (BegPos==NULL){return -1;}
496  else {return int(BegPos-Bf);}
497 }
char * Bf
Definition: dt.h:204
char * CStr()
Definition: dt.h:255
void TChA::Swap ( const int &  ChN1,
const int &  ChN2 
)

Definition at line 595 of file dt.cpp.

References GetCh(), and PutCh().

Referenced by Swap().

595  {
596  char Ch=GetCh(ChN1);
597  PutCh(ChN1, GetCh(ChN2));
598  PutCh(ChN2, Ch);
599 }
void PutCh(const int &ChN, const char &Ch)
Definition: dt.h:278
char GetCh(const int &ChN) const
Definition: dt.h:280

Here is the call graph for this function:

Here is the caller graph for this function:

void TChA::Swap ( TChA ChA)

Definition at line 601 of file dt.cpp.

References Bf, BfL, MxBfL, and Swap().

601  {
602  ::Swap(MxBfL, ChA.MxBfL);
603  ::Swap(BfL, ChA.BfL);
604  ::Swap(Bf, ChA.Bf);
605 }
char * Bf
Definition: dt.h:204
int MxBfL
Definition: dt.h:203
int BfL
Definition: dt.h:203
void Swap(const int &ChN1, const int &ChN2)
Definition: dt.cpp:595

Here is the call graph for this function:

TChA & TChA::ToLc ( )

Definition at line 552 of file dt.cpp.

References Bf.

Referenced by TStrUtil::GetDomNm(), TUrlLx::GetHost(), TStrUtil::GetNormalizedUrl(), and TUrlLx::GetScheme().

552  {
553  char *c = Bf;
554  while (*c) {
555  *c = (char) tolower(*c); c++;
556  }
557  return *this;
558 }
char * Bf
Definition: dt.h:204

Here is the caller graph for this function:

TChA & TChA::ToTrunc ( )

Definition at line 568 of file dt.cpp.

References GetCh(), TCh::IsWs(), Len(), PutCh(), and Trunc().

Referenced by TILx::GetStrToEoln().

568  {
569  int StrLen=Len(); int BChN=0; int EChN=StrLen-1;
570  while ((BChN<StrLen)&&TCh::IsWs(GetCh(BChN))){BChN++;}
571  while ((EChN>=0)&&TCh::IsWs(GetCh(EChN))){EChN--;}
572  if ((BChN!=0)||(EChN!=StrLen-1)){
573  int DstChN=0;
574  for (int SrcChN=BChN; SrcChN<=EChN; SrcChN++){
575  PutCh(DstChN, GetCh(SrcChN)); DstChN++;}
576  Trunc(DstChN);
577  }
578  return *this;
579 }
void PutCh(const int &ChN, const char &Ch)
Definition: dt.h:278
int Len() const
Definition: dt.h:259
static bool IsWs(const char &Ch)
Definition: dt.h:1063
char GetCh(const int &ChN) const
Definition: dt.h:280
void Trunc()
Definition: dt.cpp:420

Here is the call graph for this function:

Here is the caller graph for this function:

TChA & TChA::ToUc ( )

Definition at line 560 of file dt.cpp.

References Bf.

560  {
561  char *c = Bf;
562  while (*c) {
563  *c = (char) toupper(*c); c++;
564  }
565  return *this;
566 }
char * Bf
Definition: dt.h:204
void TChA::Trunc ( )

Definition at line 420 of file dt.cpp.

References BfL, Clr(), GetCh(), and PutCh().

Referenced by CompressWs(), TILx::GetSym(), TUrl::GetTopDownDocNm(), TSs::LoadTxtFldV(), TXmlLx::ToNrSpacing(), ToTrunc(), and TPreproc::TPreproc().

420  {
421  int BChN=0; while ((BChN<BfL)&&(GetCh(BChN)<=' ')){BChN++;}
422  int EChN=BfL-1; while ((0<=EChN)&&(GetCh(EChN)<=' ')){EChN--;}
423  if (BChN<=EChN){
424  for (int ChN=BChN; ChN<=EChN; ChN++){
425  PutCh(ChN-BChN, GetCh(ChN));}
426  Trunc(EChN-BChN+1);
427  } else {
428  Clr();
429  }
430 /* int BChN=0; while ((BChN<BfL)&&(Bf[BChN]<=' ')){BChN++;}
431  int EChN=BfL-1; while ((0<=EChN)&&(Bf[EChN]<=' ')){EChN--;}
432  if (BChN<=EChN){
433  for (int ChN=BChN; ChN<=EChN; ChN++){Bf[ChN-BChN]=Bf[ChN];}
434  Bf[BfL=EChN+1]=0;
435  } else {
436  Clr();
437  }*/
438 }
void PutCh(const int &ChN, const char &Ch)
Definition: dt.h:278
void Clr()
Definition: dt.h:258
char GetCh(const int &ChN) const
Definition: dt.h:280
int BfL
Definition: dt.h:203
void Trunc()
Definition: dt.cpp:420

Here is the call graph for this function:

Here is the caller graph for this function:

void TChA::Trunc ( const int &  _BfL)
inline

Definition at line 267 of file dt.h.

267  {
268  if ((0<=_BfL)&&(_BfL<=BfL)){Bf[BfL=_BfL]=0;}}
char * Bf
Definition: dt.h:204
int BfL
Definition: dt.h:203

Member Data Documentation

int TChA::BfL
private

Definition at line 203 of file dt.h.

Referenced by AddBf(), Del(), Ins(), Len(), LoadTxt(), operator+=(), operator=(), Pop(), Reverse(), SaveXml(), Swap(), TChA(), and Trunc().

int TChA::MxBfL
private

Definition at line 203 of file dt.h.

Referenced by LoadTxt(), operator=(), Resize(), Swap(), and TChA().


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