Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cScriptableInterface.h
Go to the documentation of this file.
1 //
5 //
6 
7 #ifndef _INC_cScriptableInterface_H
8 #define _INC_cScriptableInterface_H
9 #ifndef NO_PRAGMA_ONCE
10 #pragma once
11 #endif
12 
13 #include "../GrayLibBase.h"
14 #include "../Auth/PrivLevel.h" // PLEVEL_TYPE
15 #include "../Misc/cStructElem.h"
16 #include "../Variant/cVariant.h"
17 
19 #include "GrayCore/include/cAtom.h"
25 
26 namespace GrayLib
27 {
28  UNITTEST2_PREDEF(cScriptableInterface);
29 
30  // predefine these
34 
35  typedef BYTE SCRIPTINTERFACEID_t;
36  const SCRIPTINTERFACEID_t SCRIPTINTERFACEID_MAX = 0xFF; // max number of interfaces defined in the system.
37  typedef BYTE SCRIPTPROPID_t;
38  const SCRIPTPROPID_t SCRIPTPROPINDEX_MAX = 0xFF; // max number of properties or methods per object.
39 
41  {
50  };
51  typedef UINT XOBJ_DUMP_MASK_t;
52 
53  typedef WORD CSCRIPTPROP_MASK_t;
55  {
59 
60  CSCRIPTPROP_RETNUL = 0x0000,
61  CSCRIPTPROP_RETVAL = 0x0020,
62  CSCRIPTPROP_RETREF = 0x0040,
64 
65  CSCRIPTPROPP_READO = 0x0100,
66  CSCRIPTPROP_NARGS = 0x0100,
68  CSCRIPTPROP_ARG1S = 0x0401,
71 
72  CSCRIPTPROP_UNUSED = 0x1000,
73  CSCRIPTPROP_DUPE = 0x2000,
74 
75  CSCRIPTPROPP_TEMP = 0x4000,
76  CSCRIPTPROPP_KEY = 0x0010,
80  CSCRIPTPROPM_FUNC = 0x8000,
81 
82  CSCRIPTPROP_ARG1 = 0x0001,
83  CSCRIPTPROP_ARG2 = 0x0002,
84  CSCRIPTPROP_ARG3 = 0x0003,
85  CSCRIPTPROP_ARG4 = 0x0004,
86  CSCRIPTPROP_ARG5 = 0x0005,
88 
94  };
95 
97  {
102 
103  public:
106 
115  UINT_PTR m_nMethodStub;
118 
119  public:
120 
121  static inline BYTE GetARGS(CSCRIPTPROP_MASK_t flag) noexcept
122  {
124  return flag & CSCRIPTPROP_ARGS_MASK; // recommended number of args.
125  }
126  static inline bool isNOARGS(CSCRIPTPROP_MASK_t flag) noexcept
127  {
129  return (GetARGS(flag) == 0) && (flag & CSCRIPTPROP_NARGS);
130  }
131 
132  void InitProp();
133 
134  const ATOMCHAR_t* get_Name() const noexcept
135  {
137  return m_a.get_Name(); // StrT::k_LEN_MAX_KEY
138  }
139  ATOMCODE_t get_HashCode() const noexcept
140  {
142  return m_nHashCode;
143  }
144 
145  StrLen_t get_NamePropLen() const;
146  cAtomRef get_NamePropA() const;
147 
148  bool IsPropFlags(CSCRIPTPROP_MASK_t wFlags) const noexcept
149  {
150  return (m_wFlags & wFlags) != 0;
151  }
152  bool isFunction() const noexcept
153  {
155  return IsPropFlags(CSCRIPTPROPM_FUNC);
156  }
157  bool isMethod() const noexcept
158  {
159  return (m_nMethodStub != 0) && !isFunction();
160  }
161  bool isProp() const noexcept
162  {
163  return m_nMethodStub == 0;
164  }
165  bool isDeprecated() const noexcept
166  {
168  return IsPropFlags(CSCRIPTPROP_UNUSED | CSCRIPTPROP_DUPE);
169  }
170  int get_NumArgs() const noexcept
171  {
173  return GetARGS(m_wFlags);
174  }
175  bool HasNoArgs() const noexcept
176  {
178  return (m_wFlags & (CSCRIPTPROP_ARGS_MASK | CSCRIPTPROP_NARGS)) == CSCRIPTPROP_NARGS;
179  }
180  bool HasKnownArgs() const noexcept
181  {
183  return IsPropFlags(CSCRIPTPROP_NARGS);
184  }
185  bool HasPrivLevelRead(PLEVEL_TYPE ePrivLevel) const noexcept
186  {
187  return ePrivLevel >= m_PrivLevelRead;
188  }
189  bool HasPrivLevelWrite(PLEVEL_TYPE ePrivLevel) const noexcept
190  {
192  return ePrivLevel >= m_PrivLevelWrite;
193  }
194  bool isValidProp() const noexcept
195  {
197  if (!cMem::IsValidApp(this))
198  return false;
199  if (this->get_Name() == nullptr)
200  return false;
201  if (!StrChar::IsCSymF(this->get_Name()[0]))
202  return false;
203  if (this->m_pInterfaceDef == nullptr)
204  return false;
205  // ASSERT(this->m_pInterfaceDef->get_Name()!=nullptr);
206  return true;
207  }
208 
210  SCRIPTINTERFACEID_t get_InterfaceID() const;
212  SCRIPTPROPID_t get_PropIndex() const;
213  SCRIPTPROPID_t get_MethodIndex() const;
214 
215  HRESULT SerializeOutput(cStreamOutput& file, PLEVEL_TYPE ePrivLevel);
216 
217  bool GetElementVal(const void* pBaseInst, OUT cVariant& vValRet) const
218  {
220  ASSERT(isProp());
221  return m_a.m_elem.GetValVar(pBaseInst, vValRet);
222  }
223  bool SetElementVal(void* pBaseInst, const cVariant& vVal) const
224  {
226  ASSERT(isProp());
227  if ((m_wFlags & CSCRIPTPROP_UNUSED) && m_a.m_elem.m_eVarType == VARTYPE_NoType)
228  return true;
229  return m_a.SetValVar(pBaseInst, vVal);
230  }
231  HRESULT SetElementCheck(void* pBaseInst, const cVariant& vVal) const
232  {
235  if ((m_wFlags & CSCRIPTPROP_UNUSED) && m_a.m_elem.m_eVarType == VARTYPE_NoType)
236  return S_FALSE;
237  ASSERT(isProp());
238  return m_a.SetValCheck(pBaseInst, vVal);
239  }
240 
242  {
243  // Get the native data type.
244  return m_a.m_elem.m_eVarType;
245  }
246 
247  HRESULT ScriptWrite(IScriptableSetter* pScript, const void* pBaseInst) const;
248  HRESULT ScriptRead(IScriptableGetter* pScript, void* pBaseInst) const;
249  };
250 
251  //*************************************************************************
252 
254 
255 #ifndef CSCRIPT_PROP_HELP
256 #define CSCRIPT_PROP_HELP(c) c
257 #endif
258 
259  // define cScriptableProp props and methods that must be implemented manually via s_PropGet or s_Invoke
260 #define CSCRIPT_PROP_IMP(a,b,c) { { #a, { VARTYPE_NoType, 0, 0 } }, b, PLEVEL_GM, PLEVEL_GM, CSCRIPT_PROP_HELP(c), false, &sm_ScriptInterfaceDef }
261 #define CSCRIPT_METHOD_IMP(a,b,c) { { #a, { VARTYPE_NoType, 0, 0 } }, b, PLEVEL_GM, PLEVEL_QTY, CSCRIPT_PROP_HELP(c), true, &sm_ScriptInterfaceDef }
262 #define CSCRIPT_METHOD_IMP2(a,b,c,d) { { #a, { VARTYPE_NoType, 0, 0 } }, b, c, PLEVEL_QTY, CSCRIPT_PROP_HELP(d), true, &sm_ScriptInterfaceDef }
263 
264 #define CSCRIPT_PROP_END { { nullptr, { VARTYPE_NoType, 0, 0 } }, 0 }
265 
266  //*************************************************************************
267  // Defined elements about the class. (simple static type, not overloading any other interface)
268 
269 #define CSCRIPT_CLASS_DEF0_N static cScriptableInterfaceDef sm_ScriptInterfaceDef; // No virtuals.
270 
271 #define CSCRIPT_CLASS_DEF0(TYPE) CSCRIPT_CLASS_DEF0_N virtual cScriptableInterfaceDefPtr _stdcall get_ScriptInterfaceDef() const { return(&sm_ScriptInterfaceDef); }
272 
273 #define CSCRIPT_CLASS_IMP0(TYPE,_PROPS,_METHODS,_HELP) cScriptableInterfaceDef c##TYPE::sm_ScriptInterfaceDef(typeid(c##TYPE),#TYPE,_PROPS,_METHODS,nullptr,CSCRIPT_PROP_HELP(_HELP));
274 
275  //*************************************************************************
276  // Defined elements about the class. (has just one interface)
277 #define CSCRIPT_CLASS_DEF1(TYPE,_BASETYPE) \
278  CSCRIPT_CLASS_DEF0(TYPE) \
279  typedef _BASETYPE CSCRIPTABLE_SUPER_t; \
280 
281 #define CSCRIPT_CLASS_IMP1(TYPE,_PROPS,_METHODS,_HELP) \
282  cScriptableInterfaceDef c##TYPE::sm_ScriptInterfaceDef(typeid(c##TYPE),#TYPE,_PROPS,_METHODS,&c##TYPE::CSCRIPTABLE_SUPER_t::sm_ScriptInterfaceDef,CSCRIPT_PROP_HELP(_HELP));
283 
284  //*************************************************************************
285  // Defined elements about the class. (complex type with multiple interfaces)
286 #define CSCRIPT_CLASS_DEF2(TYPE,_BASETYPE) \
287  static cScriptableInterfaceTemplate<c##TYPE> sm_ScriptInterfaceDef; \
288  typedef _BASETYPE CSCRIPTABLE_SUPER_t; \
289  virtual cScriptableInterfaceDefPtr _stdcall get_ScriptInterfaceDef() const \
290  { return(&sm_ScriptInterfaceDef); }
291 
292 #define CSCRIPT_CLASS_IMP2(TYPE,_PROPS,_METHODS,_HELP) \
293  template class cScriptableInterfaceTemplate<c##TYPE>; \
294  cScriptableInterfaceTemplate<c##TYPE> c##TYPE::sm_ScriptInterfaceDef(typeid(c##TYPE),#TYPE,_PROPS,_METHODS,&c##TYPE::CSCRIPTABLE_SUPER_t::sm_ScriptInterfaceDef,CSCRIPT_PROP_HELP(_HELP));
295 
296  //*************************************************************************
297 
299  : public CObject
300  {
304  public:
308  const char* m_pszHelp;
309 
317 
321 
324 
325 #if 0
327  SCRIPT_METHOD_FUNC* m_pfMethod;
328  SCRIPT_PROP_FUNC* m_pfPropGet;
329  SCRIPT_PROP_FUNC* m_pfPropSet;
330 #endif
331 
332  enum P_TYPE_
333  {
334 #define cScriptableInterfaceProp(a,b,c) P_##a,
336 #undef cScriptableInterfaceProp
338  };
339  static cScriptableProp sm_Props[P_QTY + 1];
340  CSCRIPT_CLASS_DEF0(ScriptInterfaceDef);
341 
343 
344  protected:
346 
348  private:
349  cScriptableProp* m_pProps;
350  protected:
352  private:
353  cScriptableMethod* m_pMethods;
354  protected:
356 
357  private:
358  void AddProp(const cScriptableProp* pProp);
359  void AddMethod(const cScriptableMethod* pMethod);
360 
361  public:
362  cScriptableInterfaceDef(const TYPEINFO_t& TypeInfo, const ATOMCHAR_t* pszName, cScriptableProp* pProps, cScriptableMethod* pMethods, cScriptableInterfaceDef* pSubInterface, const ATOMCHAR_t* pszHelp);
363  virtual ~cScriptableInterfaceDef();
364 
365  virtual bool isValidCheck() const noexcept; // override
366 
367  const ATOMCHAR_t* get_Name() const noexcept
368  {
369  return m_pszName;
370  }
372  {
375  // ASSERT(cScriptableInterfaceMgr::I().IsInterfaceInit());
376  return m_nInterfaceID;
377  }
378 
379  SCRIPTPROPID_t get_MethodQty() const noexcept
380  {
381  return m_iMethodQty; //
382  }
384  {
385  if (IS_INDEX_BAD(index, m_iMethodQty))
386  return nullptr;
387  return &m_pMethods[index];
388  }
389  virtual SCRIPTPROPID_t GetMethodIndex(const cScriptableMethod* pMethod) const
390  {
391  SCRIPTPROPID_t index = (SCRIPTPROPID_t)GET_INDEX_IN((const cScriptableMethod*)m_pMethods, pMethod);
393  return index;
394  }
396  {
397  return (SCRIPTPROPID_t)StrT::TableFindHeadSorted(pszName, m_pMethods, m_iMethodQty, sizeof(m_pMethods[0]));
398  }
400  {
401  int index = FindMethodIndex(pszName);
402  if (index < 0)
403  return nullptr;
404  return &m_pMethods[index];
405  }
406 
408  {
409  return m_iPropQty; //
410  }
412  {
414  if (IS_INDEX_BAD(index, m_iPropQty))
415  return nullptr;
416  return &m_pProps[index];
417  }
418  virtual SCRIPTPROPID_t GetPropIndex(const cScriptableProp* pProp) const
419  {
420  SCRIPTPROPID_t index = (SCRIPTPROPID_t)GET_INDEX_IN((const cScriptableProp*)m_pProps, pProp);
422  return index;
423  }
425  {
426  return (SCRIPTPROPID_t)StrT::TableFindHeadSorted(pszName, m_pProps, m_iPropQty, sizeof(m_pProps[0]));
427  }
428  cScriptableProp* FindPropPtrI(const ATOMCHAR_t* pszName) const
429  {
430  int index = FindPropIndex(pszName);
431  if (index < 0)
432  return nullptr;
433  return &m_pProps[index];
434  }
435 
437  bool SetMethodPrivLevel(const ATOMCHAR_t* pszMethod, PLEVEL_TYPE ePrivLevel);
438 
439  bool IsInterfaceInit() const
440  {
442  return m_bInitInterface;
443  }
444 
445  HRESULT SerializeOutput(cStreamOutput& out, PLEVEL_TYPE ePrivLevel) const;
446 
449  virtual void InitScriptInterfaceDef();
450 
452  void InitSubInterfaces();
453  bool HasSubInterface(const cScriptableInterfaceDef* pInterfaceDef) const;
454  bool HasInterface(const cScriptableInterfaceDef* pInterfaceDef) const;
455  void AddSubInterfaceProps(cScriptableInterfaceDef* pInterface);
456 
458  void AddSubInterfaces(cScriptableInterfaceDef* pSubInterface);
459  const cScriptableMethod* FindMethodStr(const ATOMCHAR_t* pszName) const;
460  const cScriptableProp* FindPropStr(const ATOMCHAR_t* pszName) const;
461  const cScriptableProp* FindPropOrMethodStr(const ATOMCHAR_t* pszName) const;
462 
464  const cScriptableMethod* FindMethodHash(ATOMCODE_t nKey) const;
465  const cScriptableProp* FindPropHash(ATOMCODE_t nKey) const;
466  };
467 
468  template<class TYPE>
470  {
474 
476 
477  public:
478  cScriptableInterfaceTemplate(const TYPEINFO_t& TypeInfo, const ATOMCHAR_t* pszName, cScriptableProp* pProps, cScriptableMethod* pMethods, cScriptableInterfaceDef* pSubInterface, const ATOMCHAR_t* pszHelp)
479  : cScriptableInterfaceDef(TypeInfo, pszName, pProps, pMethods, pSubInterface, pszHelp)
480  {
481  }
482 
484  virtual void InitScriptInterfaceDef();
485  };
486 
488  {
490  ASSERT(m_pInterfaceDef != nullptr);
491  return m_pInterfaceDef->GetPropIndex(this);
492  }
494  {
496  ASSERT(m_pInterfaceDef != nullptr);
497  return m_pInterfaceDef->GetMethodIndex(this);
498  }
499 
500  //*************************************************************************
501 
502  class GRAYLIB_LINK cScriptableInterfaceMgr : public cSingleton<cScriptableInterfaceMgr>
503  {
508 
510  friend class cSingleton<cScriptableInterfaceMgr>;
512 
513  private:
514  ITERATE_t m_nInitInterfaces; // was InitInterfaces() called yet? how many times? SCRIPTINTERFACEID_t
515  cArrayPtr<cScriptableInterfaceDef> m_aInterfaceDefs;
516 
517  protected:
521 
522  public:
524  {
525  if (!m_aInterfaceDefs.IsValidIndex(nInterfaceID))
526  return nullptr;
527  return m_aInterfaceDefs[nInterfaceID];
528  }
529 
530  static void GRAYCALL InitInterfaces();
531  void InitInterfaceDefs();
532 
533  bool isInitInterfaces() const
534  {
536  return(m_nInitInterfaces > 0);
537  }
538 
539  bool SetMethodPrivLevel(const ATOMCHAR_t* pszMethod, PLEVEL_TYPE ePrivLevel);
540 
541  SCRIPTINTERFACEID_t AddInterfaceDef(cScriptableInterfaceDef* pScriptInterface);
542  bool RemoveInterfaceDef(cScriptableInterfaceDef* pScriptInterface);
543 
544  cScriptableInterfaceDefPtr FindInterfaceDef(const ATOMCHAR_t* pszName) const;
545 
547  void UpdateInterfaceProp(cScriptableProp* pProp);
548  // void AddInterfaceProp( cScriptableInterfaceDef* pScriptInterface, cScriptableProp* pProp );
549 
550  UNITTEST_FRIEND(cScriptableInterface);
551  };
552 }
553 
554 #define CSCRIPT_PROP(_CLASS,_PROP) (_CLASS::sm_Props[_CLASS::P_##_PROP])
555 #define CSCRIPT_PROP_NAME(_CLASS,_PROP) (CSCRIPT_PROP(_CLASS,_PROP).m_a.m_pszKey)
556 #define CSCRIPT_PROP_NAMEA(_CLASS,_PROP) (CSCRIPT_PROP(_CLASS,_PROP).get_NamePropA())
557 
558 #define CSCRIPT_METHOD(_CLASS,_PROP) (_CLASS::sm_Methods[_CLASS::M_##_PROP])
559 #define CSCRIPT_METHOD_NAME(_CLASS,_PROP) (CSCRIPT_METHOD(_CLASS,_PROP).m_a.m_pszKey)
560 #define CSCRIPT_METHOD_NAMEA(_CLASS,_PROP) (CSCRIPT_METHOD(_CLASS,_PROP).get_NamePropA())
561 
562 #ifdef GRAY_DLL // force implementation/instantiate for DLL/SO.
563 namespace Gray
564 {
565  template class GRAYLIB_LINK cArrayPtr<GrayLib::cScriptableInterfaceDef>;
566  template class GRAYLIB_LINK cArraySorted<GrayLib::SCRIPTINTERFACEID_t, GrayLib::SCRIPTINTERFACEID_t, GrayLib::SCRIPTINTERFACEID_t>;
567 }
568 #endif
569 
570 #endif // _INC_cScriptableInterface_H
#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 IS_INDEX_GOOD(i, q)
cast the (likely) int to unsigned to check for negatives.
Definition: Index.h:35
#define IS_INDEX_BAD(i, q)
cast the (likely) int to unsigned to check for negatives.
Definition: Index.h:34
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define ASSERT(exp)
Definition: cDebugAssert.h:87
#define CHEAPOBJECT_IMPL
Definition: cHeapObject.h:32
#define CSCRIPT_CLASS_DEF0(TYPE)
Definition: cScriptableInterface.h:271
Definition: cScriptContext.h:24
Definition: cScriptableInterface.h:300
UINT m_nInstances
define get_ScriptInterfaceDef()
Definition: cScriptableInterface.h:340
SCRIPTPROPID_t get_MethodQty() const noexcept
Definition: cScriptableInterface.h:379
virtual SCRIPTPROPID_t GetMethodIndex(const cScriptableMethod *pMethod) const
Definition: cScriptableInterface.h:389
cScriptableInterfaceDef * m_pSubInterface
primary sub class. (can actually be multi(m_aSubInterfacesAll) or none(nullptr))
Definition: cScriptableInterface.h:307
SCRIPTPROPID_t FindPropIndex(const ATOMCHAR_t *pszName) const
Definition: cScriptableInterface.h:424
cArraySortPtrHash< const cScriptableProp, ATOMCODE_t > m_aPropsAllHash
We may search by hash code.
Definition: cScriptableInterface.h:319
SCRIPTPROPID_t m_iMethodQty
get_MethodQty()
Definition: cScriptableInterface.h:355
cArraySortPtrName< const cScriptableMethod, ATOMCHAR_t > m_aMethodsAll
Complete list of all Methods. (includes sub class methods)
Definition: cScriptableInterface.h:316
const char * m_pszHelp
helpful description for human readers.
Definition: cScriptableInterface.h:308
SCRIPTPROPID_t FindMethodIndex(const ATOMCHAR_t *pszName) const
Definition: cScriptableInterface.h:395
cScriptableProp * FindPropPtrI(const ATOMCHAR_t *pszName) const
Definition: cScriptableInterface.h:428
SCRIPTPROPID_t m_iPropQty
get_PropQty()
Definition: cScriptableInterface.h:351
cArraySortVal< SCRIPTINTERFACEID_t > m_aSubInterfacesAll
List of interfaces I'm based on (Already added to m_aMethodsAll and m_aPropsAll.
Definition: cScriptableInterface.h:323
virtual SCRIPTPROPID_t GetPropIndex(const cScriptableProp *pProp) const
Definition: cScriptableInterface.h:418
cArraySortPtrHash< const cScriptableMethod, ATOMCODE_t > m_aMethodsAllHash
Definition: cScriptableInterface.h:320
SCRIPTINTERFACEID_t m_nInterfaceID
enum id to define the class. similar to XOBJTIDX_TYPE ?
Definition: cScriptableInterface.h:311
virtual cScriptableMethod * GetMethodPtr(SCRIPTPROPID_t index) const noexcept
Definition: cScriptableInterface.h:383
const ATOMCHAR_t * m_pszName
Interface Name.
Definition: cScriptableInterface.h:306
P_TYPE_
< if the InterfaceDef is itself an interface.
Definition: cScriptableInterface.h:333
@ P_QTY
Definition: cScriptableInterface.h:337
bool m_bInitInterface
has this been synchronized with the base classes.
Definition: cScriptableInterface.h:345
SCRIPTPROPID_t get_PropQty() const
Definition: cScriptableInterface.h:407
bool IsInterfaceInit() const
Definition: cScriptableInterface.h:439
SCRIPTINTERFACEID_t get_InterfaceID() const noexcept
Definition: cScriptableInterface.h:371
virtual cScriptableProp * GetPropPtr(SCRIPTPROPID_t index) const
Definition: cScriptableInterface.h:411
cArraySortPtrName< const cScriptableProp, ATOMCHAR_t > m_aPropsAll
Definition: cScriptableInterface.h:314
cScriptableMethod * FindMethodPtrI(const ATOMCHAR_t *pszName) const
Definition: cScriptableInterface.h:399
const TYPEINFO_t & m_TypeInfo
The C++ typeid(class type) this refers to. (we could derive m_pszName?) MUST HAVE RTTI on!
Definition: cScriptableInterface.h:305
Definition: cScriptableInterface.h:503
UNITTEST_FRIEND(cScriptableInterface)
cScriptableInterfaceDefPtr GetInterfaceDef(SCRIPTINTERFACEID_t nInterfaceID) const
Definition: cScriptableInterface.h:523
bool isInitInterfaces() const
Definition: cScriptableInterface.h:533
Definition: cScriptableInterface.h:470
cScriptableInterfaceTemplate(const TYPEINFO_t &TypeInfo, const ATOMCHAR_t *pszName, cScriptableProp *pProps, cScriptableMethod *pMethods, cScriptableInterfaceDef *pSubInterface, const ATOMCHAR_t *pszHelp)
Definition: cScriptableInterface.h:478
virtual void InitScriptInterfaceDef()
things that cannot be done at static construct time.
Definition: cScriptableInterface.h:97
int get_NumArgs() const noexcept
Definition: cScriptableInterface.h:170
bool HasKnownArgs() const noexcept
Definition: cScriptableInterface.h:180
cScriptableInterfaceDef * m_pInterfaceDef
point back to my root class. (not used for context functions)
Definition: cScriptableInterface.h:116
HRESULT SetElementCheck(void *pBaseInst, const cVariant &vVal) const
Definition: cScriptableInterface.h:231
const ATOMCHAR_t * get_Name() const noexcept
Definition: cScriptableInterface.h:134
bool IsPropFlags(CSCRIPTPROP_MASK_t wFlags) const noexcept
Definition: cScriptableInterface.h:148
bool isValidProp() const noexcept
Definition: cScriptableInterface.h:194
static bool isNOARGS(CSCRIPTPROP_MASK_t flag) noexcept
Definition: cScriptableInterface.h:126
cStructNamedElem m_a
(key,type,offset,extra)
Definition: cScriptableInterface.h:105
bool isDeprecated() const noexcept
Definition: cScriptableInterface.h:165
CSCRIPTPROP_MASK_t m_wFlags
CSCRIPTPROP_RETNUL (apply slightly diff to cScriptableMethod, cScriptableMethod, cScriptableMethod.
Definition: cScriptableInterface.h:111
bool SetElementVal(void *pBaseInst, const cVariant &vVal) const
Definition: cScriptableInterface.h:223
SCRIPTPROPID_t get_MethodIndex() const
Definition: cScriptableInterface.h:493
VARTYPE_TYPE get_ElementType() const
Definition: cScriptableInterface.h:241
SCRIPTPROPID_t get_PropIndex() const
the index of the prop in the interface.
Definition: cScriptableInterface.h:487
bool GetElementVal(const void *pBaseInst, OUT cVariant &vValRet) const
Definition: cScriptableInterface.h:217
BYTE m_PrivLevelRead
What PLEVEL_TYPE required to read this prop. (does not apply to methods)
Definition: cScriptableInterface.h:113
bool isFunction() const noexcept
Definition: cScriptableInterface.h:152
bool HasPrivLevelWrite(PLEVEL_TYPE ePrivLevel) const noexcept
Definition: cScriptableInterface.h:189
static BYTE GetARGS(CSCRIPTPROP_MASK_t flag) noexcept
Definition: cScriptableInterface.h:121
ATOMCODE_t m_nHashCode
The cAtomRef hash = StrT::GetHashCode32(m_a.key) (can't init this at static time. do it later InitPro...
Definition: cScriptableInterface.h:117
ATOMCODE_t get_HashCode() const noexcept
Definition: cScriptableInterface.h:139
bool HasPrivLevelRead(PLEVEL_TYPE ePrivLevel) const noexcept
Definition: cScriptableInterface.h:185
bool HasNoArgs() const noexcept
Definition: cScriptableInterface.h:175
bool isProp() const noexcept
Definition: cScriptableInterface.h:161
const ATOMCHAR_t * m_pszHelp
short piece of help text on this prop/method. CSCRIPT_PROP_HELP
Definition: cScriptableInterface.h:114
BYTE m_PrivLevelWrite
What PLEVEL_TYPE required to write this prop or exec/invoke this method.
Definition: cScriptableInterface.h:112
bool isMethod() const noexcept
Definition: cScriptableInterface.h:157
UINT_PTR m_nMethodStub
just identifies it as a method or not. although m_PrivLevelRead==PLEVEL_QTY does as well.
Definition: cScriptableInterface.h:115
VARTYPE_TYPE m_eVarType
effective type of the data in the mapped structure.
Definition: cStructElem.h:33
bool GetValVar(const void *pBaseInst, cVariant &vVal) const
Definition: cStructElem.cpp:251
Definition: cStructElem.h:87
const ATOMCHAR_t * get_Name() const noexcept
Definition: cStructElem.h:103
bool SetValVar(void *pBaseInst, const cVariant &vVal) const
Definition: cStructElem.h:117
HRESULT SetValCheck(void *pBaseInst, const cVariant &vVal) const
Definition: cStructElem.h:121
cStructElem m_elem
(type,offset,extra)
Definition: cStructElem.h:96
Definition: cVariant.h:26
Definition: cObject.h:67
Definition: cArray.h:864
Definition: cArraySort.h:613
Definition: cArraySort.h:620
bool IsValidIndex(ITERATE_t i) const noexcept
Definition: cArray.h:495
Definition: cAtom.h:63
Definition: cSingleton.h:127
Definition: cStream.h:126
Definition: IScriptableObj.h:51
Definition: IScriptableObj.h:62
Definition: cMesh.h:22
cScriptableProp cScriptableMethod
Methods are really similar to Props.
Definition: cScriptableInterface.h:253
class __DECL_IMPORT cScriptableInterfaceDef
Definition: cScriptableEventsMask.h:31
VARTYPE_TYPE
< define types of structure/record elements. (COM uses VARTYPE=VARENUM for this) stored as BYTE
Definition: cVariantType.h:19
@ VARTYPE_NoType
Definition: cVariantType.h:24
XOBJ_DUMP_MASK_
Definition: cScriptableInterface.h:41
@ XOBJ_DUMP_NAME
Definition: cScriptableInterface.h:44
@ XOBJ_DUMP_INTERFACE
what interface is this based on?
Definition: cScriptableInterface.h:48
@ XOBJ_DUMP_FLAGS
Definition: cScriptableInterface.h:47
@ XOBJ_DUMP_VALUE
Definition: cScriptableInterface.h:45
@ XOBJ_DUMP_UNUSED
flag to show even the unused stuff.
Definition: cScriptableInterface.h:49
@ XOBJ_DUMP_HELP
Definition: cScriptableInterface.h:46
UNITTEST2_PREDEF(cQuadtree)
CSCRIPTPROP_MASK_
Definition: cScriptableInterface.h:55
@ CSCRIPTPROPP_WRITEO
Write only prop. (array props need method for read.)
Definition: cScriptableInterface.h:67
@ CSCRIPTPROPM_DISPAT
Method is a special dispatch method. hide from normal display.
Definition: cScriptableInterface.h:69
@ CSCRIPTPROPM_DELETE
this method could delete the object. must update to verify
Definition: cScriptableInterface.h:79
@ CSCRIPTPROP_ARG4
Definition: cScriptableInterface.h:85
@ CSCRIPTPROP_ARG1S
Just takes 1 string argument. allow sloppy syntax.
Definition: cScriptableInterface.h:68
@ CSCRIPTPROP_RETREF
method could return a ref. (but may not)
Definition: cScriptableInterface.h:62
@ CSCRIPTPROPI_STATIC
a single static entity. (not the same as CONST)
Definition: cScriptableInterface.h:77
@ CSCRIPTPROPP_NOPRIV
not high enough priv level to read this!
Definition: cScriptableInterface.h:70
@ CSCRIPTPROP_DEFAULT
First 4 bits is the number of REQUIRED arguments.
Definition: cScriptableInterface.h:58
@ CSCRIPTPROP_RETNUL
method returns nothing. (or prop is unused)
Definition: cScriptableInterface.h:60
@ CSCRIPTPROPP_KEY
this prop is a key for the record
Definition: cScriptableInterface.h:76
@ CSCRIPTPROP_NARG1
exactly 1 arg.
Definition: cScriptableInterface.h:89
@ CSCRIPTPROP_DUPE
This is redundant for another key. m_pszHelp. MUST be static for Send_Props to work.
Definition: cScriptableInterface.h:73
@ CSCRIPTPROP_NARG3
Definition: cScriptableInterface.h:91
@ CSCRIPTPROPP_TEMP
just a temporary prop, don't bother saving this.
Definition: cScriptableInterface.h:75
@ CSCRIPTPROP_NARG5
Definition: cScriptableInterface.h:93
@ CSCRIPTPROP_UNUSED
Obsolete or reserved keyword. MUST be static for Send_Props to work.
Definition: cScriptableInterface.h:72
@ CSCRIPTPROP_NARGS
Method needs exactly this number of args. cScriptableProp::GetARGS.
Definition: cScriptableInterface.h:66
@ CSCRIPTPROPI_PRIVNAME
private namespace. (for cScriptableInterfaceDef and resourcedef)
Definition: cScriptableInterface.h:78
@ CSCRIPTPROP_EXTPROP
special syntax for script such that method looks like a ref syntactically but is really just an arg (...
Definition: cScriptableInterface.h:63
@ CSCRIPTPROP_NARG4
Definition: cScriptableInterface.h:92
@ CSCRIPTPROP_ARG1
It MUST have at least this number of args.
Definition: cScriptableInterface.h:82
@ CSCRIPTPROPM_FUNC
global function. (not really a method)
Definition: cScriptableInterface.h:80
@ CSCRIPTPROP_RETVAL
method returns some sort of val.
Definition: cScriptableInterface.h:61
@ CSCRIPTPROP_ARG3
Definition: cScriptableInterface.h:84
@ CSCRIPTPROP_ARG5
Definition: cScriptableInterface.h:86
@ CSCRIPTPROP_NARG2
Definition: cScriptableInterface.h:90
@ CSCRIPTPROPP_READO
prop is read only. (or method takes no args)
Definition: cScriptableInterface.h:65
@ CSCRIPTPROP_ARG2
Definition: cScriptableInterface.h:83
@ CSCRIPTPROP_ARGS_MASK
Definition: cScriptableInterface.h:87
BYTE SCRIPTINTERFACEID_t
enumerate all the defined interface definitions.
Definition: cScriptableInterface.h:35
const SCRIPTPROPID_t SCRIPTPROPINDEX_MAX
Definition: cScriptableInterface.h:38
WORD CSCRIPTPROP_MASK_t
Definition: cScriptableInterface.h:53
PLEVEL_TYPE
Definition: PrivLevel.h:16
cScriptableInterfaceDef * cScriptableInterfaceDefPtr
Definition: cScriptableInterface.h:33
const SCRIPTINTERFACEID_t SCRIPTINTERFACEID_MAX
Definition: cScriptableInterface.h:36
UINT XOBJ_DUMP_MASK_t
enum XOBJ_DUMP_MASK_
Definition: cScriptableInterface.h:51
BYTE SCRIPTPROPID_t
index to method or prop.
Definition: cScriptableEventsMask.h:28
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
HASHCODE32_t ATOMCODE_t
Encode a atom as a 32 bit hashcode instead of using its name/pointer. StrT::GetHashCode32()
Definition: cAtom.h:18
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
std::type_info TYPEINFO_t
Definition: cTypeInfo.h:29
uint16 index
Definition: sample3.cpp:29
static bool IsCSymF(wchar_t ch) noexcept
Definition: StrChar.h:194
static __DECL_IMPORT ITERATE_t __stdcall TableFindHeadSorted(const TYPE *pszFindHead, const void *ppszTableInit, ITERATE_t iCountMax, size_t nElemSize=sizeof(const TYPE *))
static bool IsValidApp(const void *pData) noexcept
Definition: cMem.h:42