[C++-sig] pyplusplus ui / API
Roman Yakovenko
roman.yakovenko at gmail.com
Wed Feb 15 11:24:24 CET 2006
Hi. I will try to summarize the things.
1. By default all declarations, that belong to header / or to other
headers from the same
directory, will be exposed.
Reason: easy start. New user should not learn how to set
expose\ignore flag to True
or False. He even may not know about existence of such property.
2. I think that adding regex interface is not good idea.
mod.Class(*).expose() could not work, because this function should
return single object
better interface is to add new functionality called declarations
group. For example:
class_group_t will contain all classes and will expose interface of
single class
( composite design pattern )
cg = mod.class_group( criteria=name starts with QXml )
cg.ignore = False
3. ignore will always be recursive. It does not make sense otherwise.
4. I am going with Nat Goodspeed propose:
0. instantiate module: mod = create_module( files, gccxml config )
1. customize mod.declarations
2. create code creators - this step is optional, module will do it
for user, from write_file*
step
3. customize code creators. During this step user will be able to
setup destination file.
In other words, it will provide enough information for module
class instance to
split code into files.
4 write code to files.
pyplusplus by default generates not bad code, so in many cases user
does not need to
touch code creators. But when he needs it .... I think that
exposing code creators tree
as is, is much better solution than to give some kind of simplified
interface.
Code creators interface is simple: few properties that configures code
generations + create() code method. That's all.
5. It is possible to implement next thing:
my_class.add_method(....)
but trust me you don't want to go this way. I already experimented
with this. There are
to many things you need to define to use this approach.
custom_text_t code creator
is much better way to go.
Comments?
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
More information about the Cplusplus-sig
mailing list