-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwch.cpp
executable file
·50 lines (42 loc) · 1.24 KB
/
wch.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/////////////////////////////////////////////////
// Wide-Char
const TWCh TWCh::Mn(0, 0);
const TWCh TWCh::Mx(0xFF, 0xFF);
const int TWCh::Vals=0x10000;
const TWCh TWCh::StartWCh(0xFE, 0xFF);
const TWCh TWCh::TabWCh(TCh::TabCh);
const TWCh TWCh::LfWCh(TCh::LfCh);
const TWCh TWCh::CrWCh(TCh::CrCh);
const TWCh TWCh::SpaceWCh(' ');
/////////////////////////////////////////////////
// Wide-Char-Array
void TWChA::AddCStr(const char* CStr){
int CStrLen=int(strlen(CStr));
for (int ChN=0; ChN<CStrLen; ChN++){
WChV.Add(TWCh(CStr[ChN]));}
}
void TWChA::PutCStr(const char* CStr){
int CStrLen=int(strlen(CStr));
WChV.Gen(CStrLen, 0);
for (int ChN=0; ChN<CStrLen; ChN++){
WChV.Add(TWCh(CStr[ChN]));}
}
TStr TWChA::GetStr() const {
TChA ChA;
for (int WChN=0; WChN<WChV.Len(); WChN++){
ChA+=WChV[WChN].GetCh();}
return ChA;
}
void TWChA::LoadTxt(const PSIn& SIn, TWChA& WChA){
WChA.Clr();
TWCh WCh=TWCh::LoadTxt(SIn);
IAssert(WCh==TWCh::StartWCh);
while (!SIn->Eof()){
WChA+=TWCh::LoadTxt(SIn);}
}
void TWChA::SaveTxt(const PSOut& SOut) const {
TWCh::StartWCh.SaveTxt(SOut);
for (int WChN=0; WChN<WChV.Len(); WChN++){
WChV[WChN].SaveTxt(SOut);}
}
TWChA TWChA::EmptyWChA;