27 TSsParserMP(const
TStr& FNm, const
TSsFmt _SsFmt=
ssfTabSep, const
bool& _SkipLeadBlanks=false, const
bool& _SkipCmt=true, const
bool& _SkipEmptyFld=false);
35 TSsParserMP(const
TStr& FNm, const
char& Separator, const
bool& _SkipLeadBlanks=false, const
bool& _SkipCmt=true, const
bool& _SkipEmptyFld=false);
49 int Len()
const {
return FldV.Len(); }
55 bool IsCmt()
const {
return Len()>0 && GetFld(0)[0] ==
'#'; }
57 void SkipCommentLines();
59 bool Eof()
const {
return FInPt->Eof(); }
61 TChA GetLnStr()
const {
TChA LnOut;
for (
int i = 0; i < Len(); i++) { LnOut+=GetFld(i); LnOut+=
' '; }
if (LnOut.
Len() > 0) LnOut.
DelLastCh();
return LnOut; }
66 const char*
GetFld(
const int& FldN)
const {
return FldV[FldN]; }
68 char*
GetFld(
const int& FldN) {
return FldV[FldN]; }
70 const char* operator [] (
const int& FldN)
const {
return FldV[FldN]; }
72 char* operator [] (
const int& FldN) {
return FldV[FldN]; }
74 bool GetInt(
const int& FldN,
int& Val)
const;
77 int Val=0;
IAssertR(GetInt(FldN, Val),
TStr::Fmt(
"Field %d not INT.\n%s", FldN, DumpStr()).CStr());
return Val; }
79 bool IsInt(
const int& FldN)
const {
int v;
return GetInt(FldN, v); }
81 bool GetFlt(
const int& FldN,
double& Val)
const;
83 bool IsFlt(
const int& FldN)
const {
double v;
return GetFlt(FldN, v); }
85 double GetFlt(
const int& FldN)
const {
86 double Val=0.0;
IAssert(GetFlt(FldN, Val));
return Val; }
90 return FInPt->GetBfC(); }
94 return FInPt->GetBfL(); }
98 return FInPt->SetBfC(Pos); }
110 int GetIntFromFldV(
TVec<char*>& FieldsV,
const int& FldN);
113 double GetFltFromFldV(
TVec<char*>& FieldsV,
const int& FldN);
115 const char* DumpStr()
const;
#define IAssertR(Cond, Reason)
int GetInt(const int &FldN) const
Assumes FldN is an integer its value is returned. If FldN is not an integer an exception is thrown...
#define UndefDefaultCopyAssign(TNm)
char * GetFld(const int &FldN)
Returns the contents of the field at index FldN.
uint64 GetLineNo() const
Returns the line number of the current line.
int GetFlds() const
Returns the number of fields in the current line.
int Len() const
Returns the number of fields in the current line.
uint64 GetStreamPos() const
Returns position of stream pointer.
bool IsFlt(const int &FldN) const
Checks whether fields FldN is a float.
bool IsInt(const int &FldN) const
Checks whether fields FldN is an integer.
TSsFmt
Spread-Sheet Separator Format.
#define ClassTP(TNm, PNm)
unsigned long long uint64
const char * GetFld(const int &FldN) const
Returns the contents of the field at index FldN.
bool Eof() const
Checks for end of file.
TChA GetLnStr() const
Returns the current line.
static TStr Fmt(const char *FmtStr,...)
void SetStreamPos(uint64 Pos)
Sets position of stream pointer.
bool IsCmt() const
Checks whether the current line is a comment (starts with '#').
double GetFlt(const int &FldN) const
Assumes FldN is a floating point number its value is returned. If FldN is not an integer an exception...
uint64 GetStreamLen() const
Returns length of stream.
Vector is a sequence TVal objects representing an array that can change in size.