[C++-sig] [Py++] Help with wrapping setter methods
Christopher Bruns
cmbruns at stanford.edu
Tue Sep 29 00:44:41 CEST 2009
Please help. I am just a beginner with pyplusplus and am not smart
enough to see how to create certain complex rules.
How would I create a pyplusplus rule for setting the return policy to
"return internal reference" for all member functions that meet the
following criteria:
* method name begins with "set"
* return type is a reference to the parent class or to one of its base classes
I would sincerely appreciate an example that could do this. Then
perhaps I might be able to figure out how to perform other clever
manipulations. Thanks in advance for your help.
#################################
struct Foo {
// example of the sort of method I mean
Foo& setBaz(int baz); // returns reference to self
};
#################################
from pyplusplus import module_builder
from pyplusplus.module_builder.call_policies import *
mb = module_builder(...)
# want "something" below...
mb.decls(<something?>).call_policies = return_internal_reference()
#################################
--Chris Bruns
More information about the Cplusplus-sig
mailing list