document directorinattributes and directoroutattributes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11696 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
15070e6d8f
commit
123f4931cd
3 changed files with 27 additions and 2 deletions
|
|
@ -249,7 +249,9 @@ public static extern IntPtr function(string jarg1);
|
|||
<p>
|
||||
Support for type attributes.
|
||||
The 'imtype' and 'cstype' typemaps can have an optional <tt>inattributes</tt> and <tt>outattributes</tt> typemap attribute.
|
||||
There are C# attributes and typemap attributes, don't get confused!!
|
||||
The 'imtype' typemap can also have an optional <tt>directorinattributes</tt> and <tt>directoroutattributes</tt>
|
||||
typemap attribute which attaches to director delegates, an implementation detail of directors, see <a href="#csharp_directors_implementation">directors implementation</a>.
|
||||
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# <tt>MarshalAs</tt> 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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <tt>directorinattributes</tt> and <tt>directoroutattributes</tt> typemap attribute are attached to the delegates in the director class, for example, the SwigDelegateBase_0
|
||||
</p>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
|
|
|||
|
|
@ -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 {}
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {}
|
||||
};
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue