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
TWChA Class Reference

#include <wch.h>

Collaboration diagram for TWChA:

Public Member Functions

 TWChA (const int &MxWChs=0)
 
 TWChA (const TWChA &WChA)
 
 TWChA (const TWChV &_WChV)
 
 TWChA (const char *CStr)
 
 TWChA (const TChA &ChA)
 
 TWChA (const TStr &Str)
 
 ~TWChA ()
 
 TWChA (TSIn &SIn)
 
void Save (TSOut &SOut)
 
TWChAoperator= (const TWChA &WChA)
 
TWChAoperator= (const char *CStr)
 
TWChAoperator= (const TChA &ChA)
 
TWChAoperator= (const TStr &Str)
 
bool operator== (const TWChA &WChA) const
 
bool operator== (const char *CStr) const
 
TWChAoperator+= (const char &Ch)
 
TWChAoperator+= (const TWCh &WCh)
 
TWChAoperator+= (const char *CStr)
 
TWChAoperator+= (const TChA &ChA)
 
TWChAoperator+= (const TStr &Str)
 
TWChAoperator+= (const TWChA &WChA)
 
TWCh operator[] (const int &ChN) const
 
int GetMemUsed ()
 
void Clr ()
 
int Len () const
 
bool Empty () const
 
TStr GetStr () const
 
void GetSubWChA (const int &BChN, const int &EChN, TWChA &WChA) const
 
void InsStr (const int &BChN, const TStr &Str)
 
void DelSubStr (const int &BChN, const int &EChN)
 
bool DelStr (const TStr &Str)
 
void SplitOnCh (TStr &LStr, const char &SplitCh, TStr &RStr) const
 
int SearchCh (const TWCh &WCh, const int &BChN=0) const
 
int SearchStr (const TWChA &WChA, const int &BChN=0) const
 
bool IsChIn (const char &Ch) const
 
bool IsStrIn (const TWChA &WChA) const
 
bool IsPrefix (const TWChA &WChA) const
 
bool IsSufix (const TWChA &WChA) const
 
int ChangeStr (const TStr &SrcStr, const TStr &DstStr, const int &BChN=0)
 
int ChangeStrAll (const TStr &SrcStr, const TStr &DstStr)
 
void SaveTxt (const PSOut &SOut) const
 

Static Public Member Functions

static void LoadTxt (const PSIn &SIn, TWChA &WChA)
 

Static Public Attributes

static TWChA EmptyWChA
 

Private Member Functions

void AddCStr (const char *CStr)
 
void PutCStr (const char *CStr)
 

Private Attributes

TWChV WChV
 

Detailed Description

Definition at line 52 of file wch.h.

Constructor & Destructor Documentation

TWChA::TWChA ( const int &  MxWChs = 0)
inline

Definition at line 58 of file wch.h.

58 : WChV(MxWChs, 0){}
TWChV WChV
Definition: wch.h:54
TWChA::TWChA ( const TWChA WChA)
inline

Definition at line 59 of file wch.h.

59 : WChV(WChA.WChV){}
TWChV WChV
Definition: wch.h:54
TWChA::TWChA ( const TWChV _WChV)
inline

Definition at line 60 of file wch.h.

60 : WChV(_WChV){}
TWChV WChV
Definition: wch.h:54
TWChA::TWChA ( const char *  CStr)
inline

Definition at line 61 of file wch.h.

References PutCStr().

61 : WChV(){PutCStr(CStr);}
TWChV WChV
Definition: wch.h:54
void PutCStr(const char *CStr)
Definition: wch.cpp:21

Here is the call graph for this function:

TWChA::TWChA ( const TChA ChA)
inline

Definition at line 62 of file wch.h.

References TChA::CStr(), and PutCStr().

62 : WChV(){PutCStr(ChA.CStr());}
TWChV WChV
Definition: wch.h:54
char * CStr()
Definition: dt.h:255
void PutCStr(const char *CStr)
Definition: wch.cpp:21

Here is the call graph for this function:

TWChA::TWChA ( const TStr Str)
inline

Definition at line 63 of file wch.h.

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

63 : WChV(){PutCStr(Str.CStr());}
TWChV WChV
Definition: wch.h:54
void PutCStr(const char *CStr)
Definition: wch.cpp:21
char * CStr()
Definition: dt.h:479

Here is the call graph for this function:

TWChA::~TWChA ( )
inline

Definition at line 64 of file wch.h.

64 {}
TWChA::TWChA ( TSIn SIn)
inline

Definition at line 65 of file wch.h.

65 : WChV(SIn){}
TWChV WChV
Definition: wch.h:54

Member Function Documentation

void TWChA::AddCStr ( const char *  CStr)
private

Definition at line 15 of file wch.cpp.

References TVec< TVal, TSizeTy >::Add(), and WChV.

Referenced by operator+=().

15  {
16  int CStrLen=int(strlen(CStr));
17  for (int ChN=0; ChN<CStrLen; ChN++){
18  WChV.Add(TWCh(CStr[ChN]));}
19 }
TWChV WChV
Definition: wch.h:54
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
Definition: wch.h:3

Here is the call graph for this function:

Here is the caller graph for this function:

int TWChA::ChangeStr ( const TStr SrcStr,
const TStr DstStr,
const int &  BChN = 0 
)
int TWChA::ChangeStrAll ( const TStr SrcStr,
const TStr DstStr 
)
void TWChA::Clr ( )
inline

Definition at line 84 of file wch.h.

References TVec< TVal, TSizeTy >::Clr().

Referenced by LoadTxt().

84 {WChV.Clr();}
TWChV WChV
Definition: wch.h:54
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:1022

Here is the call graph for this function:

Here is the caller graph for this function:

bool TWChA::DelStr ( const TStr Str)
void TWChA::DelSubStr ( const int &  BChN,
const int &  EChN 
)
bool TWChA::Empty ( ) const
inline

Definition at line 86 of file wch.h.

References TVec< TVal, TSizeTy >::Empty().

86 {return WChV.Empty();}
TWChV WChV
Definition: wch.h:54
bool Empty() const
Tests whether the vector is empty.
Definition: ds.h:570

Here is the call graph for this function:

int TWChA::GetMemUsed ( )
inline

Definition at line 82 of file wch.h.

References TVec< TVal, TSizeTy >::GetMemUsed().

82 {return WChV.GetMemUsed();}
TWChV WChV
Definition: wch.h:54
TSizeTy GetMemUsed() const
Returns the memory footprint (the number of bytes) of the vector.
Definition: ds.h:511

Here is the call graph for this function:

TStr TWChA::GetStr ( ) const

Definition at line 28 of file wch.cpp.

References TVec< TVal, TSizeTy >::Len(), and WChV.

Referenced by operator==().

28  {
29  TChA ChA;
30  for (int WChN=0; WChN<WChV.Len(); WChN++){
31  ChA+=WChV[WChN].GetCh();}
32  return ChA;
33 }
TWChV WChV
Definition: wch.h:54
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
Definition: dt.h:201

Here is the call graph for this function:

Here is the caller graph for this function:

void TWChA::GetSubWChA ( const int &  BChN,
const int &  EChN,
TWChA WChA 
) const
inline

Definition at line 89 of file wch.h.

References TVec< TVal, TSizeTy >::GetSubValV(), and WChV.

89  {
90  WChV.GetSubValV(BChN, EChN, WChA.WChV);}
TWChV WChV
Definition: wch.h:54
void GetSubValV(const TSizeTy &BValN, const TSizeTy &EValN, TVec< TVal, TSizeTy > &ValV) const
Fills ValV with elements at positions BValN...EValN.
Definition: ds.h:1170

Here is the call graph for this function:

void TWChA::InsStr ( const int &  BChN,
const TStr Str 
)
bool TWChA::IsChIn ( const char &  Ch) const
inline

Definition at line 100 of file wch.h.

References SearchCh().

100 {return SearchCh(Ch)!=-1;}
int SearchCh(const TWCh &WCh, const int &BChN=0) const
Definition: wch.h:96

Here is the call graph for this function:

bool TWChA::IsPrefix ( const TWChA WChA) const
inline

Definition at line 102 of file wch.h.

References TVec< TVal, TSizeTy >::GetSubValV(), Len(), and WChV.

102  {
103  TWChV SubWChV; WChV.GetSubValV(0, WChA.Len()-1, SubWChV);
104  return SubWChV==WChA.WChV;}
TWChV WChV
Definition: wch.h:54
int Len() const
Definition: wch.h:85
void GetSubValV(const TSizeTy &BValN, const TSizeTy &EValN, TVec< TVal, TSizeTy > &ValV) const
Fills ValV with elements at positions BValN...EValN.
Definition: ds.h:1170

Here is the call graph for this function:

bool TWChA::IsStrIn ( const TWChA WChA) const
inline

Definition at line 101 of file wch.h.

References SearchStr().

101 {return SearchStr(WChA)!=-1;}
int SearchStr(const TWChA &WChA, const int &BChN=0) const
Definition: wch.h:98

Here is the call graph for this function:

bool TWChA::IsSufix ( const TWChA WChA) const
inline

Definition at line 105 of file wch.h.

References TVec< TVal, TSizeTy >::GetSubValV(), Len(), and WChV.

105  {
106  TWChV SubWChV; WChV.GetSubValV(Len()-WChA.Len(), Len()-1, SubWChV);
107  return SubWChV==WChA.WChV;}
TWChV WChV
Definition: wch.h:54
int Len() const
Definition: wch.h:85
void GetSubValV(const TSizeTy &BValN, const TSizeTy &EValN, TVec< TVal, TSizeTy > &ValV) const
Fills ValV with elements at positions BValN...EValN.
Definition: ds.h:1170

Here is the call graph for this function:

int TWChA::Len ( ) const
inline

Definition at line 85 of file wch.h.

References TVec< TVal, TSizeTy >::Len().

Referenced by IsPrefix(), and IsSufix().

85 {return WChV.Len();}
TWChV WChV
Definition: wch.h:54
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575

Here is the call graph for this function:

Here is the caller graph for this function:

void TWChA::LoadTxt ( const PSIn SIn,
TWChA WChA 
)
static

Definition at line 35 of file wch.cpp.

References Clr(), TSIn::Eof(), IAssert, TWCh::LoadTxt(), and TWCh::StartWCh.

35  {
36  WChA.Clr();
37  TWCh WCh=TWCh::LoadTxt(SIn);
38  IAssert(WCh==TWCh::StartWCh);
39  while (!SIn->Eof()){
40  WChA+=TWCh::LoadTxt(SIn);}
41 }
#define IAssert(Cond)
Definition: bd.h:262
static const TWCh StartWCh
Definition: wch.h:42
virtual bool Eof()=0
void Clr()
Definition: wch.h:84
static TWCh LoadTxt(const PSIn &SIn)
Definition: wch.h:36
Definition: wch.h:3

Here is the call graph for this function:

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

Definition at line 75 of file wch.h.

References TVec< TVal, TSizeTy >::Add().

75 {WChV.Add(TWCh(Ch)); return *this;}
TWChV WChV
Definition: wch.h:54
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
Definition: wch.h:3

Here is the call graph for this function:

TWChA& TWChA::operator+= ( const TWCh WCh)
inline

Definition at line 76 of file wch.h.

References TVec< TVal, TSizeTy >::Add().

76 {WChV.Add(WCh); return *this;}
TWChV WChV
Definition: wch.h:54
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602

Here is the call graph for this function:

TWChA& TWChA::operator+= ( const char *  CStr)
inline

Definition at line 77 of file wch.h.

References AddCStr().

77 {AddCStr(CStr); return *this;}
void AddCStr(const char *CStr)
Definition: wch.cpp:15

Here is the call graph for this function:

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

Definition at line 78 of file wch.h.

References AddCStr(), and TChA::CStr().

78 {AddCStr(ChA.CStr()); return *this;}
char * CStr()
Definition: dt.h:255
void AddCStr(const char *CStr)
Definition: wch.cpp:15

Here is the call graph for this function:

TWChA& TWChA::operator+= ( const TStr Str)
inline

Definition at line 79 of file wch.h.

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

79 {AddCStr(Str.CStr()); return *this;}
void AddCStr(const char *CStr)
Definition: wch.cpp:15
char * CStr()
Definition: dt.h:479

Here is the call graph for this function:

TWChA& TWChA::operator+= ( const TWChA WChA)
inline

Definition at line 80 of file wch.h.

References TVec< TVal, TSizeTy >::AddV(), and WChV.

80 {WChV.AddV(WChA.WChV); return *this;}
TWChV WChV
Definition: wch.h:54
TSizeTy AddV(const TVec< TVal, TSizeTy > &ValV)
Adds the elements of the vector ValV to the to end of the vector.
Definition: ds.h:1110

Here is the call graph for this function:

TWChA& TWChA::operator= ( const TWChA WChA)
inline

Definition at line 68 of file wch.h.

References WChV.

68  {
69  if (this!=&WChA){WChV=WChA.WChV;} return *this;}
TWChV WChV
Definition: wch.h:54
TWChA& TWChA::operator= ( const char *  CStr)
inline

Definition at line 70 of file wch.h.

References PutCStr().

70 {PutCStr(CStr); return *this;}
void PutCStr(const char *CStr)
Definition: wch.cpp:21

Here is the call graph for this function:

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

Definition at line 71 of file wch.h.

References TChA::CStr(), and PutCStr().

71 {PutCStr(ChA.CStr()); return *this;}
char * CStr()
Definition: dt.h:255
void PutCStr(const char *CStr)
Definition: wch.cpp:21

Here is the call graph for this function:

TWChA& TWChA::operator= ( const TStr Str)
inline

Definition at line 72 of file wch.h.

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

72 {PutCStr(Str.CStr()); return *this;}
void PutCStr(const char *CStr)
Definition: wch.cpp:21
char * CStr()
Definition: dt.h:479

Here is the call graph for this function:

bool TWChA::operator== ( const TWChA WChA) const
inline

Definition at line 73 of file wch.h.

References WChV.

73 {return WChV==WChA.WChV;}
TWChV WChV
Definition: wch.h:54
bool TWChA::operator== ( const char *  CStr) const
inline

Definition at line 74 of file wch.h.

References GetStr().

74 {return strcmp(GetStr().CStr(), CStr)!=0;}
TStr GetStr() const
Definition: wch.cpp:28

Here is the call graph for this function:

TWCh TWChA::operator[] ( const int &  ChN) const
inline

Definition at line 81 of file wch.h.

81 {return WChV[ChN];}
TWChV WChV
Definition: wch.h:54
void TWChA::PutCStr ( const char *  CStr)
private

Definition at line 21 of file wch.cpp.

References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Gen(), and WChV.

Referenced by operator=(), and TWChA().

21  {
22  int CStrLen=int(strlen(CStr));
23  WChV.Gen(CStrLen, 0);
24  for (int ChN=0; ChN<CStrLen; ChN++){
25  WChV.Add(TWCh(CStr[ChN]));}
26 }
TWChV WChV
Definition: wch.h:54
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
Definition: wch.h:3

Here is the call graph for this function:

Here is the caller graph for this function:

void TWChA::Save ( TSOut SOut)
inline

Definition at line 66 of file wch.h.

References TVec< TVal, TSizeTy >::Save().

66 {WChV.Save(SOut);}
TWChV WChV
Definition: wch.h:54
void Save(TSOut &SOut) const
Definition: ds.h:954

Here is the call graph for this function:

void TWChA::SaveTxt ( const PSOut SOut) const

Definition at line 43 of file wch.cpp.

References TVec< TVal, TSizeTy >::Len(), TWCh::SaveTxt(), TWCh::StartWCh, and WChV.

43  {
44  TWCh::StartWCh.SaveTxt(SOut);
45  for (int WChN=0; WChN<WChV.Len(); WChN++){
46  WChV[WChN].SaveTxt(SOut);}
47 }
TWChV WChV
Definition: wch.h:54
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
static const TWCh StartWCh
Definition: wch.h:42
void SaveTxt(const PSOut &SOut) const
Definition: wch.h:39

Here is the call graph for this function:

int TWChA::SearchCh ( const TWCh WCh,
const int &  BChN = 0 
) const
inline

Definition at line 96 of file wch.h.

References TVec< TVal, TSizeTy >::SearchForw().

Referenced by IsChIn().

96  {
97  return WChV.SearchForw(WCh, BChN);}
TWChV WChV
Definition: wch.h:54
TSizeTy SearchForw(const TVal &Val, const TSizeTy &BValN=0) const
Returns the position of an element with value Val.
Definition: ds.h:1552

Here is the call graph for this function:

Here is the caller graph for this function:

int TWChA::SearchStr ( const TWChA WChA,
const int &  BChN = 0 
) const
inline

Definition at line 98 of file wch.h.

References TVec< TVal, TSizeTy >::SearchVForw(), and WChV.

Referenced by IsStrIn().

98  {
99  return WChV.SearchVForw(WChA.WChV, BChN);}
TWChV WChV
Definition: wch.h:54
TSizeTy SearchVForw(const TVec< TVal, TSizeTy > &ValV, const TSizeTy &BValN=0) const
Returns the starting position of vector ValV.
Definition: ds.h:1566

Here is the call graph for this function:

Here is the caller graph for this function:

void TWChA::SplitOnCh ( TStr LStr,
const char &  SplitCh,
TStr RStr 
) const

Member Data Documentation

TWChA TWChA::EmptyWChA
static

Definition at line 114 of file wch.h.

TWChV TWChA::WChV
private

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