OOLua  2.0.1
C++ and Lua binding
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
DSL

The domain specific language(DSL) used for generating C++ bindings to Lua. More...

Modules

 Expressive
 Generates a proxy function where a user has expressed all the details.
 
 Minimalist
 Generates code using only the minimal amount of information.
 
 Exporting
 Exports member functions.
 

Macros

#define OOLUA_PROXY(...)
 Starts the generation a proxy class. More...
 
#define OOLUA_TAGS(...)
 Allows more information to be specified about the proxy class. More...
 
#define OOLUA_PROXY_END
 Ends the generation of the proxy class.
 
#define OOLUA_SCOPED_ENUM(Name, Entry)
 Creates a entry into a OOLUA_ENUMS block for a C++11 scoped enum. More...
 
#define OOLUA_ENUM(EnumName)
 Creates a entry into a OOLUA_ENUMS block. More...
 
#define OOLUA_ENUMS(EnumEntriesList)
 Creates a block into which enumerators can be defined with OOLUA_ENUM or OOLUA_SCOPED_ENUM. More...
 
#define OOLUA_CTOR(...)
 Generates a constructor in a constructor block. More...
 
#define OOLUA_CTORS(ConstructorEntriesList)
 Creates a block into which none default constructors can be defined using OOLUA_CTOR. More...
 
#define OOLUA_MGET(...)
 Generates a getter, which is a constant function, to retrieve a public instance. More...
 
#define OOLUA_MSET(...)
 Generates a setter, which is a none constant function, to set a public instance. More...
 
#define OOLUA_MGET_MSET(...)
 Generates both a getter and a setter for a public instance. More...
 

Detailed Description

The domain specific language(DSL) used for generating C++ bindings to Lua.

OOLua provides a DSL for defining C++ types which are to be made available to a Lua script. The intention of this DSL is to hide the implementation details whilst providing a simple and rememberable interface to perform the required actions. For the generation of function proxies, the DSL contains two sub categories named Minimalist and Expressive.

Note
"Optional" here means that extra macro parameters are optional, up to the configuration max for a specific operation.

Macro Definition Documentation

#define OOLUA_CTOR (   ...)

Generates a constructor in a constructor block.

See Also
OOLUA_CTORS

OOLUA_CTOR( ConstructorParameterList)

Parameters
ConstructorParameterListComma separated list of parameters
Precondition
Size of ConstructorParameterList >0 and <= "constructor_params"
See Also
constructor_params
#define OOLUA_CTORS (   ConstructorEntriesList)

Creates a block into which none default constructors can be defined using OOLUA_CTOR.

OOLUA_CTORS(ConstructorEntriesList)

Parameters
ConstructorEntriesListList of OOLUA_CTOR

To enable the construction of an instance without using the default constructor, there must be a constructor block specified for the proxy type. The constructor block, OOLUA_CTORS, is where non-default constructor entries can be specified using an OOLUA_CTOR per entry.

Constructors are the only real type of overloading which is permitted by OOLua and there is an important point which should be noted. This being that OOLua will attempt to match the number and type of parameters on the stack with the amount and types specified for each OOLUA_CTOR entry. The order in which it will attempt the matching is the same order in which they were defined. When interacting with the Lua stack certain types can not be differentiated between, these include some integral types such as float, int, double etc and types which are of a proxy class type or derived from that type. OOLua implicitly converts between classes in a hierarchy even if a reference is required. This means for example that if there are constructors such as Foo::Foo(int) and Foo::Foo(float) it will depend on which was defined first in the OOLUA_CTORS block as to which will be invoked for a call such as Foo.new(1).

See Also
No_default_constructor
Note
An OOLUA_CTORS block without any OOLUA_CTOR entries is invalid.
#define OOLUA_ENUM (   EnumName)

Creates a entry into a OOLUA_ENUMS block.

OOLUA_ENUM(EnumName)

Parameters
EnumNameThe class enumeration name
#define OOLUA_ENUMS (   EnumEntriesList)

Creates a block into which enumerators can be defined with OOLUA_ENUM or OOLUA_SCOPED_ENUM.

OOLUA_ENUMS(EnumEntriesList)

Parameters
EnumEntriesListList which contains OOLUA_ENUM and/or OOLUA_SCOPED_ENUM entries.
Note
An OOLUA_ENUMS block without any OOLUA_ENUM or OOLUA_SCOPED_ENUM entries is invalid.
#define OOLUA_MGET (   ...)

Generates a getter, which is a constant function, to retrieve a public instance.

OOLUA_MGET(PublicName, Optional)

Parameters
PublicNameName of the public variable to be proxied.
OptionalGetterName. Defaults to get_PublicName
Note
A generated getter for a pointer, or shared pointer, with a proxied pointee type, has an implicit OOLUA::maybe_null trait applied.
#define OOLUA_MGET_MSET (   ...)

Generates both a getter and a setter for a public instance.

OOLUA_MGET_MSET(PublicName, Optional1, Optional2)

Parameters
PublicNameName of the public variable to be proxied.
Optional1GetterName. Defaults to get_PublicName
Optional2SetterName. Defaults to set_PublicName
See Also
OOLUA_MGET and OOLUA_MSET
Note
If one optional parameter is supplied then both must be given and they must use different names.
#define OOLUA_MSET (   ...)

Generates a setter, which is a none constant function, to set a public instance.

OOLUA_MSET(PublicName, Optional)

Parameters
PublicNameName of the public variable to be proxied.
OptionalSetterName. Defaults to set_PublicName
#define OOLUA_PROXY (   ...)

Starts the generation a proxy class.

OOLUA_PROXY(ClassName, Optional)

Parameters
ClassNameClass to be proxied
OptionalComma seperated list of real base classes
Precondition
Each class specified in Optional must be a real base class of ClassName
#define OOLUA_SCOPED_ENUM (   Name,
  Entry 
)

Creates a entry into a OOLUA_ENUMS block for a C++11 scoped enum.

OOLUA_SCOPED_ENUM(EnumName, Entry)

Parameters
NameThe class enumeration name which will be used to access it from Lua
EntryThe class enumeration scoped qualified name (minus the class type)
See Also
OOLUA_ENUM
#define OOLUA_TAGS (   ...)

Allows more information to be specified about the proxy class.

Tags provide a method to inform the library that the type :

  • has relationship and/or mathematical operators
  • is an abstract class
  • doesn't have a default constructor or any public constructors
  • has enumerations

For an exhaustive list of the possible tags see Tags.

OOLUA_TAGS(TagList)

Parameters
TagListComma separated list of Tags
Note
An OOLUA_TAGS list without any Tags entries is invalid.