UGDK  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ugdk::script::lua::LuaData Class Reference

#include <ugdk/script/languages/lua/luadata.h>

Inheritance diagram for ugdk::script::lua::LuaData:
Collaboration diagram for ugdk::script::lua::LuaData:

Public Member Functions

 LuaData (LuaWrapper *wrapper, DataID id)
 
 ~LuaData ()
 
void * Unwrap (const VirtualType &type, bool disown) const override
 Tries to unwrap the data contained in this object using the given type. More...
 
const char * UnwrapString () const override
 
bool UnwrapBoolean () const override
 
int UnwrapInteger () const override
 
double UnwrapNumber () const override
 
Vector UnwrapVector () const override
 
List UnwrapList () const override
 
Map UnwrapMap () const override
 
void Wrap (void *data, const VirtualType &type, bool disown) override
 Tries to wrap the given data with the given type. More...
 
void WrapString (const char *str) override
 
void WrapBoolean (bool boolean) override
 
void WrapInteger (int number) override
 
void WrapNumber (double number) override
 
LangWrapperwrapper () const
 
Ptr Execute (const std::vector< Ptr > &args)
 
Ptr GetAttribute (Ptr key)
 Tries to get a attribute with the given name from this object. More...
 
Ptr SetAttribute (Ptr key, Ptr value)
 
void * unsafe_data () const
 
DataID id () const
 
void UnsafePopValue ()
 Unsafely sets this LuaData objects data. More...
 
void UnsafePushValue ()
 
void AddToBuffer ()
 
void RemoveFromBuffer ()
 
- Public Member Functions inherited from ugdk::script::VirtualData
virtual ~VirtualData ()
 
Ptr Copy ()
 
virtual Ptr Execute (const Vector &args)=0
 

Additional Inherited Members

- Public Types inherited from ugdk::script::VirtualData
typedef std::shared_ptr
< VirtualData
Ptr
 
typedef std::shared_ptr< const
VirtualData
ConstPtr
 
typedef std::weak_ptr
< VirtualData
WeakPtr
 
typedef std::vector< PtrVector
 
typedef std::list< PtrList
 
typedef std::map< Ptr, PtrMap
 
- Protected Member Functions inherited from ugdk::script::VirtualData
 VirtualData ()
 

Constructor & Destructor Documentation

ugdk::script::lua::LuaData::LuaData ( LuaWrapper wrapper,
DataID  id 
)
inline
ugdk::script::lua::LuaData::~LuaData ( )

Member Function Documentation

void ugdk::script::lua::LuaData::AddToBuffer ( )
virtual

Reimplemented from ugdk::script::VirtualData.

Ptr ugdk::script::lua::LuaData::Execute ( const std::vector< Ptr > &  args)
Ptr ugdk::script::lua::LuaData::GetAttribute ( Ptr  key)
virtual

Tries to get a attribute with the given name from this object.

Implements ugdk::script::VirtualData.

DataID ugdk::script::lua::LuaData::id ( ) const
inline
void ugdk::script::lua::LuaData::RemoveFromBuffer ( )
inlinevirtual

Reimplemented from ugdk::script::VirtualData.

Ptr ugdk::script::lua::LuaData::SetAttribute ( Ptr  key,
Ptr  value 
)
virtual
void* ugdk::script::lua::LuaData::unsafe_data ( ) const
inlinevirtual
void ugdk::script::lua::LuaData::UnsafePopValue ( )

Unsafely sets this LuaData objects data.

WARNING: Uses the lua value on the top of the stack.

void ugdk::script::lua::LuaData::UnsafePushValue ( )
void* ugdk::script::lua::LuaData::Unwrap ( const VirtualType type,
bool  disown 
) const
overridevirtual

Tries to unwrap the data contained in this object using the given type.

Implements ugdk::script::VirtualData.

bool ugdk::script::lua::LuaData::UnwrapBoolean ( ) const
overridevirtual
int ugdk::script::lua::LuaData::UnwrapInteger ( ) const
overridevirtual
List ugdk::script::lua::LuaData::UnwrapList ( ) const
overridevirtual
Map ugdk::script::lua::LuaData::UnwrapMap ( ) const
overridevirtual
double ugdk::script::lua::LuaData::UnwrapNumber ( ) const
overridevirtual
const char* ugdk::script::lua::LuaData::UnwrapString ( ) const
overridevirtual
Vector ugdk::script::lua::LuaData::UnwrapVector ( ) const
overridevirtual
void ugdk::script::lua::LuaData::Wrap ( void *  data,
const VirtualType type,
bool  disown 
)
overridevirtual

Tries to wrap the given data with the given type.

Returns a new VirtualData::Ptr with the data wrapped upon success.

The VirtualData object returned by this method is NOT NECESSARILY the same as the one that called it. Thus a safe way to use this is like this:

VirtualData::Ptr vdata;
// ...
vdata = vdata->Wrap(...);

Parameters
data- a void pointer to the data being wrapped.
type- a virtual type got from TypeRegistry<T>::type(), where T is the original declarated type of the data.
Returns
A shared pointer to the wrapped data.
See also
ugdk::script::TypeRegistry

Implements ugdk::script::VirtualData.

void ugdk::script::lua::LuaData::WrapBoolean ( bool  boolean)
overridevirtual
void ugdk::script::lua::LuaData::WrapInteger ( int  number)
overridevirtual
void ugdk::script::lua::LuaData::WrapNumber ( double  number)
overridevirtual
LangWrapper* ugdk::script::lua::LuaData::wrapper ( ) const
inlinevirtual
void ugdk::script::lua::LuaData::WrapString ( const char *  str)
overridevirtual

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