My Project
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NPL::NPL_C_Func_ActivationFile Class Reference

for automatic C function NPL.activate() without registration. More...

#include <NPLActivationFile.h>

Inheritance diagram for NPL::NPL_C_Func_ActivationFile:
NPL::INPLActivationFile

Public Types

typedef NPL::NPLReturnCode(* NPL_Activate_CallbackFunc) (INPLRuntimeState *pState)
 

Public Member Functions

 NPL_C_Func_ActivationFile (const std::string &filename)
 
virtual NPL::NPLReturnCode OnActivate (INPLRuntimeState *pState)
 Function to be called when NPL.activate(filename, {msg}); subclass should always overwrite this function. More...
 
- Public Member Functions inherited from NPL::INPLActivationFile
void addref () const
 add reference count of the object. More...
 
bool delref () const
 decrease reference count of the object. More...
 
int GetRefCount () const
 get the reference count
 
virtual int Release ()
 

Protected Member Functions

void SetFunctionByName (const std::string &filename)
 

Protected Attributes

NPL_Activate_CallbackFunc m_pFuncCallBack
 
- Protected Attributes inherited from NPL::INPLActivationFile
int m_refcount
 

Detailed Description

for automatic C function NPL.activate() without registration.

for example, you have a static C function named as below. must be qualified as extern "C" to avoid the symbol name being mangled. extern "C"{ NPL::NPLReturnCode NPL_activate_script_helloworld_cpp(INPLRuntimeState* pState); } NPL.activate("script/helloworld.cpp", {}) or NPL.activate("script_helloworld.cpp", {}) will both activate it, however 2 instances of this class object is created.

Note
: for security reasons, function name must match NPL_activate_XXXX_cpp.

Member Function Documentation

§ OnActivate()

NPL::NPLReturnCode NPL::NPL_C_Func_ActivationFile::OnActivate ( INPLRuntimeState pState)
virtual

Function to be called when NPL.activate(filename, {msg}); subclass should always overwrite this function.

usage: the input message in secure code format. Read data as follows: auto msg = NPLHelper::MsgStringToNPLTable(pState->GetCurrentMsg(), pState->GetCurrentMsgLength()); std::string sType = msg["type"];

Implements NPL::INPLActivationFile.


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