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
|
#include <ss.h>
Public Member Functions | |
TSsParser (const TStr &FNm, const TSsFmt _SsFmt=ssfTabSep, const bool &_SkipLeadBlanks=false, const bool &_SkipCmt=true, const bool &_SkipEmptyFld=false) | |
Constructor. More... | |
TSsParser (const TStr &FNm, const char &Separator, const bool &_SkipLeadBlanks=false, const bool &_SkipCmt=true, const bool &_SkipEmptyFld=false) | |
Constructor. More... | |
~TSsParser () | |
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... | |
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... | |
bool | GetUInt64 (const int &FldN, uint64 &Val) const |
If the field FldN is a 64-bit unsigned integer its value is returned in Val and the function returns true . More... | |
bool | IsUInt64 (const int &FldN) const |
Checks whether fields FldN is unsigned 64-bit integer number. More... | |
uint64 | GetUInt64 (const int &FldN) const |
Assumes FldN is a 64-bit unsigned integer point number its value is returned. If FldN is not a 64-bit unsigned integer an exception is thrown. More... | |
const char * | DumpStr () const |
Static Public Member Functions | |
static PSsParser | New (const TStr &FNm, const TSsFmt SsFmt) |
Private Member Functions | |
UndefDefaultCopyAssign (TSsParser) | |
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... | |
PSIn | FInPt |
Pointer to the input file stream. More... | |
Friends | |
class | TPt< TSsParser > |
TSsParser::TSsParser | ( | const TStr & | FNm, |
const TSsFmt | _SsFmt = ssfTabSep , |
||
const bool & | _SkipLeadBlanks = false , |
||
const bool & | _SkipCmt = true , |
||
const bool & | _SkipEmptyFld = false |
||
) |
Constructor.
FNm | Input filename. Can be a text file or a compressed file. |
_SsFmt | Spread-sheet separator format. Each line will be broken in a set of fields, where the boundary between the fields is defined by the _SsFmt . |
_SkipLeadBlanks | If true leading/trailing white-spaces of the line will be ignored. |
_SkipCmt | If true lines starting with '#' will be considered as comments and will be skipped. |
_SkipEmptyFld | If true then empty fields (consecutive occurrences of the separator) will be ignored. |
Definition at line 351 of file ss.cpp.
TSsParser::TSsParser | ( | const TStr & | FNm, |
const char & | Separator, | ||
const bool & | _SkipLeadBlanks = false , |
||
const bool & | _SkipCmt = true , |
||
const bool & | _SkipEmptyFld = false |
||
) |
Constructor.
FNm | Input filename. Can be a text file or a compressed file. |
Separator | Spread-sheet separator character. Each line will be broken in a set of fields, where the boundary between the fields is the Separator character. |
_SkipLeadBlanks | If true leading/trailing white-spaces of the line will be ignored. |
_SkipCmt | If true lines starting with '#' will be considered as comments and will be skipped. |
_SkipEmptyFld | If true then empty fields (consecutive occurrences of the separator) will be ignored. |
Definition at line 367 of file ss.cpp.
TSsParser::~TSsParser | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
bool TSsParser::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
.
|
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 150 of file ss.h.
bool TSsParser::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
.
|
inline |
Assumes FldN
is an integer its value is returned. If FldN
is not an integer an exception is thrown.
Definition at line 140 of file ss.h.
|
inline |
|
inline |
Returns the current line.
Definition at line 124 of file ss.h.
bool TSsParser::GetUInt64 | ( | const int & | FldN, |
uint64 & | Val | ||
) | const |
If the field FldN
is a 64-bit unsigned integer its value is returned in Val
and the function returns true
.
|
inline |
Assumes FldN
is a 64-bit unsigned integer point number its value is returned. If FldN
is not a 64-bit unsigned integer an exception is thrown.
Definition at line 157 of file ss.h.
|
inline |
Checks whether the current line is a comment (starts with '#').
|
inline |
Checks whether fields FldN
is a float.
Definition at line 148 of file ss.h.
|
inline |
Checks whether fields FldN
is an integer.
Definition at line 143 of file ss.h.
|
inline |
Checks whether fields FldN
is unsigned 64-bit integer number.
Definition at line 155 of file ss.h.
|
inline |
Returns the number of fields in the current line.
Definition at line 102 of file ss.h.
bool TSsParser::Next | ( | ) |
Loads next line from the input file.
If end of file is reached, return value is false
.
Definition at line 412 of file ss.cpp.
bool TSsParser::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.
Definition at line 382 of file ss.cpp.
|
inline |
|
inline |
void TSsParser::ToLc | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |