UGDK  0.4.1
 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
 Tries to unwrap the data contained in this object using the given type.
 
const char * UnwrapString () const
 
bool UnwrapBoolean () const
 
int UnwrapInteger () const
 
double UnwrapNumber () const
 
Vector UnwrapVector () const
 
List UnwrapList () const
 
Map UnwrapMap () const
 
void Wrap (void *data, const VirtualType &type)
 Tries to wrap the given data with the given type.
 
void WrapString (const char *str)
 
void WrapBoolean (bool boolean)
 
void WrapInteger (int number)
 
void WrapNumber (double number)
 
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.
 
Ptr SetAttribute (Ptr key, Ptr value)
 
void * unsafe_data () const
 
DataID id () const
 
void UnsafePopValue ()
 Unsafely sets this LuaData objects data.
 
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::tr1::shared_ptr
< VirtualData
Ptr
 
typedef std::tr1::shared_ptr
< const VirtualData
ConstPtr
 
typedef std::tr1::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.

VirtualData::Ptr ugdk::script::lua::LuaData::Execute ( const std::vector< Ptr > &  args)
VirtualData::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.

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
virtual

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

Implements ugdk::script::VirtualData.

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

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)
virtual
void ugdk::script::lua::LuaData::WrapInteger ( int  number)
virtual
void ugdk::script::lua::LuaData::WrapNumber ( double  number)
virtual
LangWrapper* ugdk::script::lua::LuaData::wrapper ( ) const
inlinevirtual
void ugdk::script::lua::LuaData::WrapString ( const char *  str)
virtual

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