Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cScriptContext Class Reference

#include <cScriptContext.h>

Inheritance diagram for GrayLib::cScriptContext:
GrayLib::cExpressionContext Gray::CObject

Public Types

enum  M_TYPE_ { M_QTY }
 
typedef cExpressionContext CSCRIPTABLE_SUPER_t
 
- Public Types inherited from GrayLib::cExpressionContext
enum  M_TYPE_ { M_QTY }
 

Public Member Functions

 cScriptContext (IAuthUser *pAuth=nullptr, cStreamOutput *pOutConsole=nullptr)
 
 cScriptContext (IAuthUser *pAuth, cStreamOutput *pOutConsole, IXObject *pBaseObj)
 
 cScriptContext (IAuthUser *pAuth, cStreamOutput *pOutConsole, IXObject *pBaseObj, PLEVEL_TYPE ePrivLevel)
 
 cScriptContext (cScriptContext *pContextToDupe)
 
virtual ~cScriptContext ()
 
virtual cScriptableInterfaceDefPtr _stdcall get_ScriptInterfaceDef () const
 
STDMETHOD() s_InvokeExec (const cScriptableMethod *pFunc, const cVariant &vArgs, OUT cVariant &vValRet)
 
virtual bool isValidCheck () const noexcept override
 < memory allocation and structure definitions are valid. More...
 
cString get_ContextName () const
 
void put_SrcAuth (IAuthUser *pAuth) noexcept
 
IAuthUserget_SrcAuth () const noexcept
 
void put_SrcConsole (cStreamOutput *pOutConsole)
 
cStreamOutputget_SrcConsole () const
 Client. More...
 
cScriptableObjget_SrcObj () const
 Attached m_pOutConsole is really a Client avatar char ? More...
 
PLEVEL_TYPE get_ExecPrivLevel () const noexcept
 
void put_ExecPrivLevel (PLEVEL_TYPE ePrivLevel) noexcept
 
void put_ExecPrivLevelMin (PLEVEL_TYPE ePrivLevel=PLEVEL_Admin) noexcept
 
cIUnkPtr< IXObjectget_BaseObject () const noexcept
 
void put_BaseObject (IXObject *pObj) noexcept
 
cString get_BaseObjName () const
 
virtual cScriptContextDupeContext (cScriptContext *pNew) const
 
- Public Member Functions inherited from GrayLib::cExpressionContext
virtual ~cExpressionContext ()
 
STDMETHOD() s_InvokeExec (const cScriptableMethod *pFunc, const cVariant &vArgs, cVariant &vValRet)
 
- Public Member Functions inherited from Gray::CObject
virtual ~CObject ()
 
virtual void AssertValid () const
 < memory allocation and structure definitions are valid. More...
 
virtual void Serialize (cArchive &a)
 

Public Attributes

cVarMap m_ArgMap
 local variables and arguments for this context. NOT the same as function_name(args).
More...
 

Static Public Attributes

static cScriptableMethod sm_Methods [M_QTY+1]
 
static cScriptableInterfaceDef sm_ScriptInterfaceDef
 
- Static Public Attributes inherited from GrayLib::cExpressionContext
static cScriptableInterfaceDef sm_ScriptInterfaceDef
 
static cScriptableMethod sm_Methods [M_QTY+1]
 

Additional Inherited Members

- Protected Member Functions inherited from GrayLib::cExpressionContext
 cExpressionContext ()
 

Detailed Description

Current Context for some script execution. (base/default/this object + arguments + local variables + return value + authorization level + output console, etc)

Note
sub function calls should get their own copy of cScriptContext. Usually stack based (Except for m_pContextRoot (the root/default/global context)) cExpressionContext revokes this context on destruction.
Unrelated to the actual script execution engine used to exec this. Script source can be any type: GrayScript, JavaScript, LUA, COM, etc

Member Typedef Documentation

◆ CSCRIPTABLE_SUPER_t

Member Enumeration Documentation

◆ M_TYPE_

Enumerator
M_QTY 

Constructor & Destructor Documentation

◆ cScriptContext() [1/4]

GrayLib::cScriptContext::cScriptContext ( IAuthUser pAuth = nullptr,
cStreamOutput pOutConsole = nullptr 
)

◆ cScriptContext() [2/4]

GrayLib::cScriptContext::cScriptContext ( IAuthUser pAuth,
cStreamOutput pOutConsole,
IXObject pBaseObj 
)

assuming this is always stack based, we can assume create/destruct will happen in order. NOT stack based in the case of m_pContextRoot.

◆ cScriptContext() [3/4]

GrayLib::cScriptContext::cScriptContext ( IAuthUser pAuth,
cStreamOutput pOutConsole,
IXObject pBaseObj,
PLEVEL_TYPE  ePrivLevel 
)

◆ cScriptContext() [4/4]

GrayLib::cScriptContext::cScriptContext ( cScriptContext pContextToDupe)

Dupe previous context but don't copy m_ArgMap like DupeContext()

◆ ~cScriptContext()

GrayLib::cScriptContext::~cScriptContext ( )
virtual
Note
~cExpressionContext destruct will revoke this as current content.

Member Function Documentation

◆ DupeContext()

cScriptContext * GrayLib::cScriptContext::DupeContext ( cScriptContext pNew) const
virtual

◆ get_BaseObject()

cIUnkPtr<IXObject> GrayLib::cScriptContext::get_BaseObject ( ) const
inlinenoexcept

CIXObjPtr 'This' object in GrayScript Assume this is the root object if this is the default context.

◆ get_BaseObjName()

cString GrayLib::cScriptContext::get_BaseObjName ( ) const

Readable name of the base object.

◆ get_ContextName()

cString GrayLib::cScriptContext::get_ContextName ( ) const

readable name of the authorizing object.

◆ get_ExecPrivLevel()

PLEVEL_TYPE GrayLib::cScriptContext::get_ExecPrivLevel ( ) const
inlinenoexcept

We can temporarily get a higher privilege level for some ops.

◆ get_ScriptInterfaceDef()

virtual cScriptableInterfaceDefPtr _stdcall GrayLib::cScriptContext::get_ScriptInterfaceDef ( ) const
inlinevirtual

Reimplemented from GrayLib::cExpressionContext.

◆ get_SrcAuth()

IAuthUser* GrayLib::cScriptContext::get_SrcAuth ( ) const
inlinenoexcept

< Who caused this to run? (account) For security purposes.

◆ get_SrcConsole()

cStreamOutput * GrayLib::cScriptContext::get_SrcConsole ( ) const

Client.

Get the current console for the context of this script exec.

Returns
NEVER nullptr

Direct the text out to the log by default. Not typical.

◆ get_SrcObj()

cScriptableObj * GrayLib::cScriptContext::get_SrcObj ( ) const

Attached m_pOutConsole is really a Client avatar char ?

The m_pOutConsole can itself be some complex cScriptableObj. Overload this to provide some source world object ? (avatar char vs client)

◆ isValidCheck()

virtual bool GrayLib::cScriptContext::isValidCheck ( ) const
inlineoverridevirtualnoexcept

< memory allocation and structure definitions are valid.

NOT in MFC so use COBJECT_IsValidCheck to call.

Note
This can't be called in constructors and destructors of course !

Reimplemented from GrayLib::cExpressionContext.

◆ put_BaseObject()

void GrayLib::cScriptContext::put_BaseObject ( IXObject pObj)
inlinenoexcept

This can change for a given context Assume this is the root object if this is the default context.

◆ put_ExecPrivLevel()

void GrayLib::cScriptContext::put_ExecPrivLevel ( PLEVEL_TYPE  ePrivLevel)
inlinenoexcept

Change to a different exec privilege level. (>m_pAuth->get_PrivLevel()) typically used to raise privilege level temporarily for a script.

◆ put_ExecPrivLevelMin()

void GrayLib::cScriptContext::put_ExecPrivLevelMin ( PLEVEL_TYPE  ePrivLevel = PLEVEL_Admin)
inlinenoexcept

typically used to raise privilege level temporarily for a script.

◆ put_SrcAuth()

void GrayLib::cScriptContext::put_SrcAuth ( IAuthUser pAuth)
inlinenoexcept

Assign new authorization to the context. Change in account ?

◆ put_SrcConsole()

void GrayLib::cScriptContext::put_SrcConsole ( cStreamOutput pOutConsole)
inline

Assign new output console to the context. what to do with error output.

◆ s_InvokeExec()

HRESULT GrayLib::cScriptContext::s_InvokeExec ( const cScriptableMethod pFunc,
const cVariant vArgs,
OUT cVariant vValRet 
)

Evaluate an identifier in an expression. Skip to the end of the identifier name (and args). Allow this to be overridden.

Member Data Documentation

◆ m_ArgMap

cVarMap GrayLib::cScriptContext::m_ArgMap

local variables and arguments for this context. NOT the same as function_name(args).

◆ sm_Methods

cScriptableMethod GrayLib::cScriptContext::sm_Methods
static
Initial value:
=
{
#define cScriptContextFunc(a,b,c,d)
}
#define CSCRIPT_PROP_END
Definition: cScriptableInterface.h:264

◆ sm_ScriptInterfaceDef

cScriptableInterfaceDef GrayLib::cScriptContext::sm_ScriptInterfaceDef
static

The documentation for this class was generated from the following files: