PixelLightAPI
.
|
Abstract script base class. More...
#include <Script.h>
Public Member Functions | |
virtual PLCORE_API | ~Script () |
Destructor. | |
PLCORE_API String | GetScriptLanguage () const |
Returns the name of the script language the script is using. | |
PLCORE_API void | GetFormats (Array< String > &lstFormats) const |
Returns a list of file formats this script supports. | |
PLCORE_API void | AddBinding (Object &cObject, const String &sNamespace="") |
Adds a script binding to connect the given RTTI class instance with this script. | |
PLCORE_API void | AddBindings () |
Add all script bindings to this script. | |
virtual bool | IsGlobalFunction (const String &sName, const String &sNamespace="")=0 |
Returns whether or not the given name belongs to a global function. | |
virtual bool | AddGlobalFunction (const String &sFunction, const DynFunc &cDynFunc, const String &sNamespace="")=0 |
Adds a global function to the script. | |
virtual bool | RemoveAllGlobalFunctions ()=0 |
Removes all global functions from the script. | |
virtual String | GetSourceCode () const =0 |
Returns the script source code. | |
virtual bool | SetSourceCode (const String &sSourceCode)=0 |
Sets the script source code. | |
virtual void | GetGlobalVariables (Array< String > &lstGlobalVariables, const String &sNamespace="")=0 |
Adds the names of found global variables to a given list. | |
virtual bool | IsGlobalVariable (const String &sName, const String &sNamespace="")=0 |
Returns whether or not the given name belongs to a global variable. | |
virtual ETypeID | GetGlobalVariableTypeID (const String &sName, const String &sNamespace="")=0 |
Returns the type ID a global variable. | |
virtual String | GetGlobalVariable (const String &sName, const String &sNamespace="")=0 |
Returns the current value of a global variable. | |
virtual void | SetGlobalVariable (const String &sName, const DynVar &cValue, const String &sNamespace="")=0 |
Sets the current value of a global variable. | |
virtual bool | BeginCall (const String &sFunctionName, const String &sFunctionSignature, const String &sNamespace="")=0 |
Starts a function call. | |
virtual void | PushArgument (bool bValue)=0 |
Pushes an argument required for the current function call. | |
virtual void | PushArgument (float fValue)=0 |
virtual void | PushArgument (double fValue)=0 |
virtual void | PushArgument (int8 nValue)=0 |
virtual void | PushArgument (int16 nValue)=0 |
virtual void | PushArgument (int32 nValue)=0 |
virtual void | PushArgument (int64 nValue)=0 |
virtual void | PushArgument (uint8 nValue)=0 |
virtual void | PushArgument (uint16 nValue)=0 |
virtual void | PushArgument (uint32 nValue)=0 |
virtual void | PushArgument (uint64 nValue)=0 |
virtual void | PushArgument (const String &sString)=0 |
virtual void | PushArgument (Object *pObject)=0 |
virtual void | PushArgument (Object &cObject)=0 |
virtual bool | EndCall ()=0 |
Ends a function call. | |
virtual bool | GetReturn (bool nValue)=0 |
Returns the result of a function call. | |
virtual float | GetReturn (float nValue)=0 |
virtual double | GetReturn (double nValue)=0 |
virtual int8 | GetReturn (int8 nValue)=0 |
virtual int16 | GetReturn (int16 nValue)=0 |
virtual int32 | GetReturn (int32 nValue)=0 |
virtual int64 | GetReturn (int64 nValue)=0 |
virtual uint8 | GetReturn (uint8 nValue)=0 |
virtual uint16 | GetReturn (uint16 nValue)=0 |
virtual uint32 | GetReturn (uint32 nValue)=0 |
virtual uint64 | GetReturn (uint64 nValue)=0 |
virtual String | GetReturn (String nValue)=0 |
virtual Object * | GetReturn (Object *nValue)=0 |
virtual Object & | GetReturn (Object &nValue)=0 |
Protected Member Functions | |
PLCORE_API | Script () |
Constructor. | |
PLCORE_API bool | LogOutput (uint8 nLogLevel, const String &sText) |
Write a string into the log. |
Abstract script base class.
Supported script features:
Supported primitive data types: bool, float, double, int8, int16, int32, int64, uint8, uint16, uint32, uint64, PLCore::Object*, PLCore::Object& Please note that not each script language/API may make such a detailed data type distinction. Because strings are fundamental within scripts, String is supported as well.
virtual PLCORE_API PLCore::Script::~Script | ( | ) | [virtual] |
Destructor.
PLCORE_API PLCore::Script::Script | ( | ) | [protected] |
PLCORE_API String PLCore::Script::GetScriptLanguage | ( | ) | const |
Returns the name of the script language the script is using.
PLCORE_API void PLCore::Script::GetFormats | ( | Array< String > & | lstFormats | ) | const |
Returns a list of file formats this script supports.
[out] | lstFormats | List of file formats this script supports (the given list is not cleared before new entries are added) |
PLCORE_API void PLCore::Script::AddBinding | ( | Object & | cObject, |
const String & | sNamespace = "" |
||
) |
Adds a script binding to connect the given RTTI class instance with this script.
[in] | cObject | RTTI class instance, must stay valid as long as this script lives |
[in] | sNamespace | Optional namespace (e.g. "MyNamespace", "MyNamespace.MyOtherNamespace" and so on) |
PLCORE_API void PLCore::Script::AddBindings | ( | ) |
Add all script bindings to this script.
virtual bool PLCore::Script::IsGlobalFunction | ( | const String & | sName, |
const String & | sNamespace = "" |
||
) | [pure virtual] |
Returns whether or not the given name belongs to a global function.
[in] | sName | Name of the global function |
[in] | sNamespace | Optional namespace (e.g. "MyNamespace", "MyNamespace.MyOtherNamespace" and so on) |
virtual bool PLCore::Script::AddGlobalFunction | ( | const String & | sFunction, |
const DynFunc & | cDynFunc, | ||
const String & | sNamespace = "" |
||
) | [pure virtual] |
Adds a global function to the script.
[in] | sFunction | Function name used inside the script to call the global function |
[in] | cDynFunc | Dynamic function |
[in] | sNamespace | Optional namespace (e.g. "MyNamespace", "MyNamespace.MyOtherNamespace" and so on) |
virtual bool PLCore::Script::RemoveAllGlobalFunctions | ( | ) | [pure virtual] |
Removes all global functions from the script.
virtual String PLCore::Script::GetSourceCode | ( | ) | const [pure virtual] |
Returns the script source code.
virtual bool PLCore::Script::SetSourceCode | ( | const String & | sSourceCode | ) | [pure virtual] |
Sets the script source code.
[in] | sSourceCode | Script source code, usually blank ASCII code, empty string to set to script at all |
virtual void PLCore::Script::GetGlobalVariables | ( | Array< String > & | lstGlobalVariables, |
const String & | sNamespace = "" |
||
) | [pure virtual] |
Adds the names of found global variables to a given list.
[out] | lstGlobalVariables | List to be filled with the names (without namespace) of the found global variables, the given list is not cleared before new entries are added |
[in] | sNamespace | Optional namespace (e.g. "MyNamespace", "MyNamespace.MyOtherNamespace" and so on) |
virtual bool PLCore::Script::IsGlobalVariable | ( | const String & | sName, |
const String & | sNamespace = "" |
||
) | [pure virtual] |
Returns whether or not the given name belongs to a global variable.
[in] | sName | Name of the global variable |
[in] | sNamespace | Optional namespace (e.g. "MyNamespace", "MyNamespace.MyOtherNamespace" and so on) |
virtual ETypeID PLCore::Script::GetGlobalVariableTypeID | ( | const String & | sName, |
const String & | sNamespace = "" |
||
) | [pure virtual] |
Returns the type ID a global variable.
[in] | sName | Name of the global variable |
[in] | sNamespace | Optional namespace (e.g. "MyNamespace", "MyNamespace.MyOtherNamespace" and so on) |
virtual String PLCore::Script::GetGlobalVariable | ( | const String & | sName, |
const String & | sNamespace = "" |
||
) | [pure virtual] |
Returns the current value of a global variable.
[in] | sName | Name of the global variable |
[in] | sNamespace | Optional namespace (e.g. "MyNamespace", "MyNamespace.MyOtherNamespace" and so on) |
virtual void PLCore::Script::SetGlobalVariable | ( | const String & | sName, |
const DynVar & | cValue, | ||
const String & | sNamespace = "" |
||
) | [pure virtual] |
Sets the current value of a global variable.
[in] | sName | Name of the global variable |
[in] | cValue | New value of the global variable |
[in] | sNamespace | Optional namespace (e.g. "MyNamespace", "MyNamespace.MyOtherNamespace" and so on) |
virtual bool PLCore::Script::BeginCall | ( | const String & | sFunctionName, |
const String & | sFunctionSignature, | ||
const String & | sNamespace = "" |
||
) | [pure virtual] |
Starts a function call.
[in] | sFunctionName | Name of the function to call |
[in] | sFunctionSignature | Signature of the function to call (e.g. "void(int,float)") |
[in] | sNamespace | Optional namespace (e.g. "MyNamespace", "MyNamespace.MyOtherNamespace" and so on) |
virtual void PLCore::Script::PushArgument | ( | bool | bValue | ) | [pure virtual] |
Pushes an argument required for the current function call.
[in] | nValue | Argument value |
virtual void PLCore::Script::PushArgument | ( | float | fValue | ) | [pure virtual] |
virtual void PLCore::Script::PushArgument | ( | double | fValue | ) | [pure virtual] |
virtual void PLCore::Script::PushArgument | ( | int8 | nValue | ) | [pure virtual] |
virtual void PLCore::Script::PushArgument | ( | int16 | nValue | ) | [pure virtual] |
virtual void PLCore::Script::PushArgument | ( | int32 | nValue | ) | [pure virtual] |
virtual void PLCore::Script::PushArgument | ( | int64 | nValue | ) | [pure virtual] |
virtual void PLCore::Script::PushArgument | ( | uint8 | nValue | ) | [pure virtual] |
virtual void PLCore::Script::PushArgument | ( | uint16 | nValue | ) | [pure virtual] |
virtual void PLCore::Script::PushArgument | ( | uint32 | nValue | ) | [pure virtual] |
virtual void PLCore::Script::PushArgument | ( | uint64 | nValue | ) | [pure virtual] |
virtual void PLCore::Script::PushArgument | ( | const String & | sString | ) | [pure virtual] |
virtual void PLCore::Script::PushArgument | ( | Object * | pObject | ) | [pure virtual] |
virtual void PLCore::Script::PushArgument | ( | Object & | cObject | ) | [pure virtual] |
virtual bool PLCore::Script::EndCall | ( | ) | [pure virtual] |
Ends a function call.
virtual bool PLCore::Script::GetReturn | ( | bool | nValue | ) | [pure virtual] |
Returns the result of a function call.
[in] | nValue | Unused value... just there so the compiler can figure out the proper method |
virtual float PLCore::Script::GetReturn | ( | float | nValue | ) | [pure virtual] |
virtual double PLCore::Script::GetReturn | ( | double | nValue | ) | [pure virtual] |
virtual int8 PLCore::Script::GetReturn | ( | int8 | nValue | ) | [pure virtual] |
virtual int16 PLCore::Script::GetReturn | ( | int16 | nValue | ) | [pure virtual] |
virtual int32 PLCore::Script::GetReturn | ( | int32 | nValue | ) | [pure virtual] |
virtual int64 PLCore::Script::GetReturn | ( | int64 | nValue | ) | [pure virtual] |
virtual uint8 PLCore::Script::GetReturn | ( | uint8 | nValue | ) | [pure virtual] |
virtual uint16 PLCore::Script::GetReturn | ( | uint16 | nValue | ) | [pure virtual] |
virtual uint32 PLCore::Script::GetReturn | ( | uint32 | nValue | ) | [pure virtual] |
virtual uint64 PLCore::Script::GetReturn | ( | uint64 | nValue | ) | [pure virtual] |
virtual String PLCore::Script::GetReturn | ( | String | nValue | ) | [pure virtual] |
virtual Object* PLCore::Script::GetReturn | ( | Object * | nValue | ) | [pure virtual] |
virtual Object& PLCore::Script::GetReturn | ( | Object & | nValue | ) | [pure virtual] |
PLCORE_API bool PLCore::Script::LogOutput | ( | uint8 | nLogLevel, |
const String & | sText | ||
) | [protected] |
Write a string into the log.
[in] | nLogLevel | Log level |
[in] | sText | Text which should be written into the log |
|