MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
Mezzanine::Scripting::ScriptArgumentGeneric< T > Class Template Reference

A generic implementation of a ScriptArgument that is suitable for primitive types in most situations. More...

#include <scriptargument.h>

+ Inheritance diagram for Mezzanine::Scripting::ScriptArgumentGeneric< T >:
+ Collaboration diagram for Mezzanine::Scripting::ScriptArgumentGeneric< T >:

Public Types

typedef T Type
 To make working with this easier.
 

Public Member Functions

 ScriptArgumentGeneric (T InitialValue)
 Create an initialized Argument. More...
 
virtual ~ScriptArgumentGeneric ()
 Overloadable Deconstructor.
 
virtual Boolean GetBool () const
 Get the Argument as a Bool. More...
 
virtual Integer GetInteger () const
 Get the Argument as a Integer, slow default implementation. More...
 
virtual ScriptArgumentGeneric
< T > * 
GetMostDerived ()
 Get a pointer to the most Derived type of this class. More...
 
virtual Real GetReal () const
 Get the Argument as a Real, slow default implementation. More...
 
virtual String GetString () const
 Get the Argument as a String, slow default implementation. More...
 
virtual Integer GetTypeData () const
 Get data about this having an unknown type. More...
 
virtual T GetValue () const
 Get the raw primitive to value. More...
 
virtual Whole GetWhole () const
 Get the Argument as a Whole, slow default implementation. More...
 
virtual Boolean IsNull () const
 Is this value representing a Null/Nil value. More...
 
virtual void SetValue (T NewValue)
 Provide an overload point to change assignment that operators will use. More...
 
- Public Member Functions inherited from Mezzanine::Scripting::iScriptArgument
virtual ~iScriptArgument ()
 Overidable Deconstructor.
 
- Public Member Functions inherited from Mezzanine::IntrusiveRefCount
 IntrusiveRefCount ()
 Constructor for instatiating the Reference Count.
 
virtual ~IntrusiveRefCount ()
 Virtual Deconstructor to prevent issues with deletion with incomplete type information.
 
Whole DecrementReferenceCount ()
 Decrease the reference count by one and return the updated count. More...
 
Whole GetReferenceCount () const
 Get the current amount of references. More...
 
IntrusiveRefCountGetReferenceCountTargetAsPointer ()
 Gets the actual pointer to the target. More...
 
Whole IncrementReferenceCount ()
 Increase the reference count by one and return the updated count. More...
 

Protected Attributes

Datum
 The actual data. More...
 

Detailed Description

template<class T>
class Mezzanine::Scripting::ScriptArgumentGeneric< T >

A generic implementation of a ScriptArgument that is suitable for primitive types in most situations.

Scripting languages the do not benefit from having different implementations per type should implement their argument subclass derived from this. This will attempt to provide basic type conversion for Datum to C++ types lexigraphically. Any that is innapropriate or suboptimal should be overidden

Definition at line 132 of file scriptargument.h.

Constructor & Destructor Documentation

template<class T >
Mezzanine::Scripting::ScriptArgumentGeneric< T >::ScriptArgumentGeneric ( InitialValue)
inline

Create an initialized Argument.

Parameters
InitialValueThe value to initialize the Argument with.
Note
Intentionally not explicit, this allow for passing convertable types directly to functions.

Definition at line 149 of file scriptargument.h.

Member Function Documentation

template<class T >
virtual Boolean Mezzanine::Scripting::ScriptArgumentGeneric< T >::GetBool ( ) const
inlinevirtual

Get the Argument as a Bool.

Returns
The argument value lexographically converted as an Bool

Implements Mezzanine::Scripting::iScriptArgument.

Definition at line 179 of file scriptargument.h.

template<class T >
virtual Integer Mezzanine::Scripting::ScriptArgumentGeneric< T >::GetInteger ( ) const
inlinevirtual

Get the Argument as a Integer, slow default implementation.

Returns
The argument value lexographically converted as an Integer

Implements Mezzanine::Scripting::iScriptArgument.

Definition at line 169 of file scriptargument.h.

template<class T >
virtual ScriptArgumentGeneric<T>* Mezzanine::Scripting::ScriptArgumentGeneric< T >::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::iScriptArgument.

Definition at line 204 of file scriptargument.h.

template<class T >
virtual Real Mezzanine::Scripting::ScriptArgumentGeneric< T >::GetReal ( ) const
inlinevirtual

Get the Argument as a Real, slow default implementation.

Returns
The argument value lexographically converted as an Real

Implements Mezzanine::Scripting::iScriptArgument.

Definition at line 174 of file scriptargument.h.

template<class T >
virtual String Mezzanine::Scripting::ScriptArgumentGeneric< T >::GetString ( ) const
inlinevirtual

Get the Argument as a String, slow default implementation.

Returns
The argument value lexographically converted as a String

Implements Mezzanine::Scripting::iScriptArgument.

Definition at line 159 of file scriptargument.h.

template<class T >
virtual Integer Mezzanine::Scripting::ScriptArgumentGeneric< T >::GetTypeData ( ) const
inlinevirtual

Get data about this having an unknown type.

Returns
This will return an Integer containing GenericUnknown. If needed proper specialization of this can be made for any class, see the ScriptArgumentGeneric<Mezzanine::Scripting::Lua::Lua51Nil>

Implements Mezzanine::Scripting::iScriptArgument.

Definition at line 199 of file scriptargument.h.

template<class T >
virtual T Mezzanine::Scripting::ScriptArgumentGeneric< T >::GetValue ( ) const
inlinevirtual

Get the raw primitive to value.

Returns
The internal value that meaningful operation can be performed on.

Definition at line 194 of file scriptargument.h.

template<class T >
virtual Whole Mezzanine::Scripting::ScriptArgumentGeneric< T >::GetWhole ( ) const
inlinevirtual

Get the Argument as a Whole, slow default implementation.

Returns
The argument value lexographically converted as a Whole

Implements Mezzanine::Scripting::iScriptArgument.

Definition at line 164 of file scriptargument.h.

template<class T >
virtual Boolean Mezzanine::Scripting::ScriptArgumentGeneric< T >::IsNull ( ) const
inlinevirtual

Is this value representing a Null/Nil value.

Returns
This will return true if the string representation of this is empty and the Integer representation equals 0, this could and should be overridden on derived scripting arguments

Implements Mezzanine::Scripting::iScriptArgument.

Definition at line 184 of file scriptargument.h.

template<class T >
virtual void Mezzanine::Scripting::ScriptArgumentGeneric< T >::SetValue ( NewValue)
inlinevirtual

Provide an overload point to change assignment that operators will use.

Parameters
NewValueThe new value for this.

Definition at line 189 of file scriptargument.h.

Member Data Documentation

template<class T >
T Mezzanine::Scripting::ScriptArgumentGeneric< T >::Datum
protected

The actual data.

Warning
To prevent slicing don't store the parent class in a container. Dpractically guarantees that derived class will have different sizes and overflow container boundaries. If you must store shared pointers in constainers

Definition at line 140 of file scriptargument.h.


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