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
xmlser.h File Reference

Go to the source code of this file.

Functions

template<class TRec >
bool IsXLoadFromFileOk (const TStr &FNm, const TStr &Nm, TRec &Rec, TStr &MsgStr)
 
template<class TRec >
void XLoadFromFile (const TStr &FNm, const TStr &Nm, TRec &Rec)
 

Function Documentation

template<class TRec >
bool IsXLoadFromFileOk ( const TStr FNm,
const TStr Nm,
TRec &  Rec,
TStr MsgStr 
)

Definition at line 45 of file xmlser.h.

45  {
46  bool Ok=true;
47  try {
48  PXmlDoc XmlDoc=TXmlDoc::LoadTxt(FNm);
49  if (XmlDoc->IsOk()){
50  PXmlTok XmlTok=XmlDoc->GetTok();
51  Rec.LoadXml(XmlTok, Nm);
52  } else {
53  Ok=false; MsgStr=XmlDoc->GetMsgStr();
54  }
55  }
56  catch (PExcept Except){
57  Ok=false; MsgStr=Except->GetMsgStr();
58  }
59  return Ok;
60 }
static PXmlDoc LoadTxt(TXmlLx &Lx)
Definition: xml.cpp:1401
Definition: bd.h:196
void LoadXml(const TPt< TXmlTok > &XmlTok, const TStr &Nm)
Definition: xmlser.h:21
template<class TRec >
void XLoadFromFile ( const TStr FNm,
const TStr Nm,
TRec &  Rec 
)

Definition at line 63 of file xmlser.h.

63  {
64  TStr MsgStr;
65  if (!IsXLoadFromFileOk(FNm, Nm, Rec, MsgStr)){
66  TExcept::Throw(MsgStr);
67  }
68 }
static void Throw(const TStr &MsgStr)
Definition: ut.h:187
Definition: dt.h:412
bool IsXLoadFromFileOk(const TStr &FNm, const TStr &Nm, TRec &Rec, TStr &MsgStr)
Definition: xmlser.h:45