4 lqt
.classes
= lqt
.classes
or {}
7 local pointer_t
= function(fn
)
9 -- the argument is a pointer to class
11 return 'lqtL_passudata(L, '..n
..', "'..fn
..'*")', 1
14 return 'static_cast<'..fn
..'*>'
15 ..'(lqtL_toudata(L, '..n
..', "'..fn
..'*"))', 1
18 return 'lqtL_isudata(L, '..n
..', "'..fn
..'*")', 1
22 local pointer_const_t
= function(fn
)
24 -- the argument is a pointer to constant class instance
26 return 'lqtL_passudata(L, '..n
..', "'..fn
..'*")', 1
29 return 'static_cast<'..fn
..'*>'
30 ..'(lqtL_toudata(L, '..n
..', "'..fn
..'*"))', 1
33 return 'lqtL_isudata(L, '..n
..', "'..fn
..'*")', 1
37 local ref_t
= function(fn
)
39 -- the argument is a reference to class
41 return 'lqtL_passudata(L, &'..n
..', "'..fn
..'*")', 1
44 return '*static_cast<'..fn
..'*>'
45 ..'(lqtL_toudata(L, '..n
..', "'..fn
..'*"))', 1
48 return 'lqtL_isudata(L, '..n
..', "'..fn
..'*")', 1
52 local instance_t
= function(fn
)
54 -- the argument is the class itself
56 return 'lqtL_copyudata(L, &'..n
..', "'..fn
..'*")', 1
59 return '*static_cast<'..fn
..'*>'
60 ..'(lqtL_toudata(L, '..n
..', "'..fn
..'*"))', 1
63 return 'lqtL_isudata(L, '..n
..', "'..fn
..'*")', 1
67 local const_ref_t
= function(fn
)
69 -- the argument is a pointer to class
71 return 'lqtL_copyudata(L, &'..n
..', "'..fn
..'*")', 1, string.gsub(fn
, ' const&$', '')
74 return '*static_cast<'..fn
..'*>'
75 ..'(lqtL_toudata(L, '..n
..', "'..fn
..'*"))', 1
78 return 'lqtL_isudata(L, '..n
..', "'..fn
..'*")', 1
83 lqt
.classes
.insert
= function(cname
, types
) --, cancopy)
84 if types
[cname
]==nil then
85 types
[cname
..'*'] = pointer_t(cname
)
86 types
[cname
..' const*'] = pointer_const_t(cname
)
87 types
[cname
..'&'] = ref_t(cname
)
89 types
[cname
] = instance_t(cname
)
90 types
[cname
..' const&'] = const_ref_t(cname
)