SNAP Library 6.0, User Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
wch.cpp
Go to the documentation of this file.
1 // Wide-Char
3 const TWCh TWCh::Mn(0, 0);
4 const TWCh TWCh::Mx(0xFF, 0xFF);
5 const int TWCh::Vals=0x10000;
6 
7 const TWCh TWCh::StartWCh(0xFE, 0xFF);
11 const TWCh TWCh::SpaceWCh(' ');
12 
14 // Wide-Char-Array
15 void TWChA::AddCStr(const char* CStr){
16  int CStrLen=int(strlen(CStr));
17  for (int ChN=0; ChN<CStrLen; ChN++){
18  WChV.Add(TWCh(CStr[ChN]));}
19 }
20 
21 void TWChA::PutCStr(const char* CStr){
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 }
27 
29  TChA ChA;
30  for (int WChN=0; WChN<WChV.Len(); WChN++){
31  ChA+=WChV[WChN].GetCh();}
32  return ChA;
33 }
34 
35 void TWChA::LoadTxt(const PSIn& SIn, TWChA& WChA){
36  WChA.Clr();
37  TWCh WCh=TWCh::LoadTxt(SIn);
38  IAssert(WCh==TWCh::StartWCh);
39  while (!SIn->Eof()){
40  WChA+=TWCh::LoadTxt(SIn);}
41 }
42 
43 void TWChA::SaveTxt(const PSOut& SOut) const {
44  TWCh::StartWCh.SaveTxt(SOut);
45  for (int WChN=0; WChN<WChV.Len(); WChN++){
46  WChV[WChN].SaveTxt(SOut);}
47 }
48 
50 
#define IAssert(Cond)
Definition: bd.h:262
static void LoadTxt(const PSIn &SIn, TWChA &WChA)
Definition: wch.cpp:35
static const TWCh LfWCh
Definition: wch.h:44
static const TWCh Mx
Definition: wch.h:9
TWChV WChV
Definition: wch.h:54
TStr GetStr() const
Definition: wch.cpp:28
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
static const int Vals
Definition: wch.h:10
static const TWCh SpaceWCh
Definition: wch.h:46
static const TWCh StartWCh
Definition: wch.h:42
static TWChA EmptyWChA
Definition: wch.h:114
virtual bool Eof()=0
static const char TabCh
Definition: dt.h:1037
void PutCStr(const char *CStr)
Definition: wch.cpp:21
static const TWCh TabWCh
Definition: wch.h:43
static const TWCh Mn
Definition: wch.h:8
static const char LfCh
Definition: dt.h:1038
Definition: dt.h:201
void Clr()
Definition: wch.h:84
void SaveTxt(const PSOut &SOut) const
Definition: wch.h:39
Definition: dt.h:412
static const char CrCh
Definition: dt.h:1039
static TWCh LoadTxt(const PSIn &SIn)
Definition: wch.h:36
void SaveTxt(const PSOut &SOut) const
Definition: wch.cpp:43
void AddCStr(const char *CStr)
Definition: wch.cpp:15
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523
Definition: wch.h:52
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
static const TWCh CrWCh
Definition: wch.h:45
Definition: wch.h:3