|
SNAP Library, User Reference
2012-10-15 15:06:59
SNAP, a general purpose network analysis and graph mining library
|
Go to the source code of this file.
Enumerations | |
| enum | TSsFmt { ssfUndef, ssfTabSep, ssfCommaSep, ssfSemicolonSep, ssfVBar, ssfSpaceSep, ssfWhiteSep, ssfMx } |
Functions | |
| TSs () | |
| static PSs | New () |
| ~TSs () | |
| TSs (TSIn &SIn) | |
| static PSs | Load (TSIn &SIn) |
| void | Save (TSOut &SOut) |
| TSs & | operator= (const TSs &Ss) |
| TStr & | At (const int &X, const int &Y) |
| void | PutVal (const int &X, const int &Y, const TStr &Str) |
| TStr | GetVal (const int &X, const int &Y) const |
| int | GetXLen () const |
| int | GetXLen (const int &Y) const |
| int | GetYLen () const |
| void | DelX (const int &X) |
| void | DelY (const int &Y) |
| int | SearchX (const int &Y, const TStr &Str) const |
| int | SearchY (const int &X, const TStr &Str) const |
| int | GetFlds () const |
| int | GetFldX (const TStr &FldNm, const TStr &NewFldNm="", const int &Y=0) const |
| int | GetFldY (const TStr &FldNm, const TStr &NewFldNm="", const int &X=0) const |
| TStr | GetFldNm (const int &FldX) const |
| static PSs | LoadTxt (const TSsFmt &SsFmt, const TStr &FNm, const PNotify &Notify=NULL, const bool &IsExcelEoln=true, const int &MxY=-1, const TIntV &AllowedColNV=TIntV(), const bool &IsQStr=true) |
| void | SaveTxt (const TStr &FNm, const PNotify &Notify=NULL) const |
| static void | LoadTxtFldV (const TSsFmt &SsFmt, const PSIn &SIn, char &Ch, TStrV &FldValV, const bool &IsExcelEoln=true, const bool &IsQStr=true) |
| static TSsFmt | GetSsFmtFromStr (const TStr &SsFmtNm) |
| static TStr | GetStrFromSsFmt (const TSsFmt &SsFmt) |
| static TStr | GetSsFmtNmVStr () |
| UndefDefaultCopyAssign (TSsParser) | |
| TSsParser (const TStr &FNm, const TSsFmt _SsFmt=ssfTabSep, const bool &_SkipLeadBlanks=false, const bool &_SkipCmt=true, const bool &_SkipEmptyFld=false) | |
| TSsParser (const TStr &FNm, const char &Separator, const bool &_SkipLeadBlanks=false, const bool &_SkipCmt=true, const bool &_SkipEmptyFld=false) | |
| ~TSsParser () | |
| static PSsParser | New (const TStr &FNm, const TSsFmt SsFmt) |
| bool | Next () |
| int | Len () const |
| uint64 | GetLineNo () const |
| bool | IsCmt () const |
| bool | Eof () const |
| const TChA & | GetLnStr () const |
| void | ToLc () |
| const char * | GetFld (const int &FldN) const |
| const char * | operator[] (const int &FldN) const |
| bool | GetInt (const int &FldN, int &Val) const |
| int | GetInt (const int &FldN) const |
| bool | IsInt (const int &FldN) const |
| bool | GetFlt (const int &FldN, double &Val) const |
| bool | IsFlt (const int &FldN) const |
| double | GetFlt (const int &FldN) const |
| const char * | DumpStr () const |
Variables | |
| ClassTP(TSsParser, PSsParser) private bool | SkipLeadBlanks |
| ClassTP(TSsParser, PSsParser) private bool | SkipCmt |
| ClassTP(TSsParser, PSsParser) private bool | SkipEmptyFld |
| uint64 | LineCnt |
| char | SplitCh |
| TChA | LineStr |
| TVec< char * > | FldV |
| PSIn | FInPt |
| enum TSsFmt |
| void DelX | ( | const int & | X | ) |
| void DelY | ( | const int & | Y | ) |
| const char * TSsParser::DumpStr | ( | ) | const |
| int TSs::GetFldX | ( | const TStr & | FldNm, |
| const TStr & | NewFldNm = "", |
||
| const int & | Y = 0 |
||
| ) | const |
| int TSs::GetFldY | ( | const TStr & | FldNm, |
| const TStr & | NewFldNm = "", |
||
| const int & | X = 0 |
||
| ) | const |
| bool GetFlt | ( | const int & | FldN, |
| double & | Val | ||
| ) | const |
| double GetFlt | ( | const int & | FldN | ) | const |
| bool GetInt | ( | const int & | FldN, |
| int & | Val | ||
| ) | const |
| int GetInt | ( | const int & | FldN | ) | const |
| TSsFmt TSs::GetSsFmtFromStr | ( | const TStr & | SsFmtNm | ) | [static] |
Definition at line 315 of file ss.cpp.
{
TStr LcSsFmtNm=SsFmtNm.GetLc();
if (LcSsFmtNm=="tab"){return ssfTabSep;}
else if (LcSsFmtNm=="comma"){return ssfCommaSep;}
else if (LcSsFmtNm=="semicolon"){return ssfSemicolonSep;}
else if (LcSsFmtNm=="vbar"){return ssfVBar;}
else if (LcSsFmtNm=="space"){return ssfSpaceSep;}
else if (LcSsFmtNm=="white"){return ssfWhiteSep;}
else {return ssfUndef;}
}
| TStr TSs::GetSsFmtNmVStr | ( | ) | [static] |
| TStr TSs::GetStrFromSsFmt | ( | const TSsFmt & | SsFmt | ) | [static] |
Definition at line 326 of file ss.cpp.
{
switch (SsFmt){
case ssfTabSep: return "tab";
case ssfCommaSep: return "comma";
case ssfSemicolonSep: return "semicolon";
case ssfVBar: return "vbar";
case ssfSpaceSep: return "space";
case ssfWhiteSep: return "white";
default: return "undef";
}
}
Definition at line 157 of file url.h.
{
return KeyNmToValH.GetDat(KeyNmV[KeyN])[ValN];}
| int GetXLen | ( | ) | const |
| int GetXLen | ( | const int & | Y | ) | const |
| int GetYLen | ( | ) | const |
| bool IsFlt | ( | const int & | FldN | ) | const |
| bool IsInt | ( | const int & | FldN | ) | const |
| static PSs LoadTxt | ( | const TSsFmt & | SsFmt, |
| const TStr & | FNm, | ||
| const PNotify & | Notify = NULL, |
||
| const bool & | IsExcelEoln = true, |
||
| const int & | MxY = -1, |
||
| const TIntV & | AllowedColNV = TIntV(), |
||
| const bool & | IsQStr = true |
||
| ) | [static] |
| void TSs::LoadTxtFldV | ( | const TSsFmt & | SsFmt, |
| const PSIn & | SIn, | ||
| char & | Ch, | ||
| TStrV & | FldValV, | ||
| const bool & | IsExcelEoln = true, |
||
| const bool & | IsQStr = true |
||
| ) | [static] |
Definition at line 228 of file ss.cpp.
{
if (!SIn->Eof()){
FldValV.Clr(false); int X=0;
if (Ch==TCh::NullCh){Ch=SIn->GetCh();}
TChA ChA;
while (!SIn->Eof()){
// compose value
ChA.Clr();
if (IsQStr&&(Ch=='"')){
// quoted string ('""' sequence means '"')
Ch=SIn->GetCh();
forever {
while ((!SIn->Eof())&&(Ch!='"')){
ChA+=Ch; Ch=SIn->GetCh();}
if (Ch=='"'){
Ch=SIn->GetCh();
if (Ch=='"'){ChA+=Ch; Ch=SIn->GetCh();}
else {break;}
}
}
} else {
if (SsFmt==ssfTabSep){
while ((!SIn->Eof())&&(Ch!='\t')&&(Ch!='\r')&&
((Ch!='\n')||IsExcelEoln)){
ChA+=Ch; Ch=SIn->GetCh();
}
if ((!ChA.Empty())&&(ChA.LastCh()=='\"')){
ChA.Pop();}
} else
if (SsFmt==ssfCommaSep){
while ((!SIn->Eof())&&(Ch!=',')&&(Ch!='\r')&&
((Ch!='\n')||IsExcelEoln)){
ChA+=Ch; Ch=SIn->GetCh();
}
} else
if (SsFmt==ssfSemicolonSep){
while ((!SIn->Eof())&&(Ch!=';')&&(Ch!='\r')&&
((Ch!='\n')||IsExcelEoln)){
ChA+=Ch; Ch=SIn->GetCh();
}
} else
if (SsFmt==ssfVBar){
while ((!SIn->Eof())&&(Ch!='|')&&(Ch!='\r')&&
((Ch!='\n')||IsExcelEoln)){
ChA+=Ch; Ch=SIn->GetCh();
}
} else {
Fail;
}
}
// add value to spreadsheet
ChA.Trunc();
FldValV.Add(ChA);
// process delimiters
if (SIn->Eof()){
break;
} else
if ((SsFmt==ssfTabSep)&&(Ch=='\t')){
X++; Ch=SIn->GetCh();
} else
if ((SsFmt==ssfCommaSep)&&(Ch==',')){
X++; Ch=SIn->GetCh();
} else
if ((SsFmt==ssfSemicolonSep)&&(Ch==';')){
X++; Ch=SIn->GetCh();
} else
if ((SsFmt==ssfVBar)&&(Ch=='|')){
X++; Ch=SIn->GetCh();
} else
if (Ch=='\r'){
Ch=SIn->GetCh();
if ((Ch=='\n')&&(!SIn->Eof())){Ch=SIn->GetCh();}
break;
} else
if (Ch=='\n'){
X=0; Ch=SIn->GetCh();
if ((Ch=='\r')&&(!SIn->Eof())){Ch=SIn->GetCh();}
break;
} else {
Fail;
}
}
}
}
| const char* operator[] | ( | const int & | FldN | ) | const |
| int TSs::SearchX | ( | const int & | Y, |
| const TStr & | Str | ||
| ) | const |
| int TSs::SearchY | ( | const int & | X, |
| const TStr & | Str | ||
| ) | const |
| void ToLc | ( | ) |
| TSsParser::TSsParser | ( | const TStr & | FNm, |
| const TSsFmt | _SsFmt = ssfTabSep, |
||
| const bool & | _SkipLeadBlanks = false, |
||
| const bool & | _SkipCmt = true, |
||
| const bool & | _SkipEmptyFld = false |
||
| ) |
Definition at line 351 of file ss.cpp.
: SsFmt(_SsFmt), SkipLeadBlanks(_SkipLeadBlanks), SkipCmt(_SkipCmt), SkipEmptyFld(_SkipEmptyFld), LineCnt(0), /*Bf(NULL),*/ SplitCh('\t'), FldV(), FInPt(NULL) { if (TZipIn::IsZipExt(FNm.GetFExt())) { FInPt = TZipIn::New(FNm); } else { FInPt = TFIn::New(FNm); } //Bf = new char [BfLen]; switch(SsFmt) { case ssfTabSep : SplitCh = '\t'; break; case ssfCommaSep : SplitCh = ','; break; case ssfSemicolonSep : SplitCh = ';'; break; case ssfVBar : SplitCh = '|'; break; case ssfSpaceSep : SplitCh = ' '; break; case ssfWhiteSep: SplitCh = ' '; break; default: FailR("Unknown separator character."); } }
| TSsParser::TSsParser | ( | const TStr & | FNm, |
| const char & | Separator, | ||
| const bool & | _SkipLeadBlanks = false, |
||
| const bool & | _SkipCmt = true, |
||
| const bool & | _SkipEmptyFld = false |
||
| ) |
Definition at line 367 of file ss.cpp.
: SsFmt(ssfSpaceSep), SkipLeadBlanks(_SkipLeadBlanks), SkipCmt(_SkipCmt), SkipEmptyFld(_SkipEmptyFld), LineCnt(0), /*Bf(NULL),*/ SplitCh('\t'), FldV(), FInPt(NULL) { if (TZipIn::IsZipExt(FNm.GetFExt())) { FInPt = TZipIn::New(FNm); } else { FInPt = TFIn::New(FNm); } SplitCh = Separator; }
| ClassTP (TSsParser, PSsParser) private bool SkipEmptyFld |
| ClassTP (TSsParser, PSsParser) private bool SkipLeadBlanks |