diff --git a/Doc/Manual/CSharp.html b/Doc/Manual/CSharp.html index be0dcf658..a4bb9e2d1 100644 --- a/Doc/Manual/CSharp.html +++ b/Doc/Manual/CSharp.html @@ -249,7 +249,9 @@ public static extern IntPtr function(string jarg1);

Support for type attributes. The 'imtype' and 'cstype' typemaps can have an optional inattributes and outattributes typemap attribute. -There are C# attributes and typemap attributes, don't get confused!! +The 'imtype' typemap can also have an optional directorinattributes and directoroutattributes +typemap attribute which attaches to director delegates, an implementation detail of directors, see directors implementation. +Note that there are C# attributes and typemap attributes, don't get confused between the two!! The C# attributes specified in these typemap attributes are generated wherever the type is used in the C# wrappers. These can be used to specify any C# attribute associated with a C/C++ type, but are more typically used for the C# MarshalAs attribute. For example: @@ -293,6 +295,11 @@ These attributes are associated with the C/C++ parameter type or return type, wh the attribute features and typemaps covered next. Note that all these different C# attributes can be combined so that a method has more than one attribute.

+ +

+The directorinattributes and directoroutattributes typemap attribute are attached to the delegates in the director class, for example, the SwigDelegateBase_0 +

+
  • diff --git a/Examples/test-suite/csharp/csharp_attributes_runme.cs b/Examples/test-suite/csharp/csharp_attributes_runme.cs index 3f4ea179a..4cdced80d 100644 --- a/Examples/test-suite/csharp/csharp_attributes_runme.cs +++ b/Examples/test-suite/csharp/csharp_attributes_runme.cs @@ -198,6 +198,8 @@ public class runme if (tgv == null) throw new Exception("No attribute for Cymru"); } + + // No runtime test for directorinattributes and directoroutattributes } } @@ -256,3 +258,9 @@ public class ThreadSafeAttribute : Attribute { public ThreadSafeAttribute() {} } +[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)] +public class DirectorIntegerOutAttribute : Attribute {} + +[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)] +public class DirectorIntegerInAttribute : Attribute {} + diff --git a/Examples/test-suite/csharp_attributes.i b/Examples/test-suite/csharp_attributes.i index e74f7422d..bca595d9a 100644 --- a/Examples/test-suite/csharp_attributes.i +++ b/Examples/test-suite/csharp_attributes.i @@ -1,4 +1,4 @@ -%module csharp_attributes +%module(directors="1") csharp_attributes // Test the inattributes and outattributes typemaps %typemap(cstype, outattributes="[IntOut]", inattributes="[IntIn]") int "int" @@ -50,3 +50,13 @@ enum Cymru { Llanelli }; double MoreStations::WestonSuperMare = 0.0; %} +// Test directorinattributes and directoroutattributes +%typemap(imtype, directoroutattributes="[DirectorIntegerOut]", directorinattributes="[DirectorIntegerIn]") int "int" +%feature("director") YetMoreStations; + +%inline %{ +struct YetMoreStations { + virtual int Slough(int x) {} + virtual ~YetMoreStations() {} +}; +%}