From 37fb09922f93215b2be2c76080f64e754bf2c6aa Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 24 May 2009 20:49:10 -0700 Subject: Moving lua_recast out of LuaOCCI into BLua.h --- include/BLua.h | 20 ++++++++++++++++++++ lib/LuaOCCI.cc | 19 ------------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/include/BLua.h b/include/BLua.h index 2ca7b2a..fc8adb2 100644 --- a/include/BLua.h +++ b/include/BLua.h @@ -336,6 +336,26 @@ class LuaHelpers : public Base { } }; +template +T * lua_recast(Lua * L, int n = 1) { + Base * b; + T * r; + + b = (Base *) LuaObject::getme(L, n); + if (!b) { + L->error("Base object required; got null."); + } + + r = dynamic_cast(b); + + if (!r) { + L->error(String("Object not compatible; expecting ") + typeid(r).name() + " but got *" + typeid(*b).name() + " instead."); + } + + return r; +} + + /*******************************\ |** Let's have a sample of use **| diff --git a/lib/LuaOCCI.cc b/lib/LuaOCCI.cc index 17279db..8bd507b 100644 --- a/lib/LuaOCCI.cc +++ b/lib/LuaOCCI.cc @@ -7,25 +7,6 @@ using namespace oracle::occi; static Environment * global_env = 0; -template -T * lua_recast(Lua * L, int n = 1) { - Base * b; - T * r; - - b = (Base *) LuaObject::getme(L, n); - if (!b) { - L->error("Base object required; got null."); - } - - r = dynamic_cast(b); - - if (!r) { - L->error(String("Object not compatible; expecting ") + typeid(r).name() + " but got *" + typeid(*b).name() + " instead."); - } - - return r; -} - #define export_enum(L, n) \ L->push(#n); \ L->push((lua_Number) n); \ -- cgit v1.2.3