28 #ifndef PTLIB_SCRIPT_H
29 #define PTLIB_SCRIPT_H
93 const char * script = NULL
195 void Push(
void * state);
196 void Pop(
void * state);
234 const char * sigString = NULL,
243 #define PDECLARE_ScriptFunctionNotifier(cls, fn) PDECLARE_NOTIFIER2(PScriptLanguage, cls, fn, PScriptLanguage::Signature &)
292 #endif // PTLIB_SCRIPT_H
virtual const PString & GetLastErrorText() const
Get the last error text for an operation.
Definition: script.h:263
virtual bool LoadFile(const PFilePath &filename)=0
Load a script from a file.
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:2164
virtual bool Load(const PString &script)
Load script from a file (if exists) or assume is the actual script.
Signature of Lua function and callback.
Definition: script.h:200
This class describes a full description for a file on the particular platform.
Definition: filepath.h:61
~PScriptLanguage()
Destroy the script context.
virtual double GetNumber(const PString &name)=0
Get a variable in the script as a number value.
virtual bool Call(const PString &name, const char *sigString=NULL,...)=0
Call a specific function in the script.
map< PString, FunctionNotifier > FunctionMap
Definition: script.h:277
virtual bool SetNumber(const PString &name, double value)=0
Set a variable in the script as a number value.
This is an array collection class of PString objects.
Definition: pstring.h:2365
ParamVector(size_t sz=0)
Definition: script.h:194
virtual bool ReleaseVariable(const PString &name)=0
Release a variable name.
FunctionMap m_functions
Definition: script.h:278
static PScriptLanguage * Create(const PString &language)
virtual bool InternalSetFunction(const PString &name, const FunctionNotifier &func)
virtual bool Run(const char *script=NULL)=0
Run the script.
virtual bool LoadText(const PString &text)=0
Load script text.
virtual bool SetFunction(const PString &name, const FunctionNotifier &func)=0
Set a notifier as a script callable function.
ParamVector m_results
Definition: script.h:203
ParamVector m_arguments
Definition: script.h:202
Individual Parameter in ParamVector.
Definition: script.h:192
The PNotifier and PNotifierFunction classes build a completely type safe mechanism for calling arbitr...
Definition: notifier.h:109
virtual void InternalRemoveFunction(const PString &prefix)
#define PFACTORY_LOAD(ConcreteType)
Definition: pfactory.h:557
virtual bool SetVar(const PString &name, const PVarType &var)=0
Set a variable in the script See class description for how name is parsed.
virtual bool CreateComposite(const PString &name)=0
Create a composite structure.
bool m_loaded
Definition: script.h:274
virtual bool IsInitialised() const =0
Indicate language has initialised successfully.
virtual void OnError(int code, const PString &str)
Set m_lastErrorCode and m_lastErrorText members, with mutex.
virtual bool SetString(const PString &name, const char *value)=0
Set a variable in the script as a string value.
static PStringArray GetLanguages()
virtual int GetLastErrorCode() const
Get the last error text for an operation.
Definition: script.h:260
The character string class.
Definition: pstring.h:108
virtual bool SetBoolean(const PString &name, bool value)=0
Set a variable in the script as a string value.
virtual bool SetInteger(const PString &name, int value)=0
Set a variable in the script as an integer value.
A wrapper around a scripting language instance.
Definition: script.h:43
virtual PString GetString(const PString &name)=0
Get a variable in the script as a string value.
virtual bool GetVar(const PString &name, PVarType &var)=0
Get a variable in the script See class description for how name is parsed.
PString m_lastErrorText
Definition: script.h:276
__inline bool IsLoaded() const
Rerturn true if script is successfully loaded.
Definition: script.h:257
Signature()
Definition: script.h:201
virtual PString GetLanguageName() const =0
Get the name of this scripting language.
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
int m_lastErrorCode
Definition: script.h:275
virtual bool GetBoolean(const PString &name)=0
Get a variable in the script as a string value.
PScriptLanguage()
Create a context in which to execute a script.
PNotifierTemplate< Signature & > FunctionNotifier
Definition: script.h:242
virtual int GetInteger(const PString &name)=0
Get a variable in the script as an integer value.