SNAP Library 2.1, User Reference
2013-09-25 10:47:25
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#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 |
TChA & | operator= (const TChA &ChA) |
TChA & | operator= (const TStr &Str) |
TChA & | operator= (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 |
TChA & | operator+= (const TMem &Mem) |
TChA & | operator+= (const TChA &ChA) |
TChA & | operator+= (const TStr &Str) |
TChA & | operator+= (const char *CStr) |
TChA & | operator+= (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) |
TChA & | ToUc () |
TChA & | ToLc () |
TChA & | ToTrunc () |
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 |
TChA::TChA | ( | const int & | _MxBfL = 256 | ) | [inline, explicit] |
TChA::TChA | ( | const char * | CStr | ) | [inline] |
TChA::TChA | ( | const char * | CStr, |
const int & | StrLen | ||
) | [inline] |
TChA::TChA | ( | const TChA & | ChA | ) | [inline] |
TChA::TChA | ( | const TStr & | Str | ) |
TChA::TChA | ( | const TMem & | Mem | ) | [inline] |
TChA::~TChA | ( | ) | [inline] |
TChA::TChA | ( | TSIn & | SIn | ) | [inline, explicit] |
void TChA::AddBf | ( | char * | NewBf, |
const int & | BfS | ||
) | [inline] |
void TChA::AddCh | ( | const char & | Ch, |
const int & | MxLen = -1 |
||
) | [inline] |
Definition at line 271 of file dt.h.
{ if ((MxLen==-1)||(BfL<MxLen)){operator+=(Ch);}}
void TChA::AddChTo | ( | const char & | Ch, |
const int & | ToChN | ||
) | [inline] |
void TChA::ChangeCh | ( | const char & | SrcCh, |
const char & | DstCh | ||
) |
void TChA::CompressWs | ( | ) |
Definition at line 581 of file dt.cpp.
{ int StrLen=Len(); int SrcChN=0; int DstChN=0; while ((SrcChN<StrLen)&&TCh::IsWs(GetCh(SrcChN))){SrcChN++;} while (SrcChN<StrLen){ if ((TCh::IsWs(GetCh(SrcChN)))&&(DstChN>0)&&(TCh::IsWs(GetCh(DstChN-1)))){ SrcChN++; } else { PutCh(DstChN, GetCh(SrcChN)); SrcChN++; DstChN++; } } if ((DstChN>0)&&(TCh::IsWs(GetCh(DstChN-1)))){DstChN--;} Trunc(DstChN); }
int TChA::CountCh | ( | const char & | Ch, |
const int & | BChN = 0 |
||
) | const |
Definition at line 462 of file dt.cpp.
{ int ChN=TInt::GetMx(BChN, 0); const int ThisLen=Len(); int Cnt = 0; while (ChN<ThisLen){if (Bf[ChN]==Ch){ Cnt++;} ChN++;} return Cnt; }
char* TChA::CStr | ( | ) | [inline] |
const char* TChA::CStr | ( | ) | const [inline] |
void TChA::Del | ( | const int & | ChN | ) |
void TChA::DelLastCh | ( | ) | [inline] |
bool TChA::Empty | ( | ) | const [inline] |
char TChA::GetCh | ( | const int & | ChN | ) | const [inline] |
Definition at line 280 of file dt.h.
{return operator[](ChN);}
int TChA::GetMemUsed | ( | ) | const [inline] |
int TChA::GetPrimHashCd | ( | ) | const |
Definition at line 607 of file dt.cpp.
{ return TStrHashF_DJB::GetPrimHashCd(CStr()); }
int TChA::GetSecHashCd | ( | ) | const |
Definition at line 611 of file dt.cpp.
{ return TStrHashF_DJB::GetSecHashCd(CStr()); }
TChA TChA::GetSubStr | ( | const int & | BChN, |
const int & | EChN | ||
) | const |
Definition at line 448 of file dt.cpp.
{ int BChN=TInt::GetMx(_BChN, 0); int EChN=TInt::GetMn(_EChN, Len()-1); int Chs=EChN-BChN+1; if (Chs<=0){return TStr::GetNullStr();} else if (Chs==Len()){return *this;} else { //char* Bf=new char[Chs+1]; strncpy(Bf, CStr()+BChN, Chs); Bf[Chs]=0; //TStr Str(Bf); delete[] Bf; //return Str; return TChA(CStr()+BChN, Chs); } }
void TChA::Ins | ( | const int & | BChN, |
const char * | CStr | ||
) |
bool TChA::IsChIn | ( | const char & | Ch | ) | const [inline] |
bool TChA::IsPrefix | ( | const char * | CStr, |
const int & | BChN = 0 |
||
) | const |
bool TChA::IsPrefix | ( | const TStr & | Str | ) | const |
bool TChA::IsPrefix | ( | const TChA & | Str | ) | const |
bool TChA::IsStrIn | ( | const TStr & | Str | ) | const [inline] |
bool TChA::IsSuffix | ( | const char * | CStr | ) | const |
bool TChA::IsSuffix | ( | const TStr & | Str | ) | const |
bool TChA::IsSuffix | ( | const TChA & | Str | ) | const |
char TChA::LastCh | ( | ) | const [inline] |
char TChA::LastLastCh | ( | ) | const [inline] |
void TChA::Load | ( | TSIn & | SIn | ) | [inline] |
void TChA::LoadTxt | ( | const PSIn & | SIn, |
TChA & | ChA | ||
) | [static] |
void TChA::LoadXml | ( | const PXmlTok & | XmlTok, |
const TStr & | Nm | ||
) |
bool TChA::operator!= | ( | const TChA & | ChA | ) | const [inline] |
bool TChA::operator!= | ( | const char * | _CStr | ) | const [inline] |
bool TChA::operator!= | ( | const char & | Ch | ) | const [inline] |
TChA & TChA::operator+= | ( | const char * | CStr | ) |
TChA& TChA::operator+= | ( | const char & | Ch | ) | [inline] |
bool TChA::operator< | ( | const TChA & | ChA | ) | const [inline] |
TChA & TChA::operator= | ( | const char * | CStr | ) |
bool TChA::operator== | ( | const TChA & | ChA | ) | const [inline] |
bool TChA::operator== | ( | const char * | _CStr | ) | const [inline] |
bool TChA::operator== | ( | const char & | Ch | ) | const [inline] |
char TChA::operator[] | ( | const int & | ChN | ) | const [inline] |
char& TChA::operator[] | ( | const int & | ChN | ) | [inline] |
char TChA::Pop | ( | ) | [inline] |
void TChA::Push | ( | const char & | Ch | ) | [inline] |
Definition at line 264 of file dt.h.
{operator+=(Ch);}
void TChA::PutCh | ( | const int & | ChN, |
const char & | Ch | ||
) | [inline] |
void TChA::Resize | ( | const int & | _MxBfL | ) | [private] |
void TChA::Reverse | ( | ) |
void TChA::Save | ( | TSOut & | SOut, |
const bool & | SaveCompact = true |
||
) | const [inline] |
void TChA::SaveTxt | ( | const PSOut & | SOut | ) | const |
void TChA::SaveXml | ( | TSOut & | SOut, |
const TStr & | Nm | ||
) | const |
Definition at line 361 of file dt.cpp.
{ XSaveHdArg(Nm, "BfL", TInt::GetStr(BfL)); SOut.PutStr(TXmlLx::GetXmlStrFromPlainStr(*this)); }
int TChA::SearchCh | ( | const char & | Ch, |
const int & | BChN = 0 |
||
) | const |
Definition at line 470 of file dt.cpp.
{ int ChN=TInt::GetMx(BChN, 0); const int ThisLen=Len(); while (ChN<ThisLen){if (Bf[ChN]==Ch){return ChN;} ChN++;} return -1; }
int TChA::SearchChBack | ( | const char & | Ch, |
int | BChN = -1 |
||
) | const |
int TChA::SearchStr | ( | const TChA & | Str, |
const int & | BChN = 0 |
||
) | const |
int TChA::SearchStr | ( | const TStr & | Str, |
const int & | BChN = 0 |
||
) | const |
int TChA::SearchStr | ( | const char * | CStr, |
const int & | BChN = 0 |
||
) | const |
void TChA::Swap | ( | const int & | ChN1, |
const int & | ChN2 | ||
) |
void TChA::Swap | ( | TChA & | ChA | ) |
TChA & TChA::ToLc | ( | ) |
TChA & TChA::ToTrunc | ( | ) |
Definition at line 568 of file dt.cpp.
{ int StrLen=Len(); int BChN=0; int EChN=StrLen-1; while ((BChN<StrLen)&&TCh::IsWs(GetCh(BChN))){BChN++;} while ((EChN>=0)&&TCh::IsWs(GetCh(EChN))){EChN--;} if ((BChN!=0)||(EChN!=StrLen-1)){ int DstChN=0; for (int SrcChN=BChN; SrcChN<=EChN; SrcChN++){ PutCh(DstChN, GetCh(SrcChN)); DstChN++;} Trunc(DstChN); } return *this; }
TChA & TChA::ToUc | ( | ) |
void TChA::Trunc | ( | ) |
Definition at line 420 of file dt.cpp.
{ int BChN=0; while ((BChN<BfL)&&(GetCh(BChN)<=' ')){BChN++;} int EChN=BfL-1; while ((0<=EChN)&&(GetCh(EChN)<=' ')){EChN--;} if (BChN<=EChN){ for (int ChN=BChN; ChN<=EChN; ChN++){ PutCh(ChN-BChN, GetCh(ChN));} Trunc(EChN-BChN+1); } else { Clr(); } /* int BChN=0; while ((BChN<BfL)&&(Bf[BChN]<=' ')){BChN++;} int EChN=BfL-1; while ((0<=EChN)&&(Bf[EChN]<=' ')){EChN--;} if (BChN<=EChN){ for (int ChN=BChN; ChN<=EChN; ChN++){Bf[ChN-BChN]=Bf[ChN];} Bf[BfL=EChN+1]=0; } else { Clr(); }*/ }
void TChA::Trunc | ( | const int & | _BfL | ) | [inline] |
int TChA::MxBfL [private] |