13
0

Add Lua Bindings for const shared_ptr lists (295dbd8e1e)

This commit is contained in:
Robin Gareus 2023-04-12 20:47:02 +02:00
parent 89c7159bc5
commit dbc3008163
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 38 additions and 0 deletions

View File

@ -2123,11 +2123,21 @@ LuaBindings::common (lua_State* L)
.beginConstStdVector <std::shared_ptr<VCA> > ("VCAVector")
.endClass ()
// std::shared_ptr<RouteList const>
.beginPtrConstStdList <std::shared_ptr<Route> > ("ConstRouteListPtr")
.addVoidPtrConstructor<std::list<std::shared_ptr <Route> > const > ()
.endClass ()
// std::shared_ptr<RouteList>
.beginPtrStdList <std::shared_ptr<Route> > ("RouteListPtr")
.addVoidPtrConstructor<std::list<std::shared_ptr <Route> > > ()
.endClass ()
// std::shared_ptr<BundleList const>
.beginPtrConstStdVector <std::shared_ptr<Bundle> > ("ConstBundleListPtr")
.addVoidPtrConstructor<std::vector<std::shared_ptr <Bundle> > const > ()
.endClass ()
// std::shared_ptr<BundleList>
.beginPtrStdVector <std::shared_ptr<Bundle> > ("BundleListPtr")
.addVoidPtrConstructor<std::vector<std::shared_ptr <Bundle> > > ()

View File

@ -2029,6 +2029,19 @@ public:
//----------------------------------------------------------------------------
template <class T>
Class<std::shared_ptr<const std::list<T> > > beginPtrConstStdList (char const* name)
{
typedef std::list<T> const LT;
typedef typename LT::size_type T_SIZE;
return beginClass<std::shared_ptr<LT> > (name)
.addPtrFunction ("empty", (bool (LT::*)()const)&LT::empty)
.addPtrFunction ("size", (T_SIZE (LT::*)()const)&LT::size)
.addPtrFunction ("reverse", (void (LT::*)())&LT::reverse)
.addExtCFunction ("iter", &CFunc::ptrListIter<T, LT>)
.addExtCFunction ("table", &CFunc::ptrListToTable<T, LT>);
}
template <class T>
Class<std::shared_ptr<std::list<T> > > beginPtrStdList (char const* name)
{
@ -2053,6 +2066,21 @@ public:
.addExtCFunction ("table", &CFunc::ptrListToTable<T, LT>);
}
template <class T>
Class<std::shared_ptr<const std::vector<T> > > beginPtrConstStdVector (char const* name)
{
typedef std::vector<T> const LT;
typedef typename std::vector<T>::reference T_REF;
typedef typename std::vector<T>::size_type T_SIZE;
return beginClass<std::shared_ptr<LT> > (name)
.addPtrFunction ("empty", (bool (LT::*)()const)&LT::empty)
.addPtrFunction ("size", (T_SIZE (LT::*)()const)&LT::size)
.addPtrFunction ("at", (T_REF (LT::*)(T_SIZE))&LT::at)
.addExtCFunction ("iter", &CFunc::ptrListIter<T, LT>)
.addExtCFunction ("table", &CFunc::ptrListToTable<T, LT>);
}
template <class T>
Class<std::shared_ptr<std::vector<T> > > beginPtrStdVector (char const* name)
{