From 481e5d14161965ba03fde7a77aaf853c32c71994 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 21 Mar 2016 04:05:43 +0100 Subject: [PATCH] refine Lua Binding Documentation --- libs/lua/LuaBridge/detail/Namespace.h | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/libs/lua/LuaBridge/detail/Namespace.h b/libs/lua/LuaBridge/detail/Namespace.h index 6c2800889d..d1c3cfefeb 100644 --- a/libs/lua/LuaBridge/detail/Namespace.h +++ b/libs/lua/LuaBridge/detail/Namespace.h @@ -71,21 +71,21 @@ std::string type_name() #define CLASSDOC(TYPE, LUANAME, DECL, PARENTDECL) \ if (LuaBindingDoc::printBindings ()) { \ - std::cout << "{ " << KEYSTA << "type" << KEYEND << " \"" << TYPE << "\",\n"; \ - std::cout << " " << KEYSTA << "lua" << KEYEND << " \"" << LUANAME << "\",\n"; \ - std::cout << " " << KEYSTA << "decl" << KEYEND << " \"" << DECL << "\",\n"; \ - std::cout << " " << KEYSTA << "parent" << KEYEND << " \"" << PARENTDECL << "\"\n"; \ + std::cout << "{ " << KEYSTA << "type" << KEYEND << " \"" << TYPE << "\",\n"; \ + std::cout << " " << KEYSTA << "lua" << KEYEND << " \"" << LUANAME << "\",\n"; \ + std::cout << " " << KEYSTA << "decl" << KEYEND << " \"" << DECL << "\",\n"; \ + std::cout << " " << KEYSTA << "parent" << KEYEND << "\"" << PARENTDECL << "\"\n"; \ std::cout << "},\n"; \ } #define PRINTDOC(TYPE, LUANAME, RETVAL, DECL) \ if (LuaBindingDoc::printBindings ()) { \ - std::cout << "{ " << KEYSTA << "type" << KEYEND << " \"" << TYPE << "\",\n"; \ - std::cout << " " << KEYSTA << "lua" << KEYEND << " \"" << LUANAME << "\",\n"; \ + std::cout << "{ " << KEYSTA << "type" << KEYEND << " \"" << TYPE << "\",\n"; \ + std::cout << " " << KEYSTA << "lua" << KEYEND << " \"" << LUANAME << "\",\n"; \ if (!(RETVAL).empty()) { \ - std::cout << " " << KEYSTA << "ret" << KEYEND << " \"" << (RETVAL) << "\",\n"; \ + std::cout << " " << KEYSTA << "ret" << KEYEND << " \"" << (RETVAL) << "\",\n"; \ } \ - std::cout << " " << KEYSTA << "decl" << KEYEND << " \"" << DECL << "\"\n"; \ + std::cout << " " << KEYSTA << "decl" << KEYEND << " \"" << DECL << "\"\n"; \ std::cout << "},\n"; \ } @@ -726,7 +726,7 @@ private: template Class & addStaticFunction (char const* name, FP const fp) { - FUNDOC ("Static Function", name, FP) + FUNDOC ("Static Member Function", name, FP) new (lua_newuserdata (L, sizeof (fp))) FP (fp); lua_pushcclosure (L, &CFunc::Call ::f, 1); rawsetfield (L, -2, name); @@ -1051,7 +1051,7 @@ private: _parent = parent; _name = parent->_name + name + "."; #endif - PRINTDOC ("[C] Array", parent->_name << name, std::string(), type_name ()) + PRINTDOC ("[C] Array", parent->_name << name, std::string(), type_name () + "*") m_stackSize = parent->m_stackSize + 3; parent->m_stackSize = 0; @@ -1352,8 +1352,8 @@ private: : L (child->L) , m_stackSize (0) #ifdef LUABINDINGDOC - , _name (child->_parent->_name) - , _parent (child->_parent) + , _name (child->_parent ? child->_parent->_name : "") + , _parent (child->_parent ? child->_parent->_parent : NULL) #endif { m_stackSize = child->m_stackSize - 1; @@ -1750,6 +1750,9 @@ public: template WSPtrClass deriveWSPtrClass (char const* name) { + + CLASSDOC ("[C] Derived Class", _name << name, type_name >(), type_name >()) + CLASSDOC ("[C] Derived Class", _name << name, type_name >(), type_name >()) CLASSDOC ("[C] Derived Pointer Class", _name << name, type_name (), type_name ()) return WSPtrClass (name, this, ClassInfo >::getStaticKey (),