SNAP Library 2.3, Developer Reference  2014-06-16 11:58:46
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
macro.h
Go to the documentation of this file.
1 #include "bd.h"
2 
4 // Macro-Processor
6 public:
7  bool Ok;
8  TStr MsgStr;
9  char MacroCh;
10  char VarCh;
11  TStr TxtStr;
12  TStrStrH SubstToValStrH;
13  TStrStrH VarNmToValStrH;
14 public:
15  TMacro(const TStr& TxtStr, const char& _MacroCh='$', const char& _VarCh='#');
16  static PMacro New(
17  const TStr& TxtStr, const char& MacroCh='$', const char& VarCh='#'){
18  return PMacro(new TMacro(TxtStr, MacroCh, VarCh));}
19  ~TMacro(){}
21  static PMacro Load(TSIn&){Fail; return NULL;}
22  void Save(TSOut&) const {Fail;}
23 
24  TMacro& operator=(const TMacro&){Fail; return *this;}
25 
26  bool IsOk() const {return Ok;}
27  TStr GetMsgStr() const {return MsgStr;}
28 
29  TStr GetSrcTxtStr() const {return TxtStr;}
30  TStr GetDstTxtStr() const;
31 
32  int GetSubstStrs() const {return SubstToValStrH.Len();}
33  TStr GetSrcSubstStr(const int& SubstStrN) const {
34  return SubstToValStrH.GetKey(SubstStrN);}
35  bool IsSrcSubstStr(const TStr& SrcSubstStr, int& SubstStrN) const {
36  return SubstToValStrH.IsKey(SrcSubstStr, SubstStrN);}
37  int GetSrcSubstStrN(const TStr& SrcSubstStr) const {
38  return SubstToValStrH.GetKeyId(SrcSubstStr);}
39  void GetSrcSubstStrV(TStrV& SubstStrV) const;
40  TStr GetDstSubstStr(const int& SubstStrN=0) const;
41  void PutSubstValStr(const int& SubstStrN, const TStr& ValStr){
42  SubstToValStrH[SubstStrN]=ValStr;}
43  TStr GetSubstValStr(const int& SubstStrN) const {
44  return SubstToValStrH[SubstStrN];}
45  TStr GetAllSubstValStr() const;
46 
47  int GetVars() const {return VarNmToValStrH.Len();}
48  TStr GetVarNm(const int& VarN) const {return VarNmToValStrH.GetKey(VarN);}
49  void GetVarNmV(TStrV& VarNmV) const;
50  void PutVarVal(const TStr& VarNm, const TStr& ValStr){
51  VarNmToValStrH.AddDat(VarNm, ValStr);}
52  TStr GetVarVal(const TStr& VarNm) const {
53  return VarNmToValStrH.GetDat(VarNm);}
54 
55  static void SplitVarNm(
56  const TStr& VarNm, TStr& CapStr,
57  bool& IsComboBox, TStr& TbNm, TStr& ListFldNm, TStr& DataFldNm);
58 };
59 
static PMacro Load(TSIn &)
Definition: macro.h:21
#define Fail
Definition: bd.h:238
Definition: macro.h:5
void Save(TSOut &) const
Definition: macro.h:22
static PMacro New(const TStr &TxtStr, const char &MacroCh='$', const char &VarCh='#')
Definition: macro.h:16
TStr GetVarVal(const TStr &VarNm) const
Definition: macro.h:52
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:220
bool IsOk() const
Definition: macro.h:26
TStr GetSrcSubstStr(const int &SubstStrN) const
Definition: macro.h:33
void PutSubstValStr(const int &SubstStrN, const TStr &ValStr)
Definition: macro.h:41
Definition: fl.h:58
#define ClassTP(TNm, PNm)
Definition: bd.h:126
TMacro & operator=(const TMacro &)
Definition: macro.h:24
TStr GetVarNm(const int &VarN) const
Definition: macro.h:48
bool IsSrcSubstStr(const TStr &SrcSubstStr, int &SubstStrN) const
Definition: macro.h:35
TPt< TMacro > PMacro
Definition: macro.h:5
void PutVarVal(const TStr &VarNm, const TStr &ValStr)
Definition: macro.h:50
int GetVars() const
Definition: macro.h:47
Definition: fl.h:128
TMacro(TSIn &)
Definition: macro.h:20
TStr GetSrcTxtStr() const
Definition: macro.h:29
int GetKeyId(const TKey &Key) const
Definition: hash.h:420
TStr GetMsgStr() const
Definition: macro.h:27
Definition: dt.h:412
Definition: bd.h:196
int GetSubstStrs() const
Definition: macro.h:32
bool IsKey(const TKey &Key) const
Definition: hash.h:216
TStr GetSubstValStr(const int &SubstStrN) const
Definition: macro.h:43
int Len() const
Definition: hash.h:186
TDat & AddDat(const TKey &Key)
Definition: hash.h:196
int GetSrcSubstStrN(const TStr &SrcSubstStr) const
Definition: macro.h:37
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:210
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:420
~TMacro()
Definition: macro.h:19