SNAP Library, User Reference  2012-10-15 15:06:59
SNAP, a general purpose network analysis and graph mining library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
macro.h
Go to the documentation of this file.
00001 
00002 // Macro-Processor
00003 ClassTP(TMacro, PMacro)//{
00004 public:
00005   bool Ok;
00006   TStr MsgStr;
00007   char MacroCh;
00008   char VarCh;
00009   TStr TxtStr;
00010   TStrStrH SubstToValStrH;
00011   TStrStrH VarNmToValStrH;
00012 public:
00013   TMacro(const TStr& TxtStr, const char& _MacroCh='$', const char& _VarCh='#');
00014   static PMacro New(
00015    const TStr& TxtStr, const char& MacroCh='$', const char& VarCh='#'){
00016     return PMacro(new TMacro(TxtStr, MacroCh, VarCh));}
00017   ~TMacro(){}
00018   TMacro(TSIn&){Fail;}
00019   static PMacro Load(TSIn&){Fail; return NULL;}
00020   void Save(TSOut&) const {Fail;}
00021 
00022   TMacro& operator=(const TMacro&){Fail; return *this;}
00023 
00024   bool IsOk() const {return Ok;}
00025   TStr GetMsgStr() const {return MsgStr;}
00026 
00027   TStr GetSrcTxtStr() const {return TxtStr;}
00028   TStr GetDstTxtStr() const;
00029 
00030   int GetSubstStrs() const {return SubstToValStrH.Len();}
00031   TStr GetSrcSubstStr(const int& SubstStrN) const {
00032     return SubstToValStrH.GetKey(SubstStrN);}
00033   bool IsSrcSubstStr(const TStr& SrcSubstStr, int& SubstStrN) const {
00034     return SubstToValStrH.IsKey(SrcSubstStr, SubstStrN);}
00035   int GetSrcSubstStrN(const TStr& SrcSubstStr) const {
00036     return SubstToValStrH.GetKeyId(SrcSubstStr);}
00037   void GetSrcSubstStrV(TStrV& SubstStrV) const;
00038   TStr GetDstSubstStr(const int& SubstStrN=0) const;
00039   void PutSubstValStr(const int& SubstStrN, const TStr& ValStr){
00040     SubstToValStrH[SubstStrN]=ValStr;}
00041   TStr GetSubstValStr(const int& SubstStrN) const {
00042     return SubstToValStrH[SubstStrN];}
00043   TStr GetAllSubstValStr() const;
00044 
00045   int GetVars() const {return VarNmToValStrH.Len();}
00046   TStr GetVarNm(const int& VarN) const {return VarNmToValStrH.GetKey(VarN);}
00047   void GetVarNmV(TStrV& VarNmV) const;
00048   void PutVarVal(const TStr& VarNm, const TStr& ValStr){
00049     VarNmToValStrH.AddDat(VarNm, ValStr);}
00050   TStr GetVarVal(const TStr& VarNm) const {
00051     return VarNmToValStrH.GetDat(VarNm);}
00052 
00053   static void SplitVarNm(
00054    const TStr& VarNm, TStr& CapStr,
00055    bool& IsComboBox, TStr& TbNm, TStr& ListFldNm, TStr& DataFldNm);
00056 };
00057