[C++-sig] How to exclude a function from being exported using pyste.

Nicodemus nicodemus at globalite.com.br
Wed Mar 26 19:21:35 CET 2003


Giulio Eulisse wrote:

>Hi,
>
Hi Giulio,

>I've a class like this:
>
>class A
>{
>	public:
>		A(int x);
>		A(float x);
>		int b(int x);
>		int b(float x);
>};
>
>And I want to export to python only A::b(int x), not A::b(float x).
>How do I do it using pyste?
>
>A = Class("A","A.h")
>exclude(A.b)
>
>excludes BOTH. Same problem with constructors: how do I get rid of only 
>one of the two constructors?
>  
>
Alas, you can't do that. 8/

I didn't include this capability because I couldn't think of a way to 
nicely allow the user to specify which of the overloads to address. A 
first thought would be something like this:

exclude(A.b('int b(int x)'))

But this can get ugly pretty quickly:

exclude(C.foo('const std::vector<boost::shared_ptr<C> > & foo(const 
std::list<boost::shared_ptr<C> >&, int, int, double) const'))

A friend of mine suggested that the user could specify only part of the 
full signature:

struct C
{
    std::string& Name();
    const std::string& Name() const;
};

...

exclude(Match(C.Name, 'const')) # to get the "const" version of the function

But I have no idea if this system is reliable, or how it would work exactly.

Does any one have a good suggestion on this?

Regards,
Nicodemus.






More information about the Cplusplus-sig mailing list