Add access modifier support for interface feature
Add ability to change the modifiers for the C# and Java interface generated when using the %interface macros. For C# use the 'csinterfacemodifiers' typemap. For Java use the 'javainterfacemodifiers' typemap. For example: %typemap(csinterfacemodifiers) X "internal interface" Closes #1874
This commit is contained in:
parent
c8ac73513b
commit
c1b004f4fa
9 changed files with 59 additions and 3 deletions
|
|
@ -64,3 +64,31 @@ struct DerivedOverloaded : public BaseOverloaded {
|
|||
virtual void identical_overload(int i, const PTypedef &p = PTypedef()) {}
|
||||
};
|
||||
%}
|
||||
|
||||
|
||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
||||
%interface(Space::X)
|
||||
#endif
|
||||
|
||||
// Test the csinterfacemodifiers and javainterfacemodifiers typemaps.
|
||||
#if defined(SWIGCSHARP)
|
||||
/* change access from default "public class" to "internal class" */
|
||||
%typemap(csclassmodifiers) InternalAccess "internal class"
|
||||
/* The following modifiers are also needed with the above access modifier change */
|
||||
%typemap(csclassmodifiers) Space::X "internal class"
|
||||
%typemap(csinterfacemodifiers) Space::X "internal interface"
|
||||
#elif defined(SWIGJAVA)
|
||||
%typemap(javaclassmodifiers) InternalAccess "final /*notpublic*/ class"
|
||||
%typemap(javaclassmodifiers) Space::X "final class"
|
||||
%typemap(javainterfacemodifiers) Space::X "/*notpublic*/ interface"
|
||||
#endif
|
||||
|
||||
%inline %{
|
||||
struct InternalAccess {};
|
||||
namespace Space {
|
||||
class X {
|
||||
public:
|
||||
virtual void x(const InternalAccess& date) const = 0;
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue