Adding new data to registered types

Willi Schinmeyer <[email protected]> Tue, 10 Apr 2012 01:21:10 +0200
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
  Hi,

I'm currently working on automatic documentation generation for the 
functions and classes exported by luabind. I've written a function that 
returns information on a given Lua value if it's a Luabind class or 
function. (If you're interested, this is the function: 
https://github.com/mrwonko/Jedi-Academy--Renaissance/blob/master/code/jarlib/src/jar/core/GetLuabindInfo.cpp 
) So far I can get all important information on functions (i.e. 
signatures & name) and the name of classes.

Most logic happens in Lua (and it's a little messy...), I basically 
recursively walk through everything starting at the globals to find 
everything while build the correct names (the ones stored in luabind 
don't include namespaces) and replace those names in the function 
signatures. (Again, here's the code, if you're interested: 
https://github.com/mrwonko/Jedi-Academy--Renaissance/blob/master/renaissance/addons/docugen/code/main.lua 
)

I still need to read out information regarding class inheritance and all 
the members and functions of classes, but I'm pretty sure I can figure 
that out.


But I need help with this: I'd like to add a new property to the 
binding, an (optional) description of a class/method/member/function. So 
I suppose I'd create a new policy for that and I have no idea how they 
work. Basically, I want to be able to write something like this:

luabind::def("f", &f, luabind::description_policy("A simple example 
function"))

which would result in the function_object(_impl) of a function or the 
class_rep of a class or their equivalent for properties getting a 
description set which I can then query in my function.

I'd appreciate any advice on that.

So long,
Willi Schinmeyer

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2