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 | |
TFInOut (const TStr &FNm, const TFAccess &FAccess, const bool &CreateIfNo) | |
~TFInOut () | |
TStr | GetFNm () const |
TFileId | GetFileId () const |
bool | Eof () |
int | Len () const |
char | GetCh () |
char | PeekCh () |
int | GetBf (const void *LBf, const TSize &LBfL) |
bool | GetNextLnBf (TChA &LnChA) |
void | SetPos (const int &Pos) |
void | MovePos (const int &DPos) |
int | GetPos () const |
int | GetSize () const |
void | Clr () |
int | PutCh (const char &Ch) |
int | PutBf (const void *LBf, const TSize &LBfL) |
void | Flush () |
Static Public Member Functions | |
static PSInOut | New (const TStr &FNm, const TFAccess &FAccess, const bool &CreateIfNo) |
Private Member Functions | |
TFInOut () | |
TFInOut (const TFIn &) | |
TFInOut & | operator= (const TFIn &) |
Private Attributes | |
TFileId | FileId |
TFInOut::TFInOut | ( | ) | [private] |
TFInOut::TFInOut | ( | const TFIn & | ) | [private] |
TFInOut::TFInOut | ( | const TStr & | FNm, |
const TFAccess & | FAccess, | ||
const bool & | CreateIfNo | ||
) |
Definition at line 475 of file fl.cpp.
References TStr::CStr(), faAppend, faCreate, Fail, faRdOnly, faUpdate, FileId, IAssert, and SEEK_END.
: TSBase(TSStr(FNm.CStr())), FileId(NULL) { switch (FAccess){ case faCreate: FileId=fopen(FNm.CStr(), "w+b"); break; case faUpdate: FileId=fopen(FNm.CStr(), "r+b"); break; case faAppend: FileId=fopen(FNm.CStr(), "r+b"); if (FileId!=NULL){fseek(FileId, SEEK_END, 0);} break; case faRdOnly: FileId=fopen(FNm.CStr(), "rb"); break; default: Fail; } if ((FileId==NULL)&&(CreateIfNo)){FileId=fopen(FNm.CStr(), "w+b");} IAssert(FileId!=NULL); }
TFInOut::~TFInOut | ( | ) | [inline] |
void TFInOut::Clr | ( | ) | [inline, virtual] |
bool TFInOut::Eof | ( | ) | [inline, virtual] |
void TFInOut::Flush | ( | ) | [inline, virtual] |
int TFInOut::GetBf | ( | const void * | LBf, |
const TSize & | LBfL | ||
) | [virtual] |
char TFInOut::GetCh | ( | ) | [inline, virtual] |
TFileId TFInOut::GetFileId | ( | ) | const [inline, virtual] |
TStr TFInOut::GetFNm | ( | ) | const |
Definition at line 525 of file fl.cpp.
References TSBase::GetSNm().
{ return GetSNm(); }
bool TFInOut::GetNextLnBf | ( | TChA & | LnChA | ) | [virtual] |
int TFInOut::GetPos | ( | ) | const [inline, virtual] |
int TFInOut::GetSize | ( | ) | const [virtual] |
Implements TSInOut.
Definition at line 493 of file fl.cpp.
References FileId, GetPos(), IAssert, SEEK_END, and SEEK_SET.
Referenced by Len().
{ const int FPos = GetPos(); IAssert(fseek(FileId, 0, SEEK_END) == 0); const int FLen = GetPos(); IAssert(fseek(FileId, FPos, SEEK_SET) == 0); return FLen; }
int TFInOut::Len | ( | ) | const [inline, virtual] |
void TFInOut::MovePos | ( | const int & | DPos | ) | [inline, virtual] |
PSInOut TFInOut::New | ( | const TStr & | FNm, |
const TFAccess & | FAccess, | ||
const bool & | CreateIfNo | ||
) | [static] |
char TFInOut::PeekCh | ( | ) | [inline, virtual] |
int TFInOut::PutBf | ( | const void * | LBf, |
const TSize & | LBfL | ||
) | [virtual] |
Implements TSOut.
Definition at line 501 of file fl.cpp.
References FileId, and IAssert.
Referenced by PutCh().
{ int LBfS = 0; for (TSize i = 0; i < LBfL; i++) { LBfS += ((char *)LBf)[i]; } IAssert(fwrite(LBf, sizeof(char), LBfL, FileId) == (size_t) LBfL); return LBfS; }
int TFInOut::PutCh | ( | const char & | Ch | ) | [inline, virtual] |
void TFInOut::SetPos | ( | const int & | Pos | ) | [inline, virtual] |
TFileId TFInOut::FileId [private] |