Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cExpressionBase.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cExpressionBase_H
7 #define _INC_cExpressionBase_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../GrayLibBase.h"
13 #include "../Variant/cVariant.h"
14 
15 namespace GrayLib
16 {
18  {
21  VARTYPE_TYPE m_eValType; // what type should it be.
22  const ATOMCHAR_t* m_pszExp; // the source expression.
23  const ATOMCHAR_t* m_pszVal; // evaluated to this.
24  };
25 
27  {
32 
33  public:
34  static const ATOMCHAR_t k_ArrayOpen = '['; // STR_BLOCK_SQUARE
35  static const ATOMCHAR_t k_ArrayClose = ']';
36  static const ATOMCHAR_t k_MapOpen = '{'; // STR_BLOCK_CURLY
37  static const ATOMCHAR_t k_MapClose = '}';
38 
39  public:
41 
42  static bool GRAYCALL IsParenNeeded(const ATOMCHAR_t* pszExp);
43 
44  static HRESULT GRAYCALL GetStringRefQ(const ATOMCHAR_t*& rpszExp, OUT cStringA& rsRet);
45  static HRESULT GRAYCALL GetStringRefV(const ATOMCHAR_t*& rpszExp, OUT cVariant& rvValRet);
46 
47  HRESULT GetArrayListRef(const ATOMCHAR_t*& rpszExp, OUT cVariant& vValRet, ITERATE_t nAppendStart=0);
48  HRESULT GetArrayRef(const ATOMCHAR_t*& rpszExp, OUT cVariant& vValRet, ITERATE_t nAppendStart =0);
49 
50  static HRESULT GRAYCALL GetMapElementName(const ATOMCHAR_t*& rpszExp, OUT cStringA& rsName);
51 
52  HRESULT GetMapListRef(const ATOMCHAR_t*& rpszExp, OUT cVarMap& rMapRet);
53  HRESULT GetMapRef(const ATOMCHAR_t*& rpszExp, OUT cVarMap& rMapRet);
54  HRESULT GetMapListRef(const ATOMCHAR_t*& rpszExp, OUT cVariant& rMapRet);
55  HRESULT GetMapRef(const ATOMCHAR_t*& rpszExp, OUT cVariant& vValRet);
56 
57  static HRESULT GRAYCALL GetSimpleVarRef(const ATOMCHAR_t*& rpszExp, OUT cVariant& vValRet);
58 
59  virtual HRESULT GetVarRef2(const ATOMCHAR_t*& rpszExp, OUT cVariant& vValRet, bool bInArray);
60 
61  cVariant GetVarRef(const ATOMCHAR_t*& rpszExp)
62  {
64  cVariant vValRet;
65  HRESULT hRes = GetVarRef2(rpszExp, vValRet, false);
67  return vValRet;
68  }
69  HRESULT GetVar(const ATOMCHAR_t* pszExp, OUT cVariant& vValRet)
70  {
72  return GetVarRef2(pszExp, vValRet, false);
73  }
74  cVariant GetVar(const ATOMCHAR_t* pszExp)
75  {
77  return GetVarRef(pszExp);
78  }
79 
81  };
82 }
83 
84 #endif
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define UNREFERENCED_PARAMETER(P)
< _WIN32 type thing. get rid of stupid warning.
Definition: SysTypes.h:299
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cExpressionBase.h:27
IGNORE_WARN_ABSTRACT(cExpressionBase)
cVariant GetVar(const ATOMCHAR_t *pszExp)
Definition: cExpressionBase.h:74
HRESULT GetVar(const ATOMCHAR_t *pszExp, OUT cVariant &vValRet)
Definition: cExpressionBase.h:69
cVariant GetVarRef(const ATOMCHAR_t *&rpszExp)
Definition: cExpressionBase.h:61
UNITTEST_FRIEND(cExpressionBase)
Definition: cVarMap.h:109
Definition: cVariant.h:26
Definition: cMesh.h:22
VARTYPE_TYPE
< define types of structure/record elements. (COM uses VARTYPE=VARENUM for this) stored as BYTE
Definition: cVariantType.h:19
int ITERATE_t
like size_t but signed
Definition: Index.h:28
char ATOMCHAR_t
the char form (UNICODE or not) for an atom. (for symbolic names)
Definition: StrConst.h:15
Definition: cExpressionBase.h:18
const ATOMCHAR_t * m_pszVal
Definition: cExpressionBase.h:23
VARTYPE_TYPE m_eValType
Definition: cExpressionBase.h:21
const ATOMCHAR_t * m_pszExp
Definition: cExpressionBase.h:22