The interface for a script. More...
#include <script.h>
Public Member Functions | |
iScript () | |
default constructor More... | |
virtual void | AddArgument (CountedPtr< iScriptArgument > Arg)=0 |
This adds an argument to be passed to the script. More... | |
virtual bool | CanReturnMultples () |
Does this script support multiple return values. More... | |
virtual void | ClearArguments ()=0 |
Remove all the ARGs!!! http://imgur.com/DJhw7. More... | |
Whole | DecrementReferenceCount () |
Decrease the reference count by one and return the updated count. More... | |
virtual CountedPtr < iScriptArgument > | GetArgument (Whole ArgNumber) const =0 |
Retrieve a argument previously passed in. More... | |
virtual Whole | GetArgumentCount () const =0 |
How many arguments have been attached to this script? More... | |
virtual iScriptMultipleReturn * | GetAsiScriptMultipleReturn () |
If your only handle to this is a pointer of type iScript this can be called to get a pointer to an iScriptMultipleReturn if it would be valid. More... | |
virtual iScriptCompilable * | GetAsScriptCompilable () |
If your only handle to this is a pointer of type iScript this can be called to get a pointer to an iScriptCompilable if it would be valid. More... | |
virtual iScriptCompilable * | GetAsScriptCompilable () const |
If your only handle to this is a pointer of type iScript this can be called to get a pointer to an iScriptCompilable if it would be valid. More... | |
virtual iScript * | GetMostDerived () |
Get a pointer to the most Derived type of this class. More... | |
Whole | GetReferenceCount () |
Get the current amount of references. More... | |
virtual iScript * | GetReferenceCountTargetAsPointer () |
Gets the actual pointer to the target. More... | |
virtual String | GetSourceCode () const =0 |
If present this returns the code of script. More... | |
Whole | IncrementReferenceCount () |
Increase the reference count by one and return the updated count. More... | |
virtual bool | IsCompilable () const |
Used to check if this Script supports compilation bytecode. More... | |
virtual bool | IsCompiled () const |
Used to check if there is a bytecode version of the script available. More... | |
virtual void | RemoveArgument (CountedPtr< iScriptArgument > Arg)=0 |
Remove an argument based on a CountedPtr to the script. More... | |
virtual void | RemoveArgument (Whole ArgNumber)=0 |
Remove a Script argument based on the order it will be passed into the Script at Execution. More... | |
virtual void | SetSourceCode (const String &Code)=0 |
Sets the string version of the script. More... | |
Protected Attributes | |
Whole | RefCount |
This is the Counter that stores how many references exist. | |
The interface for a script.
All the methods that all scripts for all languages must implement. These are tiny pieces of data that can be run like miniature programs.
These can be executed by passing them to the appropriate Script Manager.
This uses multiple inheritance to minimize the amount of features a scripting langauge with need to implement. It is expected that a simple scripting language may only need to implement the base iScript interface. Other languages that support more features can have their script classes multiply inherit from the other classes like
|
inline |
|
pure virtual |
This adds an argument to be passed to the script.
All arguments added with this are passed in FIFO order to the Script during or just before execution. This should normally run in constant time. Some scripting implementations may change the order arguments are passed if doing it another way mays more sense.
Arg | This accepts a CountedPtr to a script argument and The script shares responsibility with caller for deleting the argument. |
|
inlinevirtual |
Does this script support multiple return values.
Some scripting language support return tuples of values(Python), return an array of values (javascript), returning tables made of records which are groups of values(sql), and some allow return an arbitrary number of items that could be tables, or values and allow for tables to contain more tables and values(Lua). This allows for checking for an interface to retrieve some of these.
|
pure virtual |
Remove all the ARGs!!! http://imgur.com/DJhw7.
This should run in constant time. It still might be slower than removing and readding just one a few arguments in simple cases
|
inline |
|
pure virtual |
Retrieve a argument previously passed in.
ArgNumber | The index of the passed parameter to retrun. |
|
pure virtual |
How many arguments have been attached to this script?
|
inlinevirtual |
If your only handle to this is a pointer of type iScript this can be called to get a pointer to an iScriptMultipleReturn if it would be valid.
Reimplemented in Mezzanine::Scripting::iScriptMultipleReturn.
|
inlinevirtual |
If your only handle to this is a pointer of type iScript this can be called to get a pointer to an iScriptCompilable if it would be valid.
Reimplemented in Mezzanine::Scripting::iScriptCompilable.
|
inlinevirtual |
If your only handle to this is a pointer of type iScript this can be called to get a pointer to an iScriptCompilable if it would be valid.
|
inlinevirtual |
Get a pointer to the most Derived type of this class.
Reimplemented in Mezzanine::Scripting::iScriptMultipleReturn, and Mezzanine::Scripting::iScriptCompilable.
|
inline |
|
inlinevirtual |
|
pure virtual |
If present this returns the code of script.
|
inline |
|
inlinevirtual |
Used to check if this Script supports compilation bytecode.
Reimplemented in Mezzanine::Scripting::iScriptCompilable.
|
inlinevirtual |
Used to check if there is a bytecode version of the script available.
Reimplemented in Mezzanine::Scripting::iScriptCompilable.
|
pure virtual |
Remove an argument based on a CountedPtr to the script.
This searches through the internal list and removes the first entry it finds matching this. This should be treated as taking linear time, relative to the total count of arguments assigned to this script, to run. This can be used with AddArgument to re-order the way parameters are passed into a script
Arg | A CountedPtr matching the one to be removed |
|
pure virtual |
Remove a Script argument based on the order it will be passed into the Script at Execution.
This removes the specified Argument from the internal list. This should be treated as taking linear time, relative to the total count of arguments assigned to this script, to run.
ArgNumber | The number of the Argument to be removed. This behaves similar to an array or vector as it starts counting at 0. |
|
pure virtual |
Sets the string version of the script.
Code | A string that defines the source code to be executed or compiled whne running the script. |
It is recomended that when this is called that implentors clear any bytecode or any other compiled version of the script. This will prevent issues with mismatched version of source and bytecode.