|
SNAP Library 2.2, User Reference
2014-03-11 19:15:55
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <fl.h>
Inherits TSOut.
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 |
| char* TMOut::GetBfAddr | ( | ) | const [inline] |
| char TMOut::GetCh | ( | const int & | ChN | ) | const [inline] |
| TStr TMOut::GetCrLfLn | ( | ) |
| TStr TMOut::GetEolnLn | ( | const bool & | DoAddEoln, |
| const bool & | DoCutBf | ||
| ) |
Definition at line 700 of file fl.cpp.
{
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.
{
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] |
| void TMOut::MkEolnLn | ( | ) |
| static PSOut TMOut::New | ( | const int & | MxBfL = 1024 | ) | [inline, static] |
| int TMOut::PutBf | ( | const void * | LBf, |
| const TSize & | LBfL | ||
| ) | [virtual] |
| int TMOut::PutCh | ( | const char & | Ch | ) | [inline, virtual] |
| void TMOut::Resize | ( | const int & | ReqLen = -1 | ) | [private] |
Definition at line 603 of file fl.cpp.
{
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;
}
}
int TMOut::BfL [private] |
int TMOut::MxBfL [private] |
bool TMOut::OwnBf [private] |