PikaScript
|
Variables is an abstract base class which implements the interface to the variable space that a Frame works on. More...
#include <PikaScript.h>
Public Member Functions | |
virtual bool | lookup (const String &symbol, Value &result)=0 |
Lookup symbol . More... | |
virtual bool | assign (const String &symbol, const Value &value)=0 |
Assign value to symbol and return true if the assignment succeeded. More... | |
virtual bool | erase (const String &symbol)=0 |
Erase symbol . Return true if the symbol existed and was successfully erased. | |
virtual void | list (const String &key, VarList &list)=0 |
Iterate all symbols that begins with key and push back names and values to list . More... | |
virtual Native * | lookupNative (const String &identifier)=0 |
Lookup the native function (or object) with identifier . More... | |
virtual bool | assignNative (const String &identifier, Native *native)=0 |
Assign the native function (or object) native to identifier , replacing any already existing definition. More... | |
virtual | ~Variables () |
Destructor. More... | |
virtual bool | lookup (const String &symbol, Value &result)=0 |
Lookup symbol . More... | |
virtual bool | assign (const String &symbol, const Value &value)=0 |
Assign value to symbol and return true if the assignment succeeded. More... | |
virtual bool | erase (const String &symbol)=0 |
Erase symbol . Return true if the symbol existed and was successfully erased. | |
virtual void | list (const String &key, VarList &list)=0 |
Iterate all symbols that begins with key and push back names and values to list . More... | |
virtual Native * | lookupNative (const String &identifier)=0 |
Lookup the native function (or object) with identifier . More... | |
virtual bool | assignNative (const String &identifier, Native *native)=0 |
Assign the native function (or object) native to identifier , replacing any already existing definition. More... | |
virtual | ~Variables () |
Destructor. More... | |
Variables is an abstract base class which implements the interface to the variable space that a Frame works on.
In the configuration meta-class class (Script::Config) two typedefs exist that determines which sub-classes of Variables should be used for the "root frame" (= Globals) and subsequently for the "sub-frames" (= Locals).
A standard Variables class is supplied in this header file (STLVariables). Custom sub-classes are useful for optimization and special integration needs.
Notice that the separation of Frames and Variables makes it possible to have more than one Frame referencing the same variable space. This could be useful for example in a threaded situation where several concurrent threads running PikaScript should share global variables. In this case each thread should still have a distinct "root frame" and you need to implement a sub-class of Variables that accesses its data in a thread-safe manner.
Definition at line 291 of file PikaScript.h.
|
virtual |
Destructor.
Don't forget to delete all registered natives.
Definition at line 1058 of file PikaScriptImpl.h.
|
virtual |
Destructor.
Don't forget to delete all registered natives.
|
pure virtual |
Assign value
to symbol
and return true if the assignment succeeded.
If false is returned, the calling Frame::set() will throw an exception.
|
pure virtual |
Assign value
to symbol
and return true if the assignment succeeded.
If false is returned, the calling Frame::set() will throw an exception.
|
pure virtual |
Assign the native function (or object) native
to identifier
, replacing any already existing definition.
Once assigned, the native is considered "owned" by this variable space. This class is responsible for deleting its natives on destruction and also delete the existing definition when an identifier is being reassigned.
|
pure virtual |
Assign the native function (or object) native
to identifier
, replacing any already existing definition.
Once assigned, the native is considered "owned" by this variable space. This class is responsible for deleting its natives on destruction and also delete the existing definition when an identifier is being reassigned.
|
pure virtual |
Iterate all symbols that begins with key
and push back names and values to list
.
There are no requirements on the order of the listed elements. You should not erase the list at the beginning.
|
pure virtual |
Iterate all symbols that begins with key
and push back names and values to list
.
There are no requirements on the order of the listed elements. You should not erase the list at the beginning.
|
pure virtual |
Lookup symbol
.
If found, store the found value in result
and return true, otherwise return false.
|
pure virtual |
Lookup symbol
.
If found, store the found value in result
and return true, otherwise return false.
|
pure virtual |
Lookup the native function (or object) with identifier
.
Return 0 if the native could not be found. In this case, the caller will throw an exception.
|
pure virtual |
Lookup the native function (or object) with identifier
.
Return 0 if the native could not be found. In this case, the caller will throw an exception.