SNAP Library 3.0, User Reference  2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TSsParserMP Class Reference

#include <ssmp.h>

Public Member Functions

 TSsParserMP (const TStr &FNm, const TSsFmt _SsFmt=ssfTabSep, const bool &_SkipLeadBlanks=false, const bool &_SkipCmt=true, const bool &_SkipEmptyFld=false)
 Constructor. More...
 
 TSsParserMP (const TStr &FNm, const char &Separator, const bool &_SkipLeadBlanks=false, const bool &_SkipCmt=true, const bool &_SkipEmptyFld=false)
 Constructor. More...
 
 ~TSsParserMP ()
 
bool Next ()
 Loads next line from the input file. More...
 
bool NextSlow ()
 Loads next line from the input file (older, slow implementation - deprecated). More...
 
int Len () const
 Returns the number of fields in the current line. More...
 
int GetFlds () const
 Returns the number of fields in the current line. More...
 
uint64 GetLineNo () const
 Returns the line number of the current line. More...
 
bool IsCmt () const
 Checks whether the current line is a comment (starts with '#'). More...
 
void SkipCommentLines ()
 Skips lines that begin with a comment character. More...
 
bool Eof () const
 Checks for end of file. More...
 
TChA GetLnStr () const
 Returns the current line. More...
 
void ToLc ()
 Transforms the current line to lower case. More...
 
const char * GetFld (const int &FldN) const
 Returns the contents of the field at index FldN. More...
 
char * GetFld (const int &FldN)
 Returns the contents of the field at index FldN. More...
 
const char * operator[] (const int &FldN) const
 Returns the contents of the field at index FldN. More...
 
char * operator[] (const int &FldN)
 Returns the contents of the field at index FldN. More...
 
bool GetInt (const int &FldN, int &Val) const
 If the field FldN is an integer its value is returned in Val and the function returns true. More...
 
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. More...
 
bool IsInt (const int &FldN) const
 Checks whether fields FldN is an integer. More...
 
bool GetFlt (const int &FldN, double &Val) const
 If the field FldN is a float its value is returned in Val and the function returns true. More...
 
bool IsFlt (const int &FldN) const
 Checks whether fields FldN is a float. More...
 
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 is thrown. More...
 
uint64 GetStreamPos () const
 Returns position of stream pointer. More...
 
uint64 GetStreamLen () const
 Returns length of stream. More...
 
void SetStreamPos (uint64 Pos)
 Sets position of stream pointer. More...
 
uint64 CountNewLinesInRange (uint64 Lb, uint64 Ub) const
 Counts number of occurences of '
' in [Lb, Ub) More...
 
TVec< uint64GetStartPosV (uint64 Lb, uint64 Ub) const
 Finds start positions of all lines ending somewhere in [Lb, Ub) More...
 
void NextFromIndex (uint64 Index, TVec< char * > &FieldsV)
 Loads next line starting from a given position. More...
 
int GetIntFromFldV (TVec< char * > &FieldsV, const int &FldN)
 Gets integer at field FldN. More...
 
double GetFltFromFldV (TVec< char * > &FieldsV, const int &FldN)
 Gets float at field FldN. More...
 
const char * DumpStr () const
 

Static Public Member Functions

static PSsParserMP New (const TStr &FNm, const TSsFmt SsFmt)
 

Private Member Functions

 UndefDefaultCopyAssign (TSsParserMP)
 

Private Attributes

TCRef CRef
 
TSsFmt SsFmt
 Separator type. More...
 
bool SkipLeadBlanks
 Ignore leading whitespace characters in a line. More...
 
bool SkipCmt
 Skip comments (lines starting with #). More...
 
bool SkipEmptyFld
 Skip empty fields (i.e., multiple consecutive separators are considered as one). More...
 
uint64 LineCnt
 Number of processed lines so far. More...
 
char SplitCh
 Separator character (if one of the non-started separators is used) More...
 
TChA LineStr
 Current line. More...
 
TVec< char * > FldV
 Pointers to fields of the current line. More...
 
TPt< TMInFInPt
 Pointer to the input file stream. More...
 

Friends

class TPt< TSsParserMP >
 

Detailed Description

Definition at line 7 of file ssmp.h.

Constructor & Destructor Documentation

TSsParserMP::TSsParserMP ( const TStr FNm,
const TSsFmt  _SsFmt = ssfTabSep,
const bool &  _SkipLeadBlanks = false,
const bool &  _SkipCmt = true,
const bool &  _SkipEmptyFld = false 
)

Constructor.

Parameters
FNmInput filename. Can be a text file or a compressed file.
_SsFmtSpread-sheet separator format. Each line will be broken in a set of fields, where the boundary between the fields is defined by the _SsFmt.
_SkipLeadBlanksIf true leading/trailing white-spaces of the line will be ignored.
_SkipCmtIf true lines starting with '#' will be considered as comments and will be skipped.
_SkipEmptyFldIf true then empty fields (consecutive occurrences of the separator) will be ignored.
TSsParserMP::TSsParserMP ( const TStr FNm,
const char &  Separator,
const bool &  _SkipLeadBlanks = false,
const bool &  _SkipCmt = true,
const bool &  _SkipEmptyFld = false 
)

Constructor.

Parameters
FNmInput filename. Can be a text file or a compressed file.
SeparatorSpread-sheet separator character. Each line will be broken in a set of fields, where the boundary between the fields is the Separator character.
_SkipLeadBlanksIf true leading/trailing white-spaces of the line will be ignored.
_SkipCmtIf true lines starting with '#' will be considered as comments and will be skipped.
_SkipEmptyFldIf true then empty fields (consecutive occurrences of the separator) will be ignored.

Definition at line 3 of file ssmp.cpp.

3  : SsFmt(ssfSpaceSep),
4  SkipLeadBlanks(_SkipLeadBlanks), SkipCmt(_SkipCmt), SkipEmptyFld(_SkipEmptyFld), LineCnt(0), /*Bf(NULL),*/ SplitCh('\t'), LineStr(), FldV(), FInPt(NULL) {
5  FInPt = TMIn::New(FNm, true);
6  SplitCh = Separator;
7 }
TChA LineStr
Current line.
Definition: ssmp.h:15
uint64 LineCnt
Number of processed lines so far.
Definition: ssmp.h:13
bool SkipLeadBlanks
Ignore leading whitespace characters in a line.
Definition: ssmp.h:10
bool SkipEmptyFld
Skip empty fields (i.e., multiple consecutive separators are considered as one).
Definition: ssmp.h:12
TPt< TMIn > FInPt
Pointer to the input file stream.
Definition: ssmp.h:17
TVec< char * > FldV
Pointers to fields of the current line.
Definition: ssmp.h:16
static PSIn New(const void *_Bf, const uint64 &_BfL, const bool &TakeBf=false)
Definition: fl.cpp:612
Space separated.
Definition: ss.h:10
bool SkipCmt
Skip comments (lines starting with #).
Definition: ssmp.h:11
char SplitCh
Separator character (if one of the non-started separators is used)
Definition: ssmp.h:14
TSsFmt SsFmt
Separator type.
Definition: ssmp.h:9
TSsParserMP::~TSsParserMP ( )

Definition at line 9 of file ssmp.cpp.

9  {
10 }

Member Function Documentation

uint64 TSsParserMP::CountNewLinesInRange ( uint64  Lb,
uint64  Ub 
) const

Counts number of occurences of '
' in [Lb, Ub)

Definition at line 102 of file ssmp.cpp.

102  {
103  return FInPt->CountNewLinesInRange(Lb, Ub);
104 }
TPt< TMIn > FInPt
Pointer to the input file stream.
Definition: ssmp.h:17
uint64 CountNewLinesInRange(uint64 Lb, uint64 Ub)
Finds number of new line chars in interval [Lb, Ub)
Definition: fl.cpp:726
const char * TSsParserMP::DumpStr ( ) const

Definition at line 91 of file ssmp.cpp.

91  {
92  static TChA ChA(10*1024);
93  ChA.Clr();
94  for (int i = 0; i < FldV.Len(); i++) {
95  ChA += TStr::Fmt(" %d: '%s'\n", i, FldV[i]);
96  }
97  return ChA.CStr();
98 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TVec< char * > FldV
Pointers to fields of the current line.
Definition: ssmp.h:16
Definition: dt.h:201
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
bool TSsParserMP::Eof ( ) const
inline

Checks for end of file.

Definition at line 59 of file ssmp.h.

59 { return FInPt->Eof(); }
TPt< TMIn > FInPt
Pointer to the input file stream.
Definition: ssmp.h:17
bool Eof()
Definition: fl.h:411
const char* TSsParserMP::GetFld ( const int &  FldN) const
inline

Returns the contents of the field at index FldN.

Definition at line 66 of file ssmp.h.

66 { return FldV[FldN]; }
TVec< char * > FldV
Pointers to fields of the current line.
Definition: ssmp.h:16
char* TSsParserMP::GetFld ( const int &  FldN)
inline

Returns the contents of the field at index FldN.

Definition at line 68 of file ssmp.h.

68 { return FldV[FldN]; }
TVec< char * > FldV
Pointers to fields of the current line.
Definition: ssmp.h:16
int TSsParserMP::GetFlds ( ) const
inline

Returns the number of fields in the current line.

Definition at line 51 of file ssmp.h.

51 { return Len(); }
int Len() const
Returns the number of fields in the current line.
Definition: ssmp.h:49
bool TSsParserMP::GetFlt ( const int &  FldN,
double &  Val 
) const

If the field FldN is a float its value is returned in Val and the function returns true.

Definition at line 69 of file ssmp.cpp.

69  {
70  // parsing format {ws} [+/-] +{d} ([.]{d}) ([E|e] [+/-] +{d})
71  const char *c = GetFld(FldN);
72  while (TCh::IsWs(*c)) { c++; }
73  if (*c=='+' || *c=='-') { c++; }
74  if (! TCh::IsNum(*c) && *c!='.') { return false; }
75  while (TCh::IsNum(*c)) { c++; }
76  if (*c == '.') {
77  c++;
78  while (TCh::IsNum(*c)) { c++; }
79  }
80  if (*c=='e' || *c == 'E') {
81  c++;
82  if (*c == '+' || *c == '-' ) { c++; }
83  if (! TCh::IsNum(*c)) { return false; }
84  while (TCh::IsNum(*c)) { c++; }
85  }
86  if (*c != 0) { return false; }
87  Val = atof(GetFld(FldN));
88  return true;
89 }
static bool IsNum(const char &Ch)
Definition: dt.h:974
static bool IsWs(const char &Ch)
Definition: dt.h:970
const char * GetFld(const int &FldN) const
Returns the contents of the field at index FldN.
Definition: ssmp.h:66
double TSsParserMP::GetFlt ( const int &  FldN) const
inline

Assumes FldN is a floating point number its value is returned. If FldN is not an integer an exception is thrown.

Definition at line 85 of file ssmp.h.

85  {
86  double Val=0.0; IAssert(GetFlt(FldN, Val)); return Val; }
#define IAssert(Cond)
Definition: bd.h:262
bool GetFlt(const int &FldN, double &Val) const
If the field FldN is a float its value is returned in Val and the function returns true...
Definition: ssmp.cpp:69
double TSsParserMP::GetFltFromFldV ( TVec< char * > &  FieldsV,
const int &  FldN 
)

Gets float at field FldN.

Definition at line 170 of file ssmp.cpp.

170  {
171  // parsing format {ws} [+/-] +{d} ([.]{d}) ([E|e] [+/-] +{d})
172  const char *c = FieldsV[FldN];
173  while (TCh::IsWs(*c)) { c++; }
174  if (*c=='+' || *c=='-') { c++; }
175  if (! TCh::IsNum(*c) && *c!='.') { return -1; }
176  while (TCh::IsNum(*c)) { c++; }
177  if (*c == '.') {
178  c++;
179  while (TCh::IsNum(*c)) { c++; }
180  }
181  if (*c=='e' || *c == 'E') {
182  c++;
183  if (*c == '+' || *c == '-' ) { c++; }
184  if (! TCh::IsNum(*c)) { return -1; }
185  while (TCh::IsNum(*c)) { c++; }
186  }
187  if (*c != 0) { return -1; }
188  return atof(FieldsV[FldN]);
189 }
static bool IsNum(const char &Ch)
Definition: dt.h:974
static bool IsWs(const char &Ch)
Definition: dt.h:970
bool TSsParserMP::GetInt ( const int &  FldN,
int &  Val 
) const

If the field FldN is an integer its value is returned in Val and the function returns true.

Definition at line 50 of file ssmp.cpp.

50  {
51  // parsing format {ws} [+/-] +{ddd}
52  int _Val = -1;
53  bool Minus=false;
54  const char *c = GetFld(FldN);
55  while (TCh::IsWs(*c)) { c++; }
56  if (*c=='-') { Minus=true; c++; }
57  if (! TCh::IsNum(*c)) { return false; }
58  _Val = TCh::GetNum(*c); c++;
59  while (TCh::IsNum(*c)){
60  _Val = 10 * _Val + TCh::GetNum(*c);
61  c++;
62  }
63  if (Minus) { _Val = -_Val; }
64  if (*c != 0) { return false; }
65  Val = _Val;
66  return true;
67 }
static bool IsNum(const char &Ch)
Definition: dt.h:974
static bool IsWs(const char &Ch)
Definition: dt.h:970
const char * GetFld(const int &FldN) const
Returns the contents of the field at index FldN.
Definition: ssmp.h:66
static int GetNum(const char &Ch)
Definition: dt.h:976
int TSsParserMP::GetInt ( const int &  FldN) const
inline

Assumes FldN is an integer its value is returned. If FldN is not an integer an exception is thrown.

Definition at line 76 of file ssmp.h.

76  {
77  int Val=0; IAssertR(GetInt(FldN, Val), TStr::Fmt("Field %d not INT.\n%s", FldN, DumpStr()).CStr()); return Val; }
#define IAssertR(Cond, Reason)
Definition: bd.h:265
const char * DumpStr() const
Definition: ssmp.cpp:91
bool GetInt(const int &FldN, int &Val) const
If the field FldN is an integer its value is returned in Val and the function returns true...
Definition: ssmp.cpp:50
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
int TSsParserMP::GetIntFromFldV ( TVec< char * > &  FieldsV,
const int &  FldN 
)

Gets integer at field FldN.

Definition at line 152 of file ssmp.cpp.

152  {
153  // parsing format {ws} [+/-] +{ddd}
154  int _Val = -1;
155  bool Minus=false;
156  const char *c = FieldsV[FldN];
157  while (TCh::IsWs(*c)) { c++; }
158  if (*c=='-') { Minus=true; c++; }
159  if (! TCh::IsNum(*c)) { return -1; }
160  _Val = TCh::GetNum(*c); c++;
161  while (TCh::IsNum(*c)){
162  _Val = 10 * _Val + TCh::GetNum(*c);
163  c++;
164  }
165  if (Minus) { _Val = -_Val; }
166  //if (*c != 0) { return -1; }
167  return _Val;
168 }
static bool IsNum(const char &Ch)
Definition: dt.h:974
static bool IsWs(const char &Ch)
Definition: dt.h:970
static int GetNum(const char &Ch)
Definition: dt.h:976
uint64 TSsParserMP::GetLineNo ( ) const
inline

Returns the line number of the current line.

Definition at line 53 of file ssmp.h.

53 { return LineCnt; }
uint64 LineCnt
Number of processed lines so far.
Definition: ssmp.h:13
TChA TSsParserMP::GetLnStr ( ) const
inline

Returns the current line.

Definition at line 61 of file ssmp.h.

61 { TChA LnOut; for (int i = 0; i < Len(); i++) { LnOut+=GetFld(i); LnOut+=' '; } if (LnOut.Len() > 0) LnOut.DelLastCh(); return LnOut; }
int Len() const
Returns the number of fields in the current line.
Definition: ssmp.h:49
int Len() const
Definition: dt.h:259
void DelLastCh()
Definition: dt.h:263
const char * GetFld(const int &FldN) const
Returns the contents of the field at index FldN.
Definition: ssmp.h:66
Definition: dt.h:201
TVec< uint64 > TSsParserMP::GetStartPosV ( uint64  Lb,
uint64  Ub 
) const

Finds start positions of all lines ending somewhere in [Lb, Ub)

Definition at line 106 of file ssmp.cpp.

106  {
107  TVec<uint64> Ret;
108  if (Lb >= GetStreamLen()) {
109  return Ret;
110  }
111  while (Lb < Ub) {
112  // Find line corresponding to Lb
113  uint64 StartPos = FInPt->GetLineStartPos(Lb);
114  uint64 EndPos = FInPt->GetLineEndPos(Lb);
115 
116  // If line ends in given range, add to count
117  if (Lb <= EndPos && EndPos < Ub) {
118  Ret.Add(StartPos);
119  }
120  // Start at next line
121  Lb = EndPos + 1;
122  }
123  return Ret;
124 }
TPt< TMIn > FInPt
Pointer to the input file stream.
Definition: ssmp.h:17
unsigned long long uint64
Definition: bd.h:38
uint64 GetLineEndPos(uint64 Ind)
Finds end of line in which Ind is present.
Definition: fl.cpp:746
uint64 GetLineStartPos(uint64 Ind)
Finds beginning of line in which Ind is present.
Definition: fl.cpp:739
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
uint64 GetStreamLen() const
Returns length of stream.
Definition: ssmp.h:93
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:429
uint64 TSsParserMP::GetStreamLen ( ) const
inline

Returns length of stream.

Definition at line 93 of file ssmp.h.

93  {
94  return FInPt->GetBfL(); }
uint64 GetBfL()
Definition: fl.cpp:717
TPt< TMIn > FInPt
Pointer to the input file stream.
Definition: ssmp.h:17
uint64 TSsParserMP::GetStreamPos ( ) const
inline

Returns position of stream pointer.

Definition at line 89 of file ssmp.h.

89  {
90  return FInPt->GetBfC(); }
TPt< TMIn > FInPt
Pointer to the input file stream.
Definition: ssmp.h:17
uint64 GetBfC()
Definition: fl.cpp:713
bool TSsParserMP::IsCmt ( ) const
inline

Checks whether the current line is a comment (starts with '#').

Definition at line 55 of file ssmp.h.

55 { return Len()>0 && GetFld(0)[0] == '#'; }
int Len() const
Returns the number of fields in the current line.
Definition: ssmp.h:49
const char * GetFld(const int &FldN) const
Returns the contents of the field at index FldN.
Definition: ssmp.h:66
bool TSsParserMP::IsFlt ( const int &  FldN) const
inline

Checks whether fields FldN is a float.

Definition at line 83 of file ssmp.h.

83 { double v; return GetFlt(FldN, v); }
bool GetFlt(const int &FldN, double &Val) const
If the field FldN is a float its value is returned in Val and the function returns true...
Definition: ssmp.cpp:69
bool TSsParserMP::IsInt ( const int &  FldN) const
inline

Checks whether fields FldN is an integer.

Definition at line 79 of file ssmp.h.

79 { int v; return GetInt(FldN, v); }
bool GetInt(const int &FldN, int &Val) const
If the field FldN is an integer its value is returned in Val and the function returns true...
Definition: ssmp.cpp:50
int TSsParserMP::Len ( ) const
inline

Returns the number of fields in the current line.

Definition at line 49 of file ssmp.h.

49 { return FldV.Len(); }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TVec< char * > FldV
Pointers to fields of the current line.
Definition: ssmp.h:16
static PSsParserMP TSsParserMP::New ( const TStr FNm,
const TSsFmt  SsFmt 
)
inlinestatic

Definition at line 37 of file ssmp.h.

37 { return new TSsParserMP(FNm, SsFmt); }
TSsParserMP(const TStr &FNm, const TSsFmt _SsFmt=ssfTabSep, const bool &_SkipLeadBlanks=false, const bool &_SkipCmt=true, const bool &_SkipEmptyFld=false)
Constructor.
TSsFmt SsFmt
Separator type.
Definition: ssmp.h:9
bool TSsParserMP::Next ( )

Loads next line from the input file.

If end of file is reached, return value is false.

Definition at line 17 of file ssmp.cpp.

17  { // split on SplitCh
18  FldV.Clr(false);
19  LineStr.Clr();
20  FldV.Clr();
21  LineCnt++;
22  if (! FInPt->GetNextLnBf(LineStr)) { return false; }
23  if (SkipCmt && !LineStr.Empty() && LineStr[0]=='#') { return Next(); }
24 
25  char* cur = LineStr.CStr();
26  if (SkipLeadBlanks) { // skip leading blanks
27  while (*cur && TCh::IsWs(*cur)) { cur++; }
28  }
29  char *last = cur;
30  while (*cur) {
31  if (SsFmt == ssfWhiteSep) { while (*cur && ! TCh::IsWs(*cur)) { cur++; } }
32  else { while (*cur && *cur!=SplitCh) { cur++; } }
33  if (*cur == 0) { break; }
34  *cur = 0; cur++;
35  FldV.Add(last); last = cur;
36  if (SkipEmptyFld && strlen(FldV.Last())==0) { FldV.DelLast(); } // skip empty fields
37  }
38  FldV.Add(last); // add last field
39  if (SkipEmptyFld && FldV.Empty()) { return Next(); } // skip empty lines
40  return true;
41 }
bool Next()
Loads next line from the input file.
Definition: ssmp.cpp:17
bool Empty() const
Definition: dt.h:260
void Clr()
Definition: dt.h:258
TChA LineStr
Current line.
Definition: ssmp.h:15
uint64 LineCnt
Number of processed lines so far.
Definition: ssmp.h:13
bool SkipLeadBlanks
Ignore leading whitespace characters in a line.
Definition: ssmp.h:10
bool SkipEmptyFld
Skip empty fields (i.e., multiple consecutive separators are considered as one).
Definition: ssmp.h:12
bool GetNextLnBf(TChA &LnChA)
Definition: fl.cpp:707
bool Empty() const
Tests whether the vector is empty.
Definition: ds.h:542
static bool IsWs(const char &Ch)
Definition: dt.h:970
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:971
char * CStr()
Definition: dt.h:255
TPt< TMIn > FInPt
Pointer to the input file stream.
Definition: ssmp.h:17
TVec< char * > FldV
Pointers to fields of the current line.
Definition: ssmp.h:16
Whitespace (space or tab) separated.
Definition: ss.h:11
const TVal & Last() const
Returns a reference to the last element of the vector.
Definition: ds.h:551
bool SkipCmt
Skip comments (lines starting with #).
Definition: ssmp.h:11
char SplitCh
Separator character (if one of the non-started separators is used)
Definition: ssmp.h:14
TSsFmt SsFmt
Separator type.
Definition: ssmp.h:9
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void DelLast()
Removes the last element of the vector.
Definition: ds.h:635
void TSsParserMP::NextFromIndex ( uint64  Index,
TVec< char * > &  FieldsV 
)

Loads next line starting from a given position.

Definition at line 128 of file ssmp.cpp.

129 {
130  // split on SplitCh
131  FieldsV.Clr();
132 
133  char* cur = FInPt->GetLine(Index);
134 
135  if (SkipLeadBlanks) { // skip leading blanks
136  while (*cur && TCh::IsWs(*cur)) { cur++; }
137  }
138  char *last = cur;
139  while (*cur != 0 && *cur != '\n') {
140  if (SsFmt == ssfWhiteSep) { while (*cur && (*cur != '\n') && ! TCh::IsWs(*cur)) { cur++; } }
141  else { while (*cur && *cur!=SplitCh && (*cur != '\n')) { cur++; } }
142  if (*cur == 0) { break; }
143  if (*cur == '\n') { break; }
144  //*cur = 0;
145  cur++;
146  FieldsV.Add(last); last = cur;
147  if (SkipEmptyFld && strlen(FieldsV.Last())==0) { FieldsV.DelLast(); } // skip empty fields
148  }
149  FieldsV.Add(last); // add last field
150 }
bool SkipLeadBlanks
Ignore leading whitespace characters in a line.
Definition: ssmp.h:10
bool SkipEmptyFld
Skip empty fields (i.e., multiple consecutive separators are considered as one).
Definition: ssmp.h:12
static bool IsWs(const char &Ch)
Definition: dt.h:970
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:971
TPt< TMIn > FInPt
Pointer to the input file stream.
Definition: ssmp.h:17
Whitespace (space or tab) separated.
Definition: ss.h:11
const TVal & Last() const
Returns a reference to the last element of the vector.
Definition: ds.h:551
char * GetLine(uint64 Ind)
Definition: fl.cpp:754
char SplitCh
Separator character (if one of the non-started separators is used)
Definition: ssmp.h:14
TSsFmt SsFmt
Separator type.
Definition: ssmp.h:9
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:574
void DelLast()
Removes the last element of the vector.
Definition: ds.h:635
bool TSsParserMP::NextSlow ( )

Loads next line from the input file (older, slow implementation - deprecated).

If end of file is reached, return value is false. This function is deprecated, use Next instead.

const char* TSsParserMP::operator[] ( const int &  FldN) const
inline

Returns the contents of the field at index FldN.

Definition at line 70 of file ssmp.h.

70 { return FldV[FldN]; }
TVec< char * > FldV
Pointers to fields of the current line.
Definition: ssmp.h:16
char* TSsParserMP::operator[] ( const int &  FldN)
inline

Returns the contents of the field at index FldN.

Definition at line 72 of file ssmp.h.

72 { return FldV[FldN]; }
TVec< char * > FldV
Pointers to fields of the current line.
Definition: ssmp.h:16
void TSsParserMP::SetStreamPos ( uint64  Pos)
inline

Sets position of stream pointer.

Definition at line 97 of file ssmp.h.

97  {
98  return FInPt->SetBfC(Pos); }
TPt< TMIn > FInPt
Pointer to the input file stream.
Definition: ssmp.h:17
void SetBfC(uint64 Pos)
Definition: fl.cpp:721
void TSsParserMP::SkipCommentLines ( )

Skips lines that begin with a comment character.

Definition at line 12 of file ssmp.cpp.

12  {
14 }
void SkipCommentLines()
Move stream pointer along until a non commented line is found.
Definition: fl.cpp:758
TPt< TMIn > FInPt
Pointer to the input file stream.
Definition: ssmp.h:17
void TSsParserMP::ToLc ( )

Transforms the current line to lower case.

Definition at line 43 of file ssmp.cpp.

43  {
44  for (int f = 0; f < FldV.Len(); f++) {
45  for (char *c = FldV[f]; *c; c++) {
46  *c = tolower(*c); }
47  }
48 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:547
TVec< char * > FldV
Pointers to fields of the current line.
Definition: ssmp.h:16
TSsParserMP::UndefDefaultCopyAssign ( TSsParserMP  )
private

Friends And Related Function Documentation

friend class TPt< TSsParserMP >
friend

Definition at line 7 of file ssmp.h.

Member Data Documentation

TCRef TSsParserMP::CRef
private

Definition at line 7 of file ssmp.h.

TPt<TMIn> TSsParserMP::FInPt
private

Pointer to the input file stream.

Definition at line 17 of file ssmp.h.

TVec<char*> TSsParserMP::FldV
private

Pointers to fields of the current line.

Definition at line 16 of file ssmp.h.

uint64 TSsParserMP::LineCnt
private

Number of processed lines so far.

Definition at line 13 of file ssmp.h.

TChA TSsParserMP::LineStr
private

Current line.

Definition at line 15 of file ssmp.h.

bool TSsParserMP::SkipCmt
private

Skip comments (lines starting with #).

Definition at line 11 of file ssmp.h.

bool TSsParserMP::SkipEmptyFld
private

Skip empty fields (i.e., multiple consecutive separators are considered as one).

Definition at line 12 of file ssmp.h.

bool TSsParserMP::SkipLeadBlanks
private

Ignore leading whitespace characters in a line.

Definition at line 10 of file ssmp.h.

char TSsParserMP::SplitCh
private

Separator character (if one of the non-started separators is used)

Definition at line 14 of file ssmp.h.

TSsFmt TSsParserMP::SsFmt
private

Separator type.

Definition at line 9 of file ssmp.h.


The documentation for this class was generated from the following files: