cppexpose
1.0.0.b785e04f23b8
C++ library for type introspection, reflection, and scripting interface
|
The entry point to managing scripting in your application. More...
#include <cppexpose/include/cppexpose/scripting/ScriptContext.h>
Public Member Functions | |
ScriptContext (const std::string &backend="javascript") | |
Constructor. More... | |
ScriptContext (std::unique_ptr< AbstractScriptBackend > &&backend) | |
Constructor. More... | |
virtual | ~ScriptContext () |
Destructor. More... | |
const std::set< Object * > & | globalObjects () const |
Get global objects. More... | |
void | addGlobalObject (Object *obj) |
Add global object. More... | |
void | removeGlobalObject (Object *obj) |
Remove global object. More... | |
Variant | evaluate (const std::string &code) |
Execute script. More... | |
Public Attributes | |
Signal< const std::string & > | scriptException |
Called when a script triggered an exception. More... | |
Protected Attributes | |
std::unique_ptr< AbstractScriptBackend > | m_backend |
Scripting backend (can be null) More... | |
std::set< Object * > | m_globalObjects |
Global objects that are exposed to the scripting environment. More... | |
The entry point to managing scripting in your application.
cppexpose::ScriptContext::ScriptContext | ( | const std::string & | backend = "javascript" | ) |
Constructor.
[in] | backend | Name of the backend (supported: "javascript") |
cppexpose::ScriptContext::ScriptContext | ( | std::unique_ptr< AbstractScriptBackend > && | backend | ) |
Constructor.
[in] | backend | Scripting backend (must NOT be null) |
|
virtual |
Destructor.
const std::set<Object *>& cppexpose::ScriptContext::globalObjects | ( | ) | const |
Get global objects.
void cppexpose::ScriptContext::addGlobalObject | ( | Object * | obj | ) |
Add global object.
[in] | obj | Global object (must NOT be null) |
void cppexpose::ScriptContext::removeGlobalObject | ( | Object * | obj | ) |
Remove global object.
[in] | obj | Global object (must NOT be null) |
Variant cppexpose::ScriptContext::evaluate | ( | const std::string & | code | ) |
Execute script.
[in] | code | Scripting code |
Signal<const std::string &> cppexpose::ScriptContext::scriptException |
Called when a script triggered an exception.
|
protected |
Scripting backend (can be null)
|
protected |
Global objects that are exposed to the scripting environment.