70 virtual int Len()
const=0;
71 virtual char GetCh()=0;
73 virtual int GetBf(
const void* Bf,
const TSize& BfL)=0;
83 void* Bf=(
void*)
new char[BfL];
Cs+=
GetBf(Bf, BfL);
return Bf;}
96 void Load(
char*& CStr,
const int& MxCStrLen,
const int& CStrLen){
97 CStr=
new char[MxCStrLen+1];
Cs+=
GetBf(CStr, CStrLen+1);}
98 void Load(
char*& CStr);
123 Val.
Load(SIn);
return SIn;
131 int UpdateLnLen(
const int& StrLen,
const bool& ForceInLn=
false);
143 virtual int PutCh(
const char& Ch)=0;
144 virtual int PutBf(
const void* LBf,
const TSize& LBfL)=0;
145 virtual void Flush()=0;
149 int PutCh(
const char& Ch,
const int& Chs);
151 int PutInt(
const int& Int);
152 int PutInt(
const int& Int,
const char* FmtStr);
155 int PutFlt(
const double& Flt);
156 int PutFlt(
const double& Flt,
const char* FmtStr);
157 int PutStr(
const char* CStr);
159 int PutStr(
const TStr& Str,
const char* FmtStr);
160 int PutStr(
const TStr& Str,
const bool& ForceInLn=
false);
166 int PutLn(
const int& Lns=1);
168 int PutSep(
const int& NextStrLen=0);
186 void Save(
const char* CStr);
215 Val.
Save(SOut);
return SOut;
228 virtual void SetPos(
const int& Pos)=0;
229 virtual void MovePos(
const int& DPos)=0;
230 virtual int GetPos()
const=0;
232 virtual void Clr()=0;
248 bool Eof(){
return feof(stdin)!=0;}
249 int Len()
const {
return -1;}
250 char GetCh(){
return char(getchar());}
252 int Ch=getchar(); ungetc(Ch, stdin);
return char(Ch);}
253 int GetBf(
const void* LBf,
const TSize& LBfL);
268 int PutCh(
const char& Ch){putchar(Ch);
return Ch;}
269 int PutBf(
const void *LBf,
const TSize& LBfL);
282 void SetFPos(
const int& FPos)
const;
286 int FindEol(
int& BfN,
bool& CrEnd);
293 TFIn(
const TStr& FNm,
bool& OpenedP);
304 else {
return Bf[
BfC++];}}
307 else {
return Bf[
BfC];}}
308 int GetBf(
const void* LBf,
const TSize& LBfL);
332 TFOut(
const TStr& _FNm,
const bool& Append=
false);
333 TFOut(
const TStr& _FNm,
const bool& Append,
bool& OpenedP);
334 static PSOut
New(
const TStr& FNm,
const bool& Append=
false);
335 static PSOut
New(
const TStr& FNm,
const bool& Append,
bool& OpenedP);
338 int PutCh(
const char& Ch);
339 int PutBf(
const void* LBf,
const TSize& LBfL);
358 static PSInOut
New(
const TStr& FNm,
const TFAccess& FAccess,
const bool& CreateIfNo);
368 int GetBf(
const void* LBf,
const TSize& LBfL);
378 int PutBf(
const void* LBf,
const TSize& LBfL);
406 return ((
char*)
Cursor)[0];
410 GetBf(&TestCs,
sizeof(TestCs));
421 memcpy(Dest,
Cursor, ElemSize);
426 char* TempCursor =
Cursor;
449 TMIn(
const void* _Bf,
const uint64& _BfL,
const bool& TakeBf=
false);
451 TMIn(
const char* CStr);
453 TMIn(
const TStr& Str,
bool FromFile);
455 static PSIn New(
const void* _Bf,
const uint64& _BfL,
const bool& TakeBf=
false);
456 static PSIn New(
const char* CStr);
468 int GetBf(
const void* LBf,
const TSize& LBfL);
500 void Resize(
const int& ReqLen = -1);
505 TMOut(
const int& _MxBfL=1024);
508 TMOut(
char* _Bf,
const int& _MxBfL);
513 int PutBf(
const void* LBf,
const TSize& LBfL);
522 void CutBf(
const int& CutBfL);
523 PSIn GetSIn(
const bool& IsCut=
true,
const int& CutBfL=-1);
579 TFRnd& operator=(const TFRnd&);
582 const
bool& CreateIfNo=true, const
int& _HdLen=-1, const
int& _RecLen=-1);
584 const
TFAccess& FAccess, const
bool& CreateIfNo=true,
585 const
int& HdLen=-1, const
int& RecLen=-1){
586 return new TFRnd(FNm, FAccess, CreateIfNo, HdLen, RecLen);}
591 HdLen=_HdLen; RecLen=_RecLen; RecAct=(HdLen>=0)&&(RecLen>0);}
593 void SetFPos(
const int& FPos);
594 void MoveFPos(
const int& DFPos);
598 bool Eof(){
return GetFPos()==GetFLen();}
600 void SetRecN(
const int& RecN);
604 void GetBf(
void* Bf,
const TSize& BfL);
605 void PutBf(
const void* Bf,
const TSize& BfL);
609 int FPos=GetFPos(); SetFPos(0); GetBf(Hd, HdLen); SetFPos(FPos);}
611 int FPos=GetFPos(); SetFPos(0); PutBf(Hd, HdLen); SetFPos(FPos);}
612 void GetRec(
void* Rec,
const int& RecN=-1){
613 IAssert(RecAct);
if (RecN!=-1){SetRecN(RecN);} GetBf(Rec, RecLen);}
614 void PutRec(
const void* Rec,
const int& RecN=-1){
615 IAssert(RecAct);
if (RecN!=-1){SetRecN(RecN);} PutBf(Rec, RecLen);}
619 void PutCh(
const char& Ch){PutBf(&Ch,
sizeof(Ch));}
620 void PutCh(
const char& Ch,
const int& Chs);
621 char GetCh(){
char Ch; GetBf(&Ch,
sizeof(Ch));
return Ch;}
624 void PutInt(
const int& Int){PutBf(&Int,
sizeof(Int));}
625 int GetInt(){
int Int; GetBf(&Int,
sizeof(Int));
return Int;}
628 void PutStr(
const TStr& Str);
629 TStr GetStr(
const int& StrLen);
630 TStr GetStr(
const int& MxStrLen,
bool& IsOk);
631 void PutSIn(
const PSIn& SIn,
TCs& Cs);
632 PSIn GetSIn(
const int& SInLen,
TCs& Cs);
649 static void Copy(
const TStr& SrcFNm,
const TStr& DstFNm,
650 const bool& ThrowExceptP=
true,
const bool& FailIfExistsP=
false);
651 static void Del(
const TStr& FNm,
const bool& ThrowExceptP=
true);
652 static void DelWc(
const TStr& WcStr,
const bool& RecurseDirP=
false);
int PutMem(const TMem &Mem)
void Save(const uint &UInt)
TCs & operator+=(const TCs &Cs)
int GetBf(const void *LBf, const TSize &LBfL)
static PSOut New(const TStr &FNm, const bool &Append=false)
TSIn & operator>>(bool &Bool)
TFInOut & operator=(const TFIn &)
int PutStrFmtLn(const char *FmtStr,...)
int GetBf(const void *LBf, const TSize &LBfL)
TSIn & operator>>(double &Double)
virtual TSOut & operator()(TSOut &SOut) const =0
virtual int PutCh(const char &Ch)=0
virtual int PutBf(const void *LBf, const TSize &LBfL)=0
static void Rename(const TStr &SrcFNm, const TStr &DstFNm)
static bool Exists(const TStr &FNm)
TSOut & operator<<(const short &Sh)
TSOut & operator<<(TSOut &SOut, const T &Val)
static const TStr GifFExt
void Save(const char *CStr, const TSize &CStrLen)
int PutCh(const char &Ch)
void AppendBf(const void *LBf, const TSize &LBfL)
void LoadAndAdvance(void *Dest, TSize ElemSize)
Copy memory into the destination and advance the cursor.
PSIn GetSIn(const bool &IsCut=true, const int &CutBfL=-1)
int PutBf(const void *LBf, const TSize &LBfL)
TSOut & operator<<(const uint64 &UInt)
void PutInt(const int &Int)
int FindEol(int &BfN, bool &CrEnd)
char * AdvanceCursor(TSize N)
Return the current pointer and advance the cursor.
int PutCh(const char &Ch)
void Save(const void *Bf, const TSize &BfL)
TSIn & operator>>(float &Flt)
TSIn & operator>>(TSIn &SIn, T &Val)
TSIn & operator>>(uint &UInt)
TSOut & operator<<(const int64 &Int)
void PutRec(const void *Rec, const int &RecN=-1)
void CutBf(const int &CutBfL)
TSOut & operator<<(const char &Ch)
void Load(char *&CStr, const int &MxCStrLen, const int &CStrLen)
UndefDefaultCopyAssign(TLnRet)
int PutBf(const void *LBf, const TSize &LBfL)
virtual int GetBf(const void *Bf, const TSize &BfL)=0
static const TStr HtmlFExt
int PutCh(const char &Ch)
static TPt< TSOut > New()
TSOut & operator<<(const double &Double)
int PutBf(const void *LBf, const TSize &LBfL)
void Save(const int64 &Int)
bool GetNextLnBf(TChA &LnChA)
void PutUInt(const uint &UInt)
TSOut & operator<<(const ushort &USh)
int PutSepLn(const int &Lns=0)
int PutLn(const int &Lns=1)
static PSOut New(const int &MxBfL=1024)
TSIn & operator>>(uint64 &UInt)
bool GetNextLnBf(TChA &LnChA)
virtual void SetPos(const int &Pos)=0
int UpdateLnLen(const int &StrLen, const bool &ForceInLn=false)
void SetFastMode(const bool &_FastMode)
#define ClassTP(TNm, PNm)
void PutCs(const TCs &Cs)
static uint64 GetSize(const TStr &FNm)
TFOut & operator=(const TFOut &)
static PSIn New(const TStr &FNm)
void SkipCommentLines()
Move stream pointer along until a non commented line is found.
int GetBf(const void *LBf, const TSize &LBfL)
TMOut & operator=(const TMOut &)
TCs & operator=(const TCs &Cs)
void PutHd(const void *Hd)
static const TStr TxtFExt
static TCs GetCsFromBf(char *Bf, const int &BfL)
static void DelWc(const TStr &WcStr, const bool &RecurseDirP=false)
static TStr GetUniqueFNm(const TStr &FNm)
bool GetNextLnBf(TChA &LnChA)
virtual TFileId GetFileId() const
static const TStr HtmFExt
TFIn & operator=(const TFIn &)
unsigned long long uint64
int GetBf(const void *LBf, const TSize &LBfL)
TSOut & operator=(const TSOut &)
void Save(const uint64 &UInt)
void * LoadNewBf(const int &BfL)
void Save(const double &Flt)
TCs & operator+=(const char &Ch)
int PutBool(const bool &Bool)
TCs & operator+=(const int &Int)
void Save(const PSIn &SIn, const TSize &BfL=-1)
static void Copy(const TStr &SrcFNm, const TStr &DstFNm, const bool &ThrowExceptP=true, const bool &FailIfExistsP=false)
static void Del(const TStr &FNm, const bool &ThrowExceptP=true)
uint64 CountNewLinesInRange(uint64 Lb, uint64 Ub)
Finds number of new line chars in interval [Lb, Ub)
int PutBf(const void *LBf, const TSize &LBfL)
int PutSep(const int &NextStrLen=0)
void SetHdRecLen(const int &_HdLen, const int &_RecLen)
int PutInt(const int &Int)
TSIn & operator>>(short &Sh)
TSOut & operator<<(TSOut &(*FuncPt)(TSOut &))
TSOut & operator<<(const long double &LDouble)
TSIn & operator=(const TSIn &)
void MovePos(const int &DPos)
void SaveBf(const void *Bf, const TSize &BfL)
void PutCh(const char &Ch)
static const TPt< TSOut > StdOut
int FindEol(uint64 &BfN, bool &CrEnd)
TChRet(const PSIn &_SIn, const char &_EofCh=0)
int PutIndent(const int &IndentLev=1)
static PSIn New(const void *_Bf, const uint64 &_BfL, const bool &TakeBf=false)
void Save(const uchar &UCh)
int PutFlt(const double &Flt)
void Save(const bool &Bool)
void Save(const ushort &UShort)
bool GetNextLnBf(TChA &LnChA)
TFileId GetFileId() const
static PSInOut New(const TStr &FNm, const TFAccess &FAccess, const bool &CreateIfNo)
uint64 GetLineEndPos(uint64 Ind)
Finds end of line in which Ind is present.
TSIn & operator>>(int &Int)
TSInOut & operator=(const TSInOut &)
TFileId GetFileId() const
TSOut & operator<<(const uint &Int)
uint64 GetLineStartPos(uint64 Ind)
Finds beginning of line in which Ind is present.
TSOut & operator<<(const TSOutMnp &Mnp)
int PutDosLn(const int &Lns=1)
void GetRec(void *Rec, const int &RecN=-1)
void Save(const short &Short)
virtual void MovePos(const int &DPos)=0
char * GetLine(uint64 Ind)
static const TPt< TSIn > StdIn
TStdOut & operator=(const TStdOut &)
void Save(const ldouble &LFlt)
int GetBf(const void *LBf, const TSize &LBfL)
void Save(const sdouble &SFlt)
void Load(ushort &UShort)
int PutStr(const char *CStr)
TMIn & operator=(const TMIn &)
void LoadBf(const void *Bf, const TSize &BfL)
virtual int GetSize() const =0
TSIn & operator>>(long double &LDouble)
virtual TStr GetSNm() const
TStdIn & operator=(const TStdIn &)
TSOut & operator<<(PSIn &SIn)
int PutCh(const char &Ch)
void SetPos(const int &Pos)
TChRet & operator=(const TChRet &)
TSIn & operator>>(char &Ch)
virtual int GetPos() const =0
static uint64 GetLastWriteTm(const TStr &FNm)
static uint64 GetCreateTm(const TStr &FNm)
TSOut & operator<<(const float &Flt)
void Resize(const int &ReqLen=-1)
void Save(const char &Ch)
char GetCh(const int &ChN) const
void CloseMapping()
munmap the mapping. Note that munmap is not called by the destructor
virtual bool GetNextLnBf(TChA &LnChA)=0
virtual int Len() const =0
int PutStrLn(const TStr &Str, const bool &ForceInLn=false)
int PutStrFmt(const char *FmtStr,...)
bool operator==(const TCs &Cs) const
void EnableLnTrunc(const int &_MxLnLen)
TSOut & operator<<(const bool &Bool)
int PutUInt(const uint &Int)
void PutUCh(const uchar &UCh)
bool GetNextLnBf(TChA &LnChA)
TStr GetEolnLn(const bool &DoAddEoln, const bool &DoCutBf)
void Save(const int &Int)
TSOut & operator<<(const int &Int)
TSIn & operator>>(int64 &Int)
void SetFPos(const int &FPos) const
TSIn & operator>>(uchar &UCh)
TSOut & operator<<(const uchar &UCh)
static const TStr JarFExt
bool GetNextLn(TStr &LnStr)
static uint64 GetLastAccessTm(const TStr &FNm)
TSIn & operator>>(ushort &USh)