SWIG skipping C++ “access declared ” methods due to %rename% rule
Nikola Špirić <[email protected]>
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CACXGfzwrXaNup6kic3dn6mL5YV6BKj4Rs4n3NjG8gz_hFAmK=Q@mail.gmail.com> |
I'm using SWIG to generate Java bindings for my C++ library. The
library in question follows the snake case naming convention (e.g.
My_class::my_method) , which is converted to Java camel case
convention (e.g. MyClass::myMethod) via a set of %rename rules.
So let's say I have a single header with two interfaces defined:
###################
class IBase_interface {
public:
virtual void ok() = 0;
virtual void not_ok() = 0;
};
######
/**
* Note that this is a private inheritance so swig will ignore everything
*/
class Derived : private IBase_interface {
public:
/**
* The idea is to expose only wanted methods manually here via
C++03 access declarations
*/
using IBase_interface::ok;
using IBase_interface::not_ok;
};
###################
If my interface file looked like this:
###################
%module test
%include "Test.h"
###################
I would end up with a properly generated Derived.java which would
contain both of methods inherited from IBase_interface
However, if I introduced a naming rule to the interface file by adding
the following line before the include:
%rename("%(lctitle)s", %$isfunction) "";
the generated Derived.java would contain only the ok method while
not_ok would be skipped (because it was renamed to camel case, and
thus the using IBase_interface::not_ok stopped having any effect).
The official documentation (
http://www.swig.org/Doc1.3/SWIGPlus.html#SWIGPlus_nn35 @ 6.25) seem to
explain the issue in question: "Resolving ambiguity in overloading may
prevent declarations from being imported by using"
Is there a way around this limitation ?