MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
Mezzanine::Scripting::iScriptCompilable Class Referenceabstract

The interface for a script that can be compiled to bytecode. More...

#include <script.h>

+ Inheritance diagram for Mezzanine::Scripting::iScriptCompilable:
+ Collaboration diagram for Mezzanine::Scripting::iScriptCompilable:

Public Member Functions

virtual iScriptCompilableGetAsScriptCompilable ()
 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 BinaryTools::BinaryBuffer GetByteCode () const =0
 Get the compiled version of the code if it is available. More...
 
virtual iScriptCompilableGetMostDerived ()
 Get a pointer to the most Derived type of this class. More...
 
virtual bool IsCompilable () const
 Any script implementing this class is compilable. More...
 
virtual bool IsCompiled () const =0
 Has this script already been compiled into a bytecode. More...
 
virtual void SetByteCode (BinaryTools::BinaryBuffer Code)=0
 Set the bytecode used when this script is executed. More...
 
- Public Member Functions inherited from Mezzanine::Scripting::iScript
 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 iScriptMultipleReturnGetAsiScriptMultipleReturn ()
 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 iScriptCompilableGetAsScriptCompilable () 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...
 
Whole GetReferenceCount ()
 Get the current amount of references. More...
 
virtual iScriptGetReferenceCountTargetAsPointer ()
 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 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...
 

Additional Inherited Members

- Protected Attributes inherited from Mezzanine::Scripting::iScript
Whole RefCount
 This is the Counter that stores how many references exist.
 

Detailed Description

The interface for a script that can be compiled to bytecode.

All the members that all script for all languages must implement that support dynamic compilation in the Mezzanine.

These are tiny pieces of data that can be run like miniature programs. In some cases they will be compiled to a bytecode that can swiftly be executed by the appropriate bytecode interpretter. This is generally faster than interpretting text, but slower than running machine code.

This class is designed for use with multiple inheritance. If a script returns true from IsCompilable then its pointer can safely be cast to a ScriptCompilable pointer.

Todo:

Add sample code of safe cast in ScriptCompilable, becuase that is kinda wierd.

Put the Virtual inheritance back into the this class

Definition at line 238 of file script.h.

Member Function Documentation

virtual iScriptCompilable* Mezzanine::Scripting::iScriptCompilable::GetAsScriptCompilable ( )
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.

Returns
A null pointer if this conversion is invalid or a valid pointer to this as an iScriptCompilable if it is valid.

Reimplemented from Mezzanine::Scripting::iScript.

Definition at line 262 of file script.h.

virtual BinaryTools::BinaryBuffer Mezzanine::Scripting::iScriptCompilable::GetByteCode ( ) const
pure virtual

Get the compiled version of the code if it is available.

Returns
If there is valid byte code this will retrieve that, otherwise this will return an empty bytecode.
virtual iScriptCompilable* Mezzanine::Scripting::iScriptCompilable::GetMostDerived ( )
inlinevirtual

Get a pointer to the most Derived type of this class.

Returns
A pointer of the most derived pointing to this.

Reimplemented from Mezzanine::Scripting::iScript.

Definition at line 267 of file script.h.

virtual bool Mezzanine::Scripting::iScriptCompilable::IsCompilable ( ) const
inlinevirtual

Any script implementing this class is compilable.

Returns
returns true.

Reimplemented from Mezzanine::Scripting::iScript.

Definition at line 259 of file script.h.

virtual bool Mezzanine::Scripting::iScriptCompilable::IsCompiled ( ) const
pure virtual

Has this script already been compiled into a bytecode.

Returns
True if there is bytecode available false otherwise.

Reimplemented from Mezzanine::Scripting::iScript.

virtual void Mezzanine::Scripting::iScriptCompilable::SetByteCode ( BinaryTools::BinaryBuffer  Code)
pure virtual

Set the bytecode used when this script is executed.

Parameters
CodeThe Binary version of the script

This is what will be executed. No reverse compiling support is provided, so it is advisable that implementations of this either clear the source code or set it to the source that matches the compiled binary.


The documentation for this class was generated from the following file: