|
SNAP Library 2.2, Developer Reference
2014-03-11 19:15:55
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <fl.h>


Public Member Functions | |
| TMOut (const int &_MxBfL=1024) | |
| TMOut (char *_Bf, const int &_MxBfL) | |
| ~TMOut () | |
| int | PutCh (const char &Ch) |
| int | PutBf (const void *LBf, const TSize &LBfL) |
| void | AppendBf (const void *LBf, const TSize &LBfL) |
| void | Flush () |
| int | Len () const |
| void | Clr () |
| char | GetCh (const int &ChN) const |
| TStr | GetAsStr () const |
| void | CutBf (const int &CutBfL) |
| PSIn | GetSIn (const bool &IsCut=true, const int &CutBfL=-1) |
| char * | GetBfAddr () const |
| bool | IsCrLfLn () const |
| TStr | GetCrLfLn () |
| bool | IsEolnLn () const |
| TStr | GetEolnLn (const bool &DoAddEoln, const bool &DoCutBf) |
| void | MkEolnLn () |
Static Public Member Functions | |
| static PSOut | New (const int &MxBfL=1024) |
Private Member Functions | |
| void | Resize (const int &ReqLen=-1) |
| TMOut (const TMOut &) | |
| TMOut & | operator= (const TMOut &) |
Private Attributes | |
| char * | Bf |
| int | BfL |
| int | MxBfL |
| bool | OwnBf |
| TMOut::TMOut | ( | const TMOut & | ) | [private] |
| TMOut::TMOut | ( | const int & | _MxBfL = 1024 | ) |
| TMOut::TMOut | ( | char * | _Bf, |
| const int & | _MxBfL | ||
| ) |
| TMOut::~TMOut | ( | ) | [inline] |
| void TMOut::AppendBf | ( | const void * | LBf, |
| const TSize & | LBfL | ||
| ) |
| void TMOut::Clr | ( | ) | [inline] |
| void TMOut::CutBf | ( | const int & | CutBfL | ) |
| void TMOut::Flush | ( | ) | [inline, virtual] |
| TStr TMOut::GetAsStr | ( | ) | const |
Definition at line 647 of file fl.cpp.
Referenced by THtmlDoc::GetRedirHtmlDocStr(), and TXmlDoc::SaveStr().

| char* TMOut::GetBfAddr | ( | ) | const [inline] |
| char TMOut::GetCh | ( | const int & | ChN | ) | const [inline] |
| TStr TMOut::GetCrLfLn | ( | ) |
Definition at line 679 of file fl.cpp.
References Bf, BfL, TCh::CrCh, CutBf(), IAssert, IsCrLfLn(), and TCh::LfCh.
{
IAssert(IsCrLfLn());
TChA Ln;
for (int BfC=0; BfC<BfL; BfC++){
char Ch=Bf[BfC];
if ((Ch==TCh::CrCh)&&((BfC+1<BfL)&&(Bf[BfC+1]==TCh::LfCh))){
Ln+=TCh::CrCh; Ln+=TCh::LfCh; CutBf(BfC+1+1); break;
} else {
Ln+=Ch;
}
}
return Ln;
}

| TStr TMOut::GetEolnLn | ( | const bool & | DoAddEoln, |
| const bool & | DoCutBf | ||
| ) |
Definition at line 700 of file fl.cpp.
References Bf, BfL, TCh::CrCh, CutBf(), IAssert, IsEolnLn(), and TCh::LfCh.
{
IAssert(IsEolnLn());
int LnChs=0; TChA Ln;
for (int BfC=0; BfC<BfL; BfC++){
char Ch=Bf[BfC];
if ((Ch==TCh::CrCh)||(Ch==TCh::LfCh)){
LnChs++; if (DoAddEoln){Ln+=Ch;}
if (BfC+1<BfL){
char NextCh=Bf[BfC+1];
if (((Ch==TCh::CrCh)&&(NextCh==TCh::LfCh))||
((Ch==TCh::LfCh)&&(NextCh==TCh::CrCh))){
LnChs++; if (DoAddEoln){Ln+=NextCh;}
}
}
break;
} else {
LnChs++; Ln+=Ch;
}
}
if (DoCutBf){
CutBf(LnChs);
}
return Ln;
}

| PSIn TMOut::GetSIn | ( | const bool & | IsCut = true, |
| const int & | CutBfL = -1 |
||
| ) |
Definition at line 659 of file fl.cpp.
References Bf, BfL, CutBf(), TInt::GetMn(), IAssert, MxBfL, and OwnBf.
Referenced by TFHash< TKey, TFDat, TVDat >::AddDat(), TFHash< TKey, TFDat, TVDat >::AddKey(), TMem::GetSIn(), TExpVal::GetStr(), TExp::GetStr(), TFHashKey< TKey, TFDat, TVDat >::OnDelFromCache(), TFHash< TKey, TFDat, TVDat >::TFHash(), and TFHash< TKey, TFDat, TVDat >::~TFHash().
{
IAssert((CutBfL==-1)||((0<=CutBfL)));
int SInBfL= (CutBfL==-1) ? BfL : TInt::GetMn(BfL, CutBfL);
PSIn SIn;
if (OwnBf&&IsCut&&(SInBfL==BfL)){
SIn=PSIn(new TMIn(Bf, SInBfL, true));
Bf=NULL; BfL=MxBfL=0; OwnBf=true;
} else {
SIn=PSIn(new TMIn(Bf, SInBfL, false));
if (IsCut){CutBf(SInBfL);}
}
return SIn;
}


| bool TMOut::IsCrLfLn | ( | ) | const |
| bool TMOut::IsEolnLn | ( | ) | const |
| int TMOut::Len | ( | ) | const [inline] |
Definition at line 439 of file fl.h.
References BfL.
Referenced by AppendBf().
{return BfL;}

| void TMOut::MkEolnLn | ( | ) |
| static PSOut TMOut::New | ( | const int & | MxBfL = 1024 | ) | [inline, static] |
| int TMOut::PutBf | ( | const void * | LBf, |
| const TSize & | LBfL | ||
| ) | [virtual] |
Implements TSOut.
Definition at line 635 of file fl.cpp.
References Bf, BfL, MxBfL, and PutCh().
{
int LBfS=0;
if (TSize(BfL+LBfL)>TSize(MxBfL)){
for (TSize LBfC=0; LBfC<LBfL; LBfC++){
LBfS+=PutCh(((char*)LBf)[LBfC]);}
} else {
for (TSize LBfC=0; LBfC<LBfL; LBfC++){
LBfS+=(Bf[BfL++]=((char*)LBf)[LBfC]);}
}
return LBfS;
}

| int TMOut::PutCh | ( | const char & | Ch | ) | [inline, virtual] |
| void TMOut::Resize | ( | const int & | ReqLen = -1 | ) | [private] |
Definition at line 603 of file fl.cpp.
References Bf, BfL, IAssert, MxBfL, and OwnBf.
Referenced by AppendBf(), and PutCh().
{
IAssert(OwnBf&&(BfL==MxBfL || ReqLen >= 0));
if (Bf==NULL){
IAssert(MxBfL==0);
if (ReqLen < 0) Bf=new char[MxBfL=1024];
else Bf=new char[MxBfL=ReqLen];
} else {
if (ReqLen < 0){ MxBfL*=2; }
else if (ReqLen < MxBfL){ return; } // nothing to do
else { MxBfL=(2*MxBfL < ReqLen ? ReqLen : 2*MxBfL); }
char* NewBf=new char[MxBfL];
memmove(NewBf, Bf, BfL); delete[] Bf; Bf=NewBf;
}
}

char* TMOut::Bf [private] |
Definition at line 419 of file fl.h.
Referenced by AppendBf(), CutBf(), GetAsStr(), GetBfAddr(), GetCh(), GetCrLfLn(), GetEolnLn(), GetSIn(), IsCrLfLn(), IsEolnLn(), PutBf(), PutCh(), Resize(), TMOut(), and ~TMOut().
int TMOut::BfL [private] |
Definition at line 420 of file fl.h.
Referenced by AppendBf(), Clr(), CutBf(), GetAsStr(), GetCh(), GetCrLfLn(), GetEolnLn(), GetSIn(), IsCrLfLn(), IsEolnLn(), Len(), PutBf(), PutCh(), and Resize().
int TMOut::MxBfL [private] |
bool TMOut::OwnBf [private] |