Ardour  9.0-pre0-582-g084a23a80d
Userdata Class Reference

#include <Userdata.h>

Inheritance diagram for Userdata:
[legend]

Public Member Functions

virtual ~Userdata ()
 

Static Public Member Functions

static void * get_ptr (lua_State *L, int index)
 
template<class T >
static UserdatagetExact (lua_State *L, int index)
 
template<class T >
static T * get (lua_State *L, int index, bool canBeConst)
 
template<class T >
static T * try_get (lua_State *L, int index, bool canBeConst)
 

Protected Member Functions

void * getPointer () const
 

Protected Attributes

void * m_p
 

Static Private Member Functions

static UserdatagetExactClass (lua_State *L, int narg, void const *classKey)
 
static UserdatagetClass (lua_State *L, int index, void const *baseClassKey, bool canBeConst, bool errorOnMismatch=true)
 

Detailed Description

Interface to a class pointer retrievable from a userdata.

Definition at line 73 of file Userdata.h.

Constructor & Destructor Documentation

◆ ~Userdata()

virtual Userdata::~Userdata ( )
inlinevirtual

Definition at line 304 of file Userdata.h.

Member Function Documentation

◆ get()

template<class T >
static T* Userdata::get ( lua_State L,
int  index,
bool  canBeConst 
)
inlinestatic

Get a pointer to the class from the Lua stack.

If the object is not the class or a subclass, or it violates the const-ness, a Lua error is raised.

Definition at line 331 of file Userdata.h.

◆ get_ptr()

static void* Userdata::get_ptr ( lua_State L,
int  index 
)
inlinestatic

Definition at line 306 of file Userdata.h.

◆ getClass()

static Userdata* Userdata::getClass ( lua_State L,
int  index,
void const *  baseClassKey,
bool  canBeConst,
bool  errorOnMismatch = true 
)
inlinestaticprivate

Validate and retrieve a Userdata on the stack.

The Userdata must be derived from or the same as the given base class, identified by the key. If canBeConst is false, generates an error if the resulting Userdata represents to a const object. We do the type check first so that the error message is informative.

Definition at line 188 of file Userdata.h.

◆ getExact()

template<class T >
static Userdata* Userdata::getExact ( lua_State L,
int  index 
)
inlinestatic

Returns the Userdata* if the class on the Lua stack matches.

If the class does not match, a Lua error is raised.

Definition at line 318 of file Userdata.h.

◆ getExactClass()

static Userdata* Userdata::getExactClass ( lua_State L,
int  narg,
void const *  classKey 
)
inlinestaticprivate

Validate and retrieve a Userdata on the stack.

The Userdata must exactly match the corresponding class table or const table, or else a Lua error is raised. This is used for the __gc metamethod.

Definition at line 96 of file Userdata.h.

◆ getPointer()

void* Userdata::getPointer ( ) const
inlineprotected

Get an untyped pointer to the contained class.

Definition at line 82 of file Userdata.h.

◆ try_get()

template<class T >
static T* Userdata::try_get ( lua_State L,
int  index,
bool  canBeConst 
)
inlinestatic

Definition at line 341 of file Userdata.h.

Member Data Documentation

◆ m_p

void* Userdata::m_p
protected

Definition at line 76 of file Userdata.h.


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