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