SNAP Library 2.0, User Reference
2013-05-13 16:33:57
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <xml.h>
Public Member Functions | |
TXmlTok () | |
TXmlTok (const TXmlLxSym &_Sym) | |
TXmlTok (const TXmlLxSym &_Sym, const TStr &_Str) | |
TXmlTok (const TXmlLxSym &_Sym, const TStr &_Str, const TStrKdV &_ArgNmValV) | |
TXmlTok (TSIn &) | |
void | Save (TSOut &) |
TXmlTok & | operator= (const TXmlTok &) |
TXmlLxSym | GetSym () const |
TStr | GetSymStr () const |
void | PutStr (const TStr &_Str) |
TStr | GetStr () const |
bool | IsTag () const |
bool | IsTag (const TStr &TagNm) const |
TStr | GetTagNm () const |
void | AddArg (const TStr &ArgNm, const bool &ArgVal) |
void | AddArg (const TStr &ArgNm, const int &ArgVal) |
void | AddArg (const TStr &ArgNm, const uint64 &ArgVal) |
void | AddArg (const TStr &ArgNm, const double &ArgVal) |
void | AddArg (const TStr &ArgNm, const TStr &ArgVal) |
int | GetArgs () const |
void | GetArg (const int &ArgN, TStr &ArgNm, TStr &ArgVal) const |
bool | IsArg (const TStr &ArgNm) const |
bool | IsArg (const TStr &ArgNm, TStr &ArgVal) const |
void | PutArgVal (const TStr &ArgNm, const TStr &ArgVal) |
TStr | GetArgVal (const TStr &ArgNm) const |
TStr | GetArgVal (const TStr &ArgNm, const TStr &DfArgVal) const |
bool | GetBoolArgVal (const TStr &ArgNm, const bool &DfVal=false) const |
bool | GetBoolArgVal (const TStr &ArgNm, const TStr &TrueVal, const bool &DfVal=false) const |
bool | GetBoolArgVal (const TStr &ArgNm, const TStr &TrueVal, const TStr &FalseVal, const bool &DfVal=false) const |
int | GetIntArgVal (const TStr &ArgNm, const int &DfVal=0) const |
double | GetFltArgVal (const TStr &ArgNm, const double &DfVal=0) const |
TStr | GetStrArgVal (const TStr &ArgNm, const TStr &DfVal=TStr()) const |
bool | IsSubTag (const TStr &TagNm) const |
bool | IsSubTag (const TStr &TagNm, PXmlTok &Tok) const |
void | AddSubTok (const PXmlTok &Tok) |
int | GetSubToks () const |
PXmlTok | GetSubTok (const int &SubTokN) const |
void | ClrSubTok () |
void | PutSubTok (const PXmlTok &Tok, const int &SubTokN=-1) |
bool | IsTagTok (const TStr &TagPath, PXmlTok &TagTok) const |
bool | IsTagTok (const TStr &TagPath) const |
PXmlTok | GetTagTok (const TStr &TagPath) const |
void | GetTagTokV (const TStr &TagPath, TXmlTokV &XmlTokV) const |
void | GetTagValV (const TStr &TagNm, const bool &XmlP, TStrV &ValV) const |
TStr | GetTagVal (const TStr &TagNm, const bool &XmlP) const |
TStr | GetTagTokStr (const TStr &TagPath) const |
TStr | GetTagTokStrOrDf (const TStr &TagPath, const TStr &DfVal=TStr()) const |
void | AddTokToChA (const bool &XmlP, TChA &ChA) const |
TStr | GetTokStr (const bool &XmlP=true) const |
Static Public Member Functions | |
static PXmlTok | New () |
static PXmlTok | New (const TXmlLxSym &Sym) |
static PXmlTok | New (const TXmlLxSym &Sym, const TStr &Str) |
static PXmlTok | New (const TXmlLxSym &Sym, const TStr &Str, const TStrKdV &ArgNmValV) |
static PXmlTok | New (const TStr &TagNm, const TStrKdV &ArgNmValV) |
static PXmlTok | New (const TStr &TagNm) |
static PXmlTok | New (const TStr &TagNm, const TStr &ValStr) |
static PXmlTok | New (const TStr &TagNm, const PXmlTok &XmlTok1, const PXmlTok &XmlTok2=NULL) |
static PXmlTok | Load (TSIn &) |
static TStr | GetTokVStr (const TXmlTokV &TokV, const bool &XmlP=true) |
static PXmlTok | GetTok (TXmlLx &Lx) |
Private Attributes | |
TCRef | CRef |
TXmlLxSym | Sym |
TStr | Str |
TStrKdV | ArgNmValV |
TXmlTokV | SubTokV |
Friends | |
class | TPt< TXmlTok > |
TXmlTok::TXmlTok | ( | ) | [inline] |
TXmlTok::TXmlTok | ( | const TXmlLxSym & | _Sym | ) | [inline] |
TXmlTok::TXmlTok | ( | const TXmlLxSym & | _Sym, |
const TStr & | _Str | ||
) | [inline] |
TXmlTok::TXmlTok | ( | const TXmlLxSym & | _Sym, |
const TStr & | _Str, | ||
const TStrKdV & | _ArgNmValV | ||
) | [inline] |
TXmlTok::TXmlTok | ( | TSIn & | ) | [inline] |
void TXmlTok::AddArg | ( | const TStr & | ArgNm, |
const bool & | ArgVal | ||
) | [inline] |
void TXmlTok::AddArg | ( | const TStr & | ArgNm, |
const int & | ArgVal | ||
) | [inline] |
void TXmlTok::AddArg | ( | const TStr & | ArgNm, |
const uint64 & | ArgVal | ||
) | [inline] |
void TXmlTok::AddArg | ( | const TStr & | ArgNm, |
const double & | ArgVal | ||
) | [inline] |
void TXmlTok::AddArg | ( | const TStr & | ArgNm, |
const TStr & | ArgVal | ||
) | [inline] |
void TXmlTok::AddSubTok | ( | const PXmlTok & | Tok | ) | [inline] |
void TXmlTok::AddTokToChA | ( | const bool & | XmlP, |
TChA & | ChA | ||
) | const |
Definition at line 1185 of file xml.cpp.
{ switch (Sym){ case xsyWs: ChA+=Str; break; case xsyStr: if (XmlP){ChA+=TXmlLx::GetXmlStrFromPlainStr(Str);} else {ChA+=Str;} break; case xsyQStr: if (XmlP){ChA+="<![CDATA[";} ChA+=Str; if (XmlP){ChA+="]]>";} break; case xsyTag: if (XmlP){ ChA+='<'; ChA+=Str; for (int ArgN=0; ArgN<GetArgs(); ArgN++){ TStr ArgNm; TStr ArgVal; GetArg(ArgN, ArgNm, ArgVal); if (XmlP){ArgVal=TXmlLx::GetXmlStrFromPlainStr(ArgVal);} char ArgValQCh=TXmlLx::GetArgValQCh(ArgVal); ChA+=' '; ChA+=ArgNm; ChA+='='; ChA+=ArgValQCh; ChA+=ArgVal; ChA+=ArgValQCh; } } if (GetSubToks()==0){ if (XmlP){ChA+="/>";} } else { if (XmlP){ChA+=">";} for (int SubTokN=0; SubTokN<GetSubToks(); SubTokN++){ GetSubTok(SubTokN)->AddTokToChA(XmlP, ChA);} if (XmlP){ChA+="</"; ChA+=Str; ChA+='>';} } break; default: Fail; } }
void TXmlTok::ClrSubTok | ( | ) | [inline] |
void TXmlTok::GetArg | ( | const int & | ArgN, |
TStr & | ArgNm, | ||
TStr & | ArgVal | ||
) | const [inline] |
int TXmlTok::GetArgs | ( | ) | const [inline] |
TStr TXmlTok::GetArgVal | ( | const TStr & | ArgNm | ) | const [inline] |
TStr TXmlTok::GetArgVal | ( | const TStr & | ArgNm, |
const TStr & | DfArgVal | ||
) | const [inline] |
bool TXmlTok::GetBoolArgVal | ( | const TStr & | ArgNm, |
const bool & | DfVal = false |
||
) | const |
Definition at line 1089 of file xml.cpp.
{ int ArgN=ArgNmValV.SearchForw(TStrKd(ArgNm)); return (ArgN==-1) ? DfVal : (ArgNmValV[ArgN].Dat==TBool::TrueStr); }
bool TXmlTok::GetBoolArgVal | ( | const TStr & | ArgNm, |
const TStr & | TrueVal, | ||
const bool & | DfVal = false |
||
) | const |
bool TXmlTok::GetBoolArgVal | ( | const TStr & | ArgNm, |
const TStr & | TrueVal, | ||
const TStr & | FalseVal, | ||
const bool & | DfVal = false |
||
) | const |
double TXmlTok::GetFltArgVal | ( | const TStr & | ArgNm, |
const double & | DfVal = 0 |
||
) | const |
int TXmlTok::GetIntArgVal | ( | const TStr & | ArgNm, |
const int & | DfVal = 0 |
||
) | const |
TStr TXmlTok::GetStr | ( | ) | const [inline] |
TStr TXmlTok::GetStrArgVal | ( | const TStr & | ArgNm, |
const TStr & | DfVal = TStr() |
||
) | const |
PXmlTok TXmlTok::GetSubTok | ( | const int & | SubTokN | ) | const [inline] |
int TXmlTok::GetSubToks | ( | ) | const [inline] |
TXmlLxSym TXmlTok::GetSym | ( | ) | const [inline] |
TStr TXmlTok::GetSymStr | ( | ) | const [inline] |
Definition at line 242 of file xml.h.
{return TXmlLx::GetXmlLxSymStr(Sym);}
TStr TXmlTok::GetTagNm | ( | ) | const [inline] |
PXmlTok TXmlTok::GetTagTok | ( | const TStr & | TagPath | ) | const |
Definition at line 1142 of file xml.cpp.
{ if (TagPath.Empty()){ return (TXmlTok*)this; } else { TStr TagNm; TStr RestTagPath; TagPath.SplitOnCh(TagNm, '|', RestTagPath); PXmlTok SubTok; for (int SubTokN=0; SubTokN<SubTokV.Len(); SubTokN++){ SubTok=SubTokV[SubTokN]; if ((SubTok->GetSym()==xsyTag)&&(SubTok->GetStr()==TagNm)){break;} else {SubTok=NULL;} } if ((SubTok.Empty())||(RestTagPath.Empty())){return SubTok;} else {return SubTok->GetTagTok(RestTagPath);} } }
TStr TXmlTok::GetTagTokStr | ( | const TStr & | TagPath | ) | const [inline] |
TStr TXmlTok::GetTagTokStrOrDf | ( | const TStr & | TagPath, |
const TStr & | DfVal = TStr() |
||
) | const [inline] |
void TXmlTok::GetTagTokV | ( | const TStr & | TagPath, |
TXmlTokV & | XmlTokV | ||
) | const |
Definition at line 1158 of file xml.cpp.
{ XmlTokV.Clr(); TStr PreTagPath; TStr TagNm; TagPath.SplitOnLastCh(PreTagPath, '|', TagNm); PXmlTok Tok=GetTagTok(PreTagPath); if (!Tok.Empty()){ for (int SubTokN=0; SubTokN<Tok->GetSubToks(); SubTokN++){ PXmlTok SubTok=Tok->GetSubTok(SubTokN); if ((SubTok->GetSym()==xsyTag)&&(SubTok->GetStr()==TagNm)){ XmlTokV.Add(SubTok);} } } }
TStr TXmlTok::GetTagVal | ( | const TStr & | TagNm, |
const bool & | XmlP | ||
) | const |
Definition at line 1180 of file xml.cpp.
{ TStrV ValV; GetTagValV(TagNm, XmlP, ValV); if (ValV.Len()>0){return ValV[0];} else {return "";} }
void TXmlTok::GetTagValV | ( | const TStr & | TagNm, |
const bool & | XmlP, | ||
TStrV & | ValV | ||
) | const |
Definition at line 1171 of file xml.cpp.
{ if ((Sym==xsyTag)&&(Str==TagNm)){ ValV.Add(GetTokStr(XmlP)); } else { for (int SubTokN=0; SubTokN<GetSubToks(); SubTokN++){ GetSubTok(SubTokN)->GetTagValV(TagNm, XmlP, ValV);} } }
PXmlTok TXmlTok::GetTok | ( | TXmlLx & | Lx | ) | [static] |
TStr TXmlTok::GetTokStr | ( | const bool & | XmlP = true | ) | const [inline] |
Definition at line 316 of file xml.h.
{ TChA ChA; AddTokToChA(XmlP, ChA); return ChA;}
TStr TXmlTok::GetTokVStr | ( | const TXmlTokV & | TokV, |
const bool & | XmlP = true |
||
) | [static] |
bool TXmlTok::IsArg | ( | const TStr & | ArgNm | ) | const [inline] |
Definition at line 265 of file xml.h.
{ return ArgNmValV.SearchForw(TStrKd(ArgNm))!=-1;}
bool TXmlTok::IsArg | ( | const TStr & | ArgNm, |
TStr & | ArgVal | ||
) | const [inline] |
bool TXmlTok::IsSubTag | ( | const TStr & | TagNm | ) | const [inline] |
bool TXmlTok::IsSubTag | ( | const TStr & | TagNm, |
PXmlTok & | Tok | ||
) | const [inline] |
bool TXmlTok::IsTag | ( | ) | const [inline] |
bool TXmlTok::IsTag | ( | const TStr & | TagNm | ) | const [inline] |
bool TXmlTok::IsTagTok | ( | const TStr & | TagPath, |
PXmlTok & | TagTok | ||
) | const [inline] |
bool TXmlTok::IsTagTok | ( | const TStr & | TagPath | ) | const [inline] |
static PXmlTok TXmlTok::Load | ( | TSIn & | ) | [inline, static] |
static PXmlTok TXmlTok::New | ( | ) | [inline, static] |
static PXmlTok TXmlTok::New | ( | const TXmlLxSym & | Sym | ) | [inline, static] |
static PXmlTok TXmlTok::New | ( | const TXmlLxSym & | Sym, |
const TStr & | Str | ||
) | [inline, static] |
static PXmlTok TXmlTok::New | ( | const TXmlLxSym & | Sym, |
const TStr & | Str, | ||
const TStrKdV & | ArgNmValV | ||
) | [inline, static] |
static PXmlTok TXmlTok::New | ( | const TStr & | TagNm, |
const TStrKdV & | ArgNmValV | ||
) | [inline, static] |
static PXmlTok TXmlTok::New | ( | const TStr & | TagNm | ) | [inline, static] |
static PXmlTok TXmlTok::New | ( | const TStr & | TagNm, |
const TStr & | ValStr | ||
) | [inline, static] |
static PXmlTok TXmlTok::New | ( | const TStr & | TagNm, |
const PXmlTok & | XmlTok1, | ||
const PXmlTok & | XmlTok2 = NULL |
||
) | [inline, static] |
void TXmlTok::PutArgVal | ( | const TStr & | ArgNm, |
const TStr & | ArgVal | ||
) | [inline] |
void TXmlTok::PutStr | ( | const TStr & | _Str | ) | [inline] |
void TXmlTok::PutSubTok | ( | const PXmlTok & | Tok, |
const int & | SubTokN = -1 |
||
) |
void TXmlTok::Save | ( | TSOut & | ) | [inline] |
TStrKdV TXmlTok::ArgNmValV [private] |
TCRef TXmlTok::CRef [private] |
TStr TXmlTok::Str [private] |
TXmlTokV TXmlTok::SubTokV [private] |
TXmlLxSym TXmlTok::Sym [private] |