- Remove using directives from the generated C# code and fully qualify the use of all .NET
  framework types in order to minimize potential name collisions from input files defining
  types, namespace, etc with the same name as .NET framework members.
- Globally qualify the use of .NET framework types in the System namespace
- Remove .NET 1.1 support, .NET 2 is the minimum for the C# module

Closes #79

* 'master' of https://github.com/BrantKyser/swig:
  Correct spelling of compatibility.
  Update documentation to reflect fully qualifying the use of .NET types in the generated code.
  Add support for SWIG2_CSHARP macro to create SWIG 2 backwards compatability mode.
  Remove using directives from the generated C# code and fully qualify the use of all .NET framework types in order to minimize potential name collisions from input files defining types, namespace, etc with the same name as .NET framework members.
  Since SWIG 3.0 removes support for .NET 1.1, cleanup the C# library by removing the use of the SWIG_DOTNET_1 macro.
  Globablly qualify the use of types from the .NET framework's System namespace in the C# module and library.
  Add test case to demonstrate the name collision that occurs in the generated C# code when a namespace is named System.
This commit is contained in:
William S Fulton 2013-11-09 11:32:50 +00:00
commit c7b5316912
20 changed files with 434 additions and 369 deletions

View file

@ -10,6 +10,9 @@
<div class="sectiontoc"> <div class="sectiontoc">
<ul> <ul>
<li><a href="#CSharp_introduction">Introduction</a> <li><a href="#CSharp_introduction">Introduction</a>
<ul>
<li><a href="#CSharp_introduction_swig2_compatibility">SWIG 2 Compatibility</a>
</ul>
<li><a href="#CSharp_differences_java">Differences to the Java module</a> <li><a href="#CSharp_differences_java">Differences to the Java module</a>
<li><a href="#CSharp_void_pointers">Void pointers</a> <li><a href="#CSharp_void_pointers">Void pointers</a>
<li><a href="#CSharp_arrays">C# Arrays</a> <li><a href="#CSharp_arrays">C# Arrays</a>
@ -69,6 +72,12 @@ The <a href="http://msdn.microsoft.com">Microsoft Developer Network (MSDN)</a> h
Monodoc, available from the Mono project, has a very useful section titled <a href="http://www.mono-project.com/Interop_with_Native_Libraries">Interop with native libraries</a>. Monodoc, available from the Mono project, has a very useful section titled <a href="http://www.mono-project.com/Interop_with_Native_Libraries">Interop with native libraries</a>.
</p> </p>
<H3><a name="CSharp_introduction_swig2_compatibility"></a>19.1.1 SWIG 2 Compatibility</H3>
<p>
In order to minimize name collisions between names generated based on input to SWIG and names used in the generated code from the .NET framework, SWIG 3 fully qualifies the use of all .NET types. Furthermore, SWIG 3 avoids <tt>using</tt> directives in generated code. This breaks backwards compatibility with typemaps, pragmas, etc written for use with SWIG 2 that assume the presence of <tt>using System;</tt> or <tt>using System.Runtime.InteropServices;</tt> directives in the intermediate class imports, module imports, or proxy imports. SWIG 3 supports backwards compatibility though the use of the <tt>SWIG2_CSHARP</tt> macro. If <tt>SWIG2_CSHARP</tt> is defined, SWIG 3 generates <tt>using</tt> directives in the intermediate class, module class, and proxy class code similar to those generated by SWIG 2. This can be done without modifying any of the input code by passing the <tt>-DSWIG2_CSHARP</tt> commandline parameter when executing <tt>swig</tt>.
</p>
<H2><a name="CSharp_differences_java"></a>19.2 Differences to the Java module</H2> <H2><a name="CSharp_differences_java"></a>19.2 Differences to the Java module</H2>
@ -262,7 +271,7 @@ An example shows that <tt>char *</tt> could be marshalled in different ways,
<div class="code"> <div class="code">
<pre> <pre>
%typemap(imtype, out="IntPtr") char * "string" %typemap(imtype, out="global::System.IntPtr") char * "string"
char * function(char *); char * function(char *);
</pre> </pre>
</div> </div>
@ -273,7 +282,7 @@ The output type is thus IntPtr and the input type is string. The resulting inter
<div class="code"> <div class="code">
<pre> <pre>
public static extern IntPtr function(string jarg1); public static extern global::System.IntPtr function(string jarg1);
</pre> </pre>
</div> </div>
@ -294,8 +303,8 @@ For example:
<div class="code"> <div class="code">
<pre> <pre>
%typemap(imtype, %typemap(imtype,
inattributes="[MarshalAs(UnmanagedType.LPStr)]", inattributes="[global::System.Runtime.InteropServices.MarshalAs(UnmanagedType.LPStr)]",
outattributes="[return: MarshalAs(UnmanagedType.LPStr)]") const char * "String" outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(UnmanagedType.LPStr)]") const char * "String"
const char * GetMsg() {} const char * GetMsg() {}
void SetMsg(const char *msg) {} void SetMsg(const char *msg) {}
@ -310,12 +319,12 @@ The intermediary class will then have the marshalling as specified by everything
<pre> <pre>
class examplePINVOKE { class examplePINVOKE {
... ...
[DllImport("example", EntryPoint="CSharp_GetMsg")] [global::System.Runtime.InteropServices.DllImport("example", EntryPoint="CSharp_GetMsg")]
[return: MarshalAs(UnmanagedType.LPStr)] [return: global::System.Runtime.InteropServices.MarshalAs(UnmanagedType.LPStr)]
public static extern String GetMsg(); public static extern String GetMsg();
[DllImport("example", EntryPoint="CSharp_SetMsg")] [global::System.Runtime.InteropServices.DllImport("example", EntryPoint="CSharp_SetMsg")]
public static extern void SetMsg([MarshalAs(UnmanagedType.LPStr)]String jarg1); public static extern void SetMsg([global::System.Runtime.InteropServices.MarshalAs(UnmanagedType.LPStr)]String jarg1);
} }
</pre> </pre>
</div> </div>
@ -368,7 +377,7 @@ will generate a C# proxy class:
<div class="code"> <div class="code">
<pre> <pre>
[ThreadSafe] [ThreadSafe]
public class AClass : IDisposable { public class AClass : global::System.IDisposable {
... ...
[ThreadSafe(false)] [ThreadSafe(false)]
public AClass(double a) ... public AClass(double a) ...
@ -392,9 +401,9 @@ An example for attaching attributes to the enum and enum values is shown below.
<div class="code"> <div class="code">
<pre> <pre>
%typemap(csattributes) Couleur "[System.ComponentModel.Description(\"Colours\")]" %typemap(csattributes) Couleur "[global::System.ComponentModel.Description(\"Colours\")]"
%csattributes Rouge "[System.ComponentModel.Description(\"Red\")]" %csattributes Rouge "[global::System.ComponentModel.Description(\"Red\")]"
%csattributes Vert "[System.ComponentModel.Description(\"Green\")]" %csattributes Vert "[global::System.ComponentModel.Description(\"Green\")]"
%inline %{ %inline %{
enum Couleur { Rouge, Orange, Vert }; enum Couleur { Rouge, Orange, Vert };
%} %}
@ -407,12 +416,12 @@ which will result in the following C# enum:
<div class="code"> <div class="code">
<pre> <pre>
[System.ComponentModel.Description("Colours")] [global::System.ComponentModel.Description("Colours")]
public enum Couleur { public enum Couleur {
[System.ComponentModel.Description("Red")] [global::System.ComponentModel.Description("Red")]
Rouge, Rouge,
Orange, Orange,
[System.ComponentModel.Description("Green")] [global::System.ComponentModel.Description("Green")]
Vert Vert
} }
</pre> </pre>
@ -618,9 +627,9 @@ marshalling for the arrays:
<div class="code"> <div class="code">
<pre> <pre>
[DllImport("example", EntryPoint="CSharp_myArrayCopy")] [global::System.Runtime.InteropServices.DllImport("example", EntryPoint="CSharp_myArrayCopy")]
public static extern void myArrayCopy([In, MarshalAs(UnmanagedType.LPArray)]int[] jarg1, public static extern void myArrayCopy([global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(UnmanagedType.LPArray)]int[] jarg1,
[Out, MarshalAs(UnmanagedType.LPArray)]int[] jarg2, [global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(UnmanagedType.LPArray)]int[] jarg2,
int jarg3); int jarg3);
</pre> </pre>
</div> </div>
@ -668,9 +677,9 @@ and intermediary class method
<div class="code"> <div class="code">
<pre> <pre>
[DllImport("example", EntryPoint="CSharp_myArraySwap")] [global::System.Runtime.InteropServices.DllImport("example", EntryPoint="CSharp_myArraySwap")]
public static extern void myArraySwap([In, Out, MarshalAs(UnmanagedType.LPArray)]int[] jarg1, public static extern void myArraySwap([global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(UnmanagedType.LPArray)]int[] jarg1,
[In, Out, MarshalAs(UnmanagedType.LPArray)]int[] jarg2, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(UnmanagedType.LPArray)]int[] jarg2,
int jarg3); int jarg3);
</pre> </pre>
</div> </div>
@ -743,7 +752,7 @@ As a result, we get the following method in the module class:
fixed ( int *swig_ptrTo_sourceArray = sourceArray ) { fixed ( int *swig_ptrTo_sourceArray = sourceArray ) {
fixed ( int *swig_ptrTo_targetArray = targetArray ) { fixed ( int *swig_ptrTo_targetArray = targetArray ) {
{ {
examplePINVOKE.myArrayCopy((IntPtr)swig_ptrTo_sourceArray, (IntPtr)swig_ptrTo_targetArray, examplePINVOKE.myArrayCopy((global::System.IntPtr)swig_ptrTo_sourceArray, (global::System.IntPtr)swig_ptrTo_targetArray,
nitems); nitems);
} }
} }
@ -764,8 +773,8 @@ example - the method is expecting an IntPtr as the parameter type.
<div class="code"> <div class="code">
<pre> <pre>
[DllImport("example", EntryPoint="CSharp_myArrayCopy")] [global::System.Runtime.InteropServices.DllImport("example", EntryPoint="CSharp_myArrayCopy")]
public static extern void myArrayCopy(IntPtr jarg1, IntPtr jarg2, int jarg3); public static extern void myArrayCopy(global::System.IntPtr jarg1, global::System.IntPtr jarg2, int jarg3);
</pre> </pre>
</div> </div>
@ -1220,7 +1229,7 @@ the C# code can be generated into the intermediary class using the <tt>imclassco
static CustomExceptionDelegate customDelegate = static CustomExceptionDelegate customDelegate =
new CustomExceptionDelegate(SetPendingCustomException); new CustomExceptionDelegate(SetPendingCustomException);
[DllImport("$dllimport", EntryPoint="CustomExceptionRegisterCallback")] [global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="CustomExceptionRegisterCallback")]
public static extern public static extern
void CustomExceptionRegisterCallback(CustomExceptionDelegate customCallback); void CustomExceptionRegisterCallback(CustomExceptionDelegate customCallback);
@ -1264,7 +1273,7 @@ The boiler plate code above must be used in addition to a handcrafted <tt>Custom
<div class="code"> <div class="code">
<pre> <pre>
// Custom C# Exception // Custom C# Exception
class CustomApplicationException : System.ApplicationException { class CustomApplicationException : global::System.ApplicationException {
public CustomApplicationException(string message) public CustomApplicationException(string message)
: base(message) { : base(message) {
} }
@ -1457,20 +1466,17 @@ Below is the generated C# <tt>Base</tt> director class.
<div class="code"> <div class="code">
<pre> <pre>
using System; public class Base : global::System.IDisposable {
using System.Runtime.InteropServices; private global::System.Runtime.InteropServices.HandleRef swigCPtr;
public class Base : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn; protected bool swigCMemOwn;
internal Base(IntPtr cPtr, bool cMemoryOwn) { internal Base(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn; swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
} }
internal static HandleRef getCPtr(Base obj) { internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Base obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
} }
~Base() { ~Base() {
@ -1479,12 +1485,12 @@ public class Base : IDisposable {
public virtual void Dispose() { public virtual void Dispose() {
lock(this) { lock(this) {
if(swigCPtr.Handle != IntPtr.Zero &amp;&amp; swigCMemOwn) { if(swigCPtr.Handle != global::System.IntPtr.Zero &amp;&amp; swigCMemOwn) {
swigCMemOwn = false; swigCMemOwn = false;
examplePINVOKE.delete_Base(swigCPtr); examplePINVOKE.delete_Base(swigCPtr);
} }
swigCPtr = new HandleRef(null, IntPtr.Zero); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
GC.SuppressFinalize(this); global::System.GC.SuppressFinalize(this);
} }
} }
@ -1511,7 +1517,7 @@ public class Base : IDisposable {
examplePINVOKE.Base_director_connect(swigCPtr, swigDelegate0, swigDelegate1); examplePINVOKE.Base_director_connect(swigCPtr, swigDelegate0, swigDelegate1);
} }
private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes) { private bool SwigDerivedClassHasMethod(string methodName, global::System.global::System.Type[] methodTypes) {
System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, methodTypes); System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, methodTypes);
bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(Base)); bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(Base));
return hasDerivedMethod; return hasDerivedMethod;
@ -1521,18 +1527,18 @@ public class Base : IDisposable {
return UIntMethod(x); return UIntMethod(x);
} }
private void SwigDirectorBaseBoolMethod(IntPtr b, bool flag) { private void SwigDirectorBaseBoolMethod(global::System.IntPtr b, bool flag) {
BaseBoolMethod(new Base(b, false), flag); BaseBoolMethod(new Base(b, false), flag);
} }
internal delegate uint SwigDelegateBase_0(uint x); internal delegate uint SwigDelegateBase_0(uint x);
internal delegate void SwigDelegateBase_1(IntPtr b, bool flag); internal delegate void SwigDelegateBase_1(global::System.IntPtr b, bool flag);
private SwigDelegateBase_0 swigDelegate0; private SwigDelegateBase_0 swigDelegate0;
private SwigDelegateBase_1 swigDelegate1; private SwigDelegateBase_1 swigDelegate1;
private static Type[] swigMethodTypes0 = new Type[] { typeof(uint) }; private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { typeof(uint) };
private static Type[] swigMethodTypes1 = new Type[] { typeof(Base), typeof(bool) }; private static global::System.Type[] swigMethodTypes1 = new global::System.Type[] { typeof(Base), typeof(bool) };
} }
</pre> </pre>
</div> </div>
@ -1755,9 +1761,9 @@ and the following usage from C# after running the code through SWIG:
Wheel wheel = new Bike(10).getWheel(); Wheel wheel = new Bike(10).getWheel();
Console.WriteLine("wheel size: " + wheel.size); Console.WriteLine("wheel size: " + wheel.size);
// Simulate a garbage collection // Simulate a garbage collection
System.GC.Collect(); global::System.GC.Collect();
System.GC.WaitForPendingFinalizers(); global::System.GC.WaitForPendingFinalizers();
Console.WriteLine("wheel size: " + wheel.size); global::System.Console.WriteLine("wheel size: " + wheel.size);
</pre> </pre>
</div> </div>
@ -1795,9 +1801,9 @@ is called using the following typemaps.
// of dangling C++ pointer. Intended for methods that return pointers or // of dangling C++ pointer. Intended for methods that return pointers or
// references to a member variable. // references to a member variable.
%typemap(csout, excode=SWIGEXCODE) Wheel&amp; getWheel { %typemap(csout, excode=SWIGEXCODE) Wheel&amp; getWheel {
IntPtr cPtr = $imcall;$excode global::System.IntPtr cPtr = $imcall;$excode
$csclassname ret = null; $csclassname ret = null;
if (cPtr != IntPtr.Zero) { if (cPtr != global::System.IntPtr.Zero) {
ret = new $csclassname(cPtr, $owner); ret = new $csclassname(cPtr, $owner);
ret.addReference(this); ret.addReference(this);
} }
@ -1813,7 +1819,7 @@ The code in the second typemap constitutes the bulk of the code in the generated
<div class="code"> <div class="code">
<pre> <pre>
public class Wheel : IDisposable { public class Wheel : global::System.IDisposable {
... ...
// Ensure that the GC doesn't collect any Bike instance set from C# // Ensure that the GC doesn't collect any Bike instance set from C#
private Bike bikeReference; private Bike bikeReference;
@ -1822,12 +1828,12 @@ public class Wheel : IDisposable {
} }
} }
public class Bike : IDisposable { public class Bike : global::System.IDisposable {
... ...
public Wheel getWheel() { public Wheel getWheel() {
IntPtr cPtr = examplePINVOKE.Bike_getWheel(swigCPtr); global::System.IntPtr cPtr = examplePINVOKE.Bike_getWheel(swigCPtr);
Wheel ret = null; Wheel ret = null;
if (cPtr != IntPtr.Zero) { if (cPtr != global::System.IntPtr.Zero) {
ret = new Wheel(cPtr, false); ret = new Wheel(cPtr, false);
ret.addReference(this); ret.addReference(this);
} }
@ -1904,9 +1910,9 @@ In order to understand why, consider a garbage collection occuring...
container.setElement(element); container.setElement(element);
Console.WriteLine("element.value: " + container.getElement().value); Console.WriteLine("element.value: " + container.getElement().value);
// Simulate a garbage collection // Simulate a garbage collection
System.GC.Collect(); global::System.GC.Collect();
System.GC.WaitForPendingFinalizers(); global::System.GC.WaitForPendingFinalizers();
Console.WriteLine("element.value: " + container.getElement().value); global::System.Console.WriteLine("element.value: " + container.getElement().value);
</pre> </pre>
</div> </div>
@ -1918,14 +1924,14 @@ One solution is to add in the appropriate references in the C# layer...
<div class="code"> <div class="code">
<pre> <pre>
public class Container : IDisposable { public class Container : global::System.IDisposable {
... ...
// Ensure that the GC doesn't collect any Element set from C# // Ensure that the GC doesn't collect any Element set from C#
// as the underlying C++ class stores a shallow copy // as the underlying C++ class stores a shallow copy
private Element elementReference; private Element elementReference;
private HandleRef getCPtrAndAddReference(Element element) { private global::System.Runtime.InteropServices.HandleRef getCPtrAndAddReference(Element element) {
elementReference = element; elementReference = element;
return Element.getCPtr(element); return Element.getCPtr(element);
} }
@ -1951,7 +1957,7 @@ The 'cscode' typemap simply adds in the specified code into the C# proxy class.
// Ensure that the GC doesn't collect any Element set from C# // Ensure that the GC doesn't collect any Element set from C#
// as the underlying C++ class stores a shallow copy // as the underlying C++ class stores a shallow copy
private Element elementReference; private Element elementReference;
private HandleRef getCPtrAndAddReference(Element element) { private global::System.Runtime.InteropServices.HandleRef getCPtrAndAddReference(Element element) {
elementReference = element; elementReference = element;
return Element.getCPtr(element); return Element.getCPtr(element);
} }
@ -2000,7 +2006,7 @@ First let's look at the code that is generated by default, where the C# proxy cl
<div class="code"> <div class="code">
<pre> <pre>
public class Action : IDisposable { public class Action : global::System.IDisposable {
... ...
public Action(CDate dateIn, CDate dateOut) public Action(CDate dateIn, CDate dateOut)
: this(examplePINVOKE.new_Action(CDate.getCPtr(dateIn), CDate.getCPtr(dateOut)), true) { : this(examplePINVOKE.new_Action(CDate.getCPtr(dateIn), CDate.getCPtr(dateOut)), true) {
@ -2081,7 +2087,7 @@ The resulting generated proxy code in the <tt>Action</tt> class follows:
<div class="code"> <div class="code">
<pre> <pre>
public class Action : IDisposable { public class Action : global::System.IDisposable {
... ...
public int doSomething(System.DateTime dateIn, out System.DateTime dateOut) { public int doSomething(System.DateTime dateIn, out System.DateTime dateOut) {
CDate tempdateIn = new CDate(dateIn.Year, dateIn.Month, dateIn.Day); CDate tempdateIn = new CDate(dateIn.Year, dateIn.Month, dateIn.Day);
@ -2099,7 +2105,7 @@ public class Action : IDisposable {
} }
} }
static private IntPtr SwigConstructAction(System.DateTime dateIn, out System.DateTime dateOut) { static private global::System.IntPtr SwigConstructAction(System.DateTime dateIn, out System.DateTime dateOut) {
CDate tempdateIn = new CDate(dateIn.Year, dateIn.Month, dateIn.Day); CDate tempdateIn = new CDate(dateIn.Year, dateIn.Month, dateIn.Day);
CDate tempdateOut = new CDate(); CDate tempdateOut = new CDate();
try { try {
@ -2299,8 +2305,8 @@ The typemap type required is thus <tt>CDate *</tt>. Given that the previous sect
%typemap(csvarout, excode=SWIGEXCODE2) CDate * %{ %typemap(csvarout, excode=SWIGEXCODE2) CDate * %{
/* csvarout typemap code */ /* csvarout typemap code */
get { get {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
CDate tempDate = (cPtr == IntPtr.Zero) ? null : new CDate(cPtr, $owner);$excode CDate tempDate = (cPtr == global::System.IntPtr.Zero) ? null : new CDate(cPtr, $owner);$excode
return new System.DateTime(tempDate.getYear(), tempDate.getMonth(), tempDate.getDay(), return new System.DateTime(tempDate.getYear(), tempDate.getMonth(), tempDate.getDay(),
0, 0, 0); 0, 0, 0);
} %} } %}
@ -2322,8 +2328,8 @@ public class example {
} }
/* csvarout typemap code */ /* csvarout typemap code */
get { get {
IntPtr cPtr = examplePINVOKE.ImportantDate_get(); global::System.IntPtr cPtr = examplePINVOKE.ImportantDate_get();
CDate tempDate = (cPtr == IntPtr.Zero) ? null : new CDate(cPtr, false); CDate tempDate = (cPtr == global::System.IntPtr.Zero) ? null : new CDate(cPtr, false);
return new System.DateTime(tempDate.getYear(), tempDate.getMonth(), tempDate.getDay(), return new System.DateTime(tempDate.getYear(), tempDate.getMonth(), tempDate.getDay(),
0, 0, 0); 0, 0, 0);
} }
@ -2389,7 +2395,7 @@ The generated proxy class code will then contain the following wrapper for calli
<div class="code"><pre> <div class="code"><pre>
... ...
private void SwigDirectorsomeCallback(IntPtr date) { private void SwigDirectorsomeCallback(global::System.IntPtr date) {
System.DateTime tempdate = new System.DateTime(); System.DateTime tempdate = new System.DateTime();
try { try {
someCallback(out tempdate); someCallback(out tempdate);
@ -2432,7 +2438,7 @@ The default C# proxy class generated is:
<div class="code"> <div class="code">
<pre> <pre>
public class ExtendMe : IDisposable { public class ExtendMe : global::System.IDisposable {
... ...
public int Part1() { public int Part1() {
... ...
@ -2468,7 +2474,7 @@ The C# proxy class becomes a partial class:
<div class="code"> <div class="code">
<pre> <pre>
public partial class ExtendMe : IDisposable { public partial class ExtendMe : global::System.IDisposable {
... ...
public int Part1() { public int Part1() {
... ...
@ -2483,7 +2489,7 @@ You can then of course declare another part of the partial class elsewhere, for
<div class="code"> <div class="code">
<pre> <pre>
public partial class ExtendMe : IDisposable { public partial class ExtendMe : global::System.IDisposable {
public int Part2() { public int Part2() {
return 2; return 2;
} }
@ -2535,7 +2541,7 @@ The generated C# proxy class will instead be:
<div class="code"> <div class="code">
<pre> <pre>
public class ExtendMe : IDisposable { public class ExtendMe : global::System.IDisposable {
... ...
public int Part3() { public int Part3() {
return 3; return 3;

View file

@ -14,9 +14,11 @@ top_builddir = ../@top_builddir@
CPP_TEST_CASES = \ CPP_TEST_CASES = \
csharp_attributes \ csharp_attributes \
csharp_swig2_compatibility \
csharp_exceptions \ csharp_exceptions \
csharp_features \ csharp_features \
csharp_lib_arrays \ csharp_lib_arrays \
csharp_namespace_system_collision \
csharp_prepost \ csharp_prepost \
csharp_typemaps \ csharp_typemaps \
enum_thorough_simple \ enum_thorough_simple \
@ -35,6 +37,7 @@ CSHARPFLAGSSPECIAL =
# Custom tests - tests with additional commandline options # Custom tests - tests with additional commandline options
intermediary_classname.cpptest: SWIGOPT += -dllimport intermediary_classname intermediary_classname.cpptest: SWIGOPT += -dllimport intermediary_classname
csharp_lib_arrays.cpptest: CSHARPFLAGSSPECIAL = -unsafe csharp_lib_arrays.cpptest: CSHARPFLAGSSPECIAL = -unsafe
csharp_swig2_compatibility.cpptest: SWIGOPT += -DSWIG2_CSHARP
# Rules for the different types of tests # Rules for the different types of tests
%.cpptest: %.cpptest:

View file

@ -82,17 +82,6 @@ public class li_std_vector_runme {
} catch (ArgumentException) { } catch (ArgumentException) {
} }
} }
#if SWIG_DOTNET_1
{
// runtime check that 2D arrays fail
double[,] outputarray = new double[collectionSize,collectionSize];
try {
vect.CopyTo(outputarray);
throw new Exception("CopyTo (5a) test failed");
} catch (ArgumentException) {
}
}
#endif
{ {
StructVector inputvector = new StructVector(); StructVector inputvector = new StructVector();
int arrayLen = 10; int arrayLen = 10;
@ -208,7 +197,6 @@ public class li_std_vector_runme {
throw new Exception("Repeat (1) test failed"); throw new Exception("Repeat (1) test failed");
} }
} }
#if !SWIG_DOTNET_1
{ {
System.Collections.Generic.IEnumerator<double> myEnumerator = dv.GetEnumerator(); System.Collections.Generic.IEnumerator<double> myEnumerator = dv.GetEnumerator();
while ( myEnumerator.MoveNext() ) { while ( myEnumerator.MoveNext() ) {
@ -216,7 +204,6 @@ public class li_std_vector_runme {
throw new Exception("Repeat (2) test failed"); throw new Exception("Repeat (2) test failed");
} }
} }
#endif
} }
{ {

View file

@ -0,0 +1,39 @@
%module namespace_system_collision
%{
#include <string>
namespace TopLevel
{
namespace System
{
class Foo {
public:
virtual ~Foo() {}
virtual std::string ping() { return "TopLevel::System::Foo::ping()"; }
};
}
}
%}
%include <std_string.i>
// nspace feature only supported by these languages
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD)
%nspace;
#else
#warning nspace feature not yet supported in this target language
#endif
namespace TopLevel
{
namespace System
{
class Foo {
public:
virtual ~Foo();
virtual std::string ping();
};
}
}

View file

@ -116,7 +116,7 @@ struct PrePost3 {
// Check attributes in the typemaps // Check attributes in the typemaps
%typemap(cstype, inattributes="[CustomInt]") int val "int" %typemap(cstype, inattributes="[CustomInt]") int val "int"
%typemap(csin, pre=" int tmp_$csinput = $csinput * 100;") int val "tmp_$csinput" %typemap(csin, pre=" int tmp_$csinput = $csinput * 100;") int val "tmp_$csinput"
%typemap(imtype, out="IntPtr/*overridden*/", outattributes="[CustomIntPtr]") CsinAttributes * "HandleRef/*overridden*/" %typemap(imtype, out="global::System.IntPtr/*overridden*/", outattributes="[CustomIntPtr]") CsinAttributes * "global::System.Runtime.InteropServices.HandleRef/*overridden*/"
%inline %{ %inline %{
class CsinAttributes { class CsinAttributes {
@ -216,8 +216,8 @@ void subtractYears(CDate *pDate, int years) {
%typemap(csvarout, excode=SWIGEXCODE2) CDate * %{ %typemap(csvarout, excode=SWIGEXCODE2) CDate * %{
/* csvarout typemap code */ /* csvarout typemap code */
get { get {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
CDate tempDate = (cPtr == IntPtr.Zero) ? null : new CDate(cPtr, $owner);$excode CDate tempDate = (cPtr == global::System.IntPtr.Zero) ? null : new CDate(cPtr, $owner);$excode
return new System.DateTime(tempDate.getYear(), tempDate.getMonth(), tempDate.getDay(), return new System.DateTime(tempDate.getYear(), tempDate.getMonth(), tempDate.getDay(),
0, 0, 0); 0, 0, 0);
} %} } %}

View file

@ -0,0 +1,48 @@
%module csharp_swig2_compatibility
%typemap(cscode) Foo %{
// Without the using directives generated by the
// SWIG 2 compatibility mode, this code would fail
// to build.
public void FooBar(string input)
{
Console.WriteLine(input);
}
%}
%pragma(csharp) imclasscode=%{
// Without the using directives generated by the
// SWIG 2 compatibility mode, this code would fail
// to build.
public void IntermediateClassMethod(string input)
{
Console.WriteLine(input);
}
%}
%pragma(csharp) modulecode=%{
// Without the using directives generated by the
// SWIG 2 compatibility mode, this code would fail
// to build.
public void ModuleClassMethod(string input)
{
Console.WriteLine(input);
}
%}
%inline %{
class Foo {
public:
Foo() {}
void Bar() {}
};
%}

View file

@ -94,7 +94,7 @@ Number times12(const Number* num) {
%typemap(csvarin, excode=SWIGEXCODE2) int %{ %typemap(csvarin, excode=SWIGEXCODE2) int %{
set { set {
if ($csinput < 0) if ($csinput < 0)
throw new ApplicationException("number too small!"); throw new global::System.ApplicationException("number too small!");
$imcall;$excode $imcall;$excode
} %} } %}

View file

@ -188,7 +188,7 @@ namespace Space {
#if defined(SWIGCSHARP) #if defined(SWIGCSHARP)
%typemap(cscode) Space::RenameMe %{ %typemap(cscode) Space::RenameMe %{
public static NewName factory(String s) { public static NewName factory(System.String s) {
//below should expand to: //below should expand to:
//return new NewName( new Name(s) ); //return new NewName( new Name(s) );
return new $typemap(cstype, Space::RenameMe)( new $typemap(cstype, Name)(s) ); return new $typemap(cstype, Space::RenameMe)( new $typemap(cstype, Name)(s) );

View file

@ -57,7 +57,7 @@
%typemap(ctype) CTYPE INPUT[] "CTYPE*" %typemap(ctype) CTYPE INPUT[] "CTYPE*"
%typemap(cstype) CTYPE INPUT[] "CSTYPE[]" %typemap(cstype) CTYPE INPUT[] "CSTYPE[]"
%typemap(imtype, inattributes="[In, MarshalAs(UnmanagedType.LPArray)]") CTYPE INPUT[] "CSTYPE[]" %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]") CTYPE INPUT[] "CSTYPE[]"
%typemap(csin) CTYPE INPUT[] "$csinput" %typemap(csin) CTYPE INPUT[] "$csinput"
%typemap(in) CTYPE INPUT[] "$1 = $input;" %typemap(in) CTYPE INPUT[] "$1 = $input;"
@ -68,7 +68,7 @@
%typemap(ctype) CTYPE OUTPUT[] "CTYPE*" %typemap(ctype) CTYPE OUTPUT[] "CTYPE*"
%typemap(cstype) CTYPE OUTPUT[] "CSTYPE[]" %typemap(cstype) CTYPE OUTPUT[] "CSTYPE[]"
%typemap(imtype, inattributes="[Out, MarshalAs(UnmanagedType.LPArray)]") CTYPE OUTPUT[] "CSTYPE[]" %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]") CTYPE OUTPUT[] "CSTYPE[]"
%typemap(csin) CTYPE OUTPUT[] "$csinput" %typemap(csin) CTYPE OUTPUT[] "$csinput"
%typemap(in) CTYPE OUTPUT[] "$1 = $input;" %typemap(in) CTYPE OUTPUT[] "$1 = $input;"
@ -79,7 +79,7 @@
%typemap(ctype) CTYPE INOUT[] "CTYPE*" %typemap(ctype) CTYPE INOUT[] "CTYPE*"
%typemap(cstype) CTYPE INOUT[] "CSTYPE[]" %typemap(cstype) CTYPE INOUT[] "CSTYPE[]"
%typemap(imtype, inattributes="[In, Out, MarshalAs(UnmanagedType.LPArray)]") CTYPE INOUT[] "CSTYPE[]" %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]") CTYPE INOUT[] "CSTYPE[]"
%typemap(csin) CTYPE INOUT[] "$csinput" %typemap(csin) CTYPE INOUT[] "$csinput"
%typemap(in) CTYPE INOUT[] "$1 = $input;" %typemap(in) CTYPE INOUT[] "$1 = $input;"
@ -108,12 +108,12 @@ CSHARP_ARRAYS(double, double)
%define CSHARP_ARRAYS_FIXED( CTYPE, CSTYPE ) %define CSHARP_ARRAYS_FIXED( CTYPE, CSTYPE )
%typemap(ctype) CTYPE FIXED[] "CTYPE*" %typemap(ctype) CTYPE FIXED[] "CTYPE*"
%typemap(imtype) CTYPE FIXED[] "IntPtr" %typemap(imtype) CTYPE FIXED[] "global::System.IntPtr"
%typemap(cstype) CTYPE FIXED[] "CSTYPE[]" %typemap(cstype) CTYPE FIXED[] "CSTYPE[]"
%typemap(csin, %typemap(csin,
pre= " fixed ( CSTYPE* swig_ptrTo_$csinput = $csinput ) {", pre= " fixed ( CSTYPE* swig_ptrTo_$csinput = $csinput ) {",
terminator=" }") terminator=" }")
CTYPE FIXED[] "(IntPtr)swig_ptrTo_$csinput" CTYPE FIXED[] "(global::System.IntPtr)swig_ptrTo_$csinput"
%typemap(in) CTYPE FIXED[] "$1 = $input;" %typemap(in) CTYPE FIXED[] "$1 = $input;"
%typemap(freearg) CTYPE FIXED[] "" %typemap(freearg) CTYPE FIXED[] ""

View file

@ -207,11 +207,11 @@
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &, SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *, SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "void *" SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "void *"
%typemap (imtype, out="IntPtr") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >, %typemap (imtype, out="global::System.IntPtr") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &, SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *, SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "HandleRef" SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "global::System.Runtime.InteropServices.HandleRef"
%typemap (cstype) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >, %typemap (cstype) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &, SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &,
@ -224,28 +224,28 @@
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "$typemap(cstype, TYPE).getCPtr($csinput)" SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "$typemap(cstype, TYPE).getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > { %typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} }
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > { %typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} }
%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & { %typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} }
%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * { %typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} }
%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& { %typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} }
%typemap(csvarout, excode=SWIGEXCODE2) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > %{ %typemap(csvarout, excode=SWIGEXCODE2) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > %{
@ -274,76 +274,76 @@
return ret; return ret;
} }
%typemap(csout, excode=SWIGEXCODE) CONST TYPE * { %typemap(csout, excode=SWIGEXCODE) CONST TYPE * {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} }
%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& { %typemap(csout, excode=SWIGEXCODE) TYPE *CONST& {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} }
// Base proxy classes // Base proxy classes
%typemap(csbody) TYPE %{ %typemap(csbody) TYPE %{
private HandleRef swigCPtr; private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private bool swigCMemOwnBase; private bool swigCMemOwnBase;
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) { PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwnBase = cMemoryOwn; swigCMemOwnBase = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
} }
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
} }
%} %}
// Derived proxy classes // Derived proxy classes
%typemap(csbody_derived) TYPE %{ %typemap(csbody_derived) TYPE %{
private HandleRef swigCPtr; private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private bool swigCMemOwnDerived; private bool swigCMemOwnDerived;
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) { PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
swigCMemOwnDerived = cMemoryOwn; swigCMemOwnDerived = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
} }
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
} }
%} %}
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE { %typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE {
lock(this) { lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) { if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnBase) { if (swigCMemOwnBase) {
swigCMemOwnBase = false; swigCMemOwnBase = false;
$imcall; $imcall;
} }
swigCPtr = new HandleRef(null, IntPtr.Zero); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
} }
GC.SuppressFinalize(this); global::System.GC.SuppressFinalize(this);
} }
} }
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE { %typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE {
lock(this) { lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) { if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnDerived) { if (swigCMemOwnDerived) {
swigCMemOwnDerived = false; swigCMemOwnDerived = false;
$imcall; $imcall;
} }
swigCPtr = new HandleRef(null, IntPtr.Zero); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
} }
GC.SuppressFinalize(this); global::System.GC.SuppressFinalize(this);
base.Dispose(); base.Dispose();
} }
} }
// CONST version needed ???? also for C# // CONST version needed ???? also for C#
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "HandleRef" %typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "HandleRef" %typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; %template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
@ -424,8 +424,8 @@
%typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE)" %typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE)"
%typemap (csin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE).getCPtr($csinput)" %typemap (csin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE).getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > { %typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
return (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true); return (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);
} }
%typemap(csout, excode=SWIGEXCODE) CONST TYPE { %typemap(csout, excode=SWIGEXCODE) CONST TYPE {
@ -435,75 +435,75 @@
return new $typemap(cstype, TYPE)($imcall, true); return new $typemap(cstype, TYPE)($imcall, true);
} }
%typemap(csout, excode=SWIGEXCODE) CONST TYPE * { %typemap(csout, excode=SWIGEXCODE) CONST TYPE * {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
return (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true); return (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);
} }
%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& { %typemap(csout, excode=SWIGEXCODE) TYPE *CONST& {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
return (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true); return (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);
} }
// Base proxy classes // Base proxy classes
%typemap(csbody) TYPE %{ %typemap(csbody) TYPE %{
private HandleRef swigCPtr; private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private bool swigCMemOwnBase; private bool swigCMemOwnBase;
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) { PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwnBase = cMemoryOwn; swigCMemOwnBase = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
} }
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
} }
%} %}
// Derived proxy classes // Derived proxy classes
%typemap(csbody_derived) TYPE %{ %typemap(csbody_derived) TYPE %{
private HandleRef swigCPtr; private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private bool swigCMemOwnDerived; private bool swigCMemOwnDerived;
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) { PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
swigCMemOwnDerived = cMemoryOwn; swigCMemOwnDerived = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
} }
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
} }
%} %}
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE { %typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE {
lock(this) { lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) { if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnBase) { if (swigCMemOwnBase) {
swigCMemOwnBase = false; swigCMemOwnBase = false;
$imcall; $imcall;
} }
swigCPtr = new HandleRef(null, IntPtr.Zero); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
} }
GC.SuppressFinalize(this); global::System.GC.SuppressFinalize(this);
} }
} }
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE { %typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE {
lock(this) { lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) { if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnDerived) { if (swigCMemOwnDerived) {
swigCMemOwnDerived = false; swigCMemOwnDerived = false;
$imcall; $imcall;
} }
swigCPtr = new HandleRef(null, IntPtr.Zero); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
} }
GC.SuppressFinalize(this); global::System.GC.SuppressFinalize(this);
base.Dispose(); base.Dispose();
} }
} }
// CONST version needed ???? also for C# // CONST version needed ???? also for C#
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "HandleRef" %typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "HandleRef" %typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; %template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;

View file

@ -95,10 +95,10 @@
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "void *" SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "void *"
%typemap (imtype, out="IntPtr") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, %typemap (imtype, out="global::System.IntPtr") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "HandleRef" SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "global::System.Runtime.InteropServices.HandleRef"
%typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, %typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
@ -110,23 +110,23 @@
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(cstype, TYPE).getCPtr($csinput)" SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(cstype, TYPE).getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > { %typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} }
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & { %typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} }
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * { %typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} }
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& { %typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} }
@ -140,13 +140,13 @@
return ret; return ret;
} }
%typemap(csout, excode=SWIGEXCODE) CONST TYPE * { %typemap(csout, excode=SWIGEXCODE) CONST TYPE * {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} }
%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& { %typemap(csout, excode=SWIGEXCODE) TYPE *CONST& {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} }
@ -157,78 +157,78 @@
} %} } %}
%typemap(csvarout, excode=SWIGEXCODE2) CONST TYPE * %{ %typemap(csvarout, excode=SWIGEXCODE2) CONST TYPE * %{
get { get {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, true);$excode $csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $csclassname(cPtr, true);$excode
return ret; return ret;
} %} } %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{ %typemap(csvarout, excode=SWIGEXCODE2) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
get { get {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} %} } %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{ %typemap(csvarout, excode=SWIGEXCODE2) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
get { get {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret; return ret;
} %} } %}
// Proxy classes (base classes, ie, not derived classes) // Proxy classes (base classes, ie, not derived classes)
%typemap(csbody) TYPE %{ %typemap(csbody) TYPE %{
private HandleRef swigCPtr; private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private bool swigCMemOwnBase; private bool swigCMemOwnBase;
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) { PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwnBase = cMemoryOwn; swigCMemOwnBase = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
} }
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
} }
%} %}
// Derived proxy classes // Derived proxy classes
%typemap(csbody_derived) TYPE %{ %typemap(csbody_derived) TYPE %{
private HandleRef swigCPtr; private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private bool swigCMemOwnDerived; private bool swigCMemOwnDerived;
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) { PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
swigCMemOwnDerived = cMemoryOwn; swigCMemOwnDerived = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
} }
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
} }
%} %}
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE { %typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE {
lock(this) { lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) { if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnBase) { if (swigCMemOwnBase) {
swigCMemOwnBase = false; swigCMemOwnBase = false;
$imcall; $imcall;
} }
swigCPtr = new HandleRef(null, IntPtr.Zero); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
} }
GC.SuppressFinalize(this); global::System.GC.SuppressFinalize(this);
} }
} }
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE { %typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE {
lock(this) { lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) { if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnDerived) { if (swigCMemOwnDerived) {
swigCMemOwnDerived = false; swigCMemOwnDerived = false;
$imcall; $imcall;
} }
swigCPtr = new HandleRef(null, IntPtr.Zero); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
} }
GC.SuppressFinalize(this); global::System.GC.SuppressFinalize(this);
base.Dispose(); base.Dispose();
} }
} }

View file

@ -11,6 +11,24 @@
* The imtype typemap contains the C# type used in the intermediary class. * The imtype typemap contains the C# type used in the intermediary class.
* The cstype typemap contains the C# type used in the C# proxy classes, type wrapper classes and module class. */ * The cstype typemap contains the C# type used in the C# proxy classes, type wrapper classes and module class. */
/* SWIG 3 no longer inserts using directives into generated C# code. For backwards compatibility, the SWIG2_CSHARP
macro can be defined to have SWIG 3 generate using directives similar to those generated by SWIG 2. */
#ifdef SWIG2_CSHARP
%typemap(csimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "\nusing global::System;\nusing global::System.Runtime.InteropServices;\n"
%pragma(csharp) moduleimports=%{
using global::System;
using global::System.Runtime.InteropServices;
%}
%pragma(csharp) imclassimports=%{
using global::System;
using global::System.Runtime.InteropServices;
%}
#endif
/* Fragments */ /* Fragments */
%fragment("SWIG_PackData", "header") { %fragment("SWIG_PackData", "header") {
@ -110,23 +128,23 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
/* Non primitive types */ /* Non primitive types */
%typemap(ctype) SWIGTYPE "void *" %typemap(ctype) SWIGTYPE "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE "HandleRef" %typemap(imtype, out="global::System.IntPtr") SWIGTYPE "global::System.Runtime.InteropServices.HandleRef"
%typemap(cstype) SWIGTYPE "$&csclassname" %typemap(cstype) SWIGTYPE "$&csclassname"
%typemap(ctype) SWIGTYPE [] "void *" %typemap(ctype) SWIGTYPE [] "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE [] "HandleRef" %typemap(imtype, out="global::System.IntPtr") SWIGTYPE [] "global::System.Runtime.InteropServices.HandleRef"
%typemap(cstype) SWIGTYPE [] "$csclassname" %typemap(cstype) SWIGTYPE [] "$csclassname"
%typemap(ctype) SWIGTYPE * "void *" %typemap(ctype) SWIGTYPE * "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE * "HandleRef" %typemap(imtype, out="global::System.IntPtr") SWIGTYPE * "global::System.Runtime.InteropServices.HandleRef"
%typemap(cstype) SWIGTYPE * "$csclassname" %typemap(cstype) SWIGTYPE * "$csclassname"
%typemap(ctype) SWIGTYPE & "void *" %typemap(ctype) SWIGTYPE & "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE & "HandleRef" %typemap(imtype, out="global::System.IntPtr") SWIGTYPE & "global::System.Runtime.InteropServices.HandleRef"
%typemap(cstype) SWIGTYPE & "$csclassname" %typemap(cstype) SWIGTYPE & "$csclassname"
%typemap(ctype) SWIGTYPE && "void *" %typemap(ctype) SWIGTYPE && "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE && "HandleRef" %typemap(imtype, out="global::System.IntPtr") SWIGTYPE && "global::System.Runtime.InteropServices.HandleRef"
%typemap(cstype) SWIGTYPE && "$csclassname" %typemap(cstype) SWIGTYPE && "$csclassname"
/* pointer to a class member */ /* pointer to a class member */
@ -447,7 +465,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(directorin) SWIGTYPE && %typemap(directorin) SWIGTYPE &&
%{ $input = ($1_ltype) &$1; %} %{ $input = ($1_ltype) &$1; %}
%typemap(csdirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*) "($iminput == IntPtr.Zero) ? null : new $csclassname($iminput, false)" %typemap(csdirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*) "($iminput == global::System.IntPtr.Zero) ? null : new $csclassname($iminput, false)"
%typemap(csdirectorin) SWIGTYPE & "new $csclassname($iminput, false)" %typemap(csdirectorin) SWIGTYPE & "new $csclassname($iminput, false)"
%typemap(csdirectorin) SWIGTYPE && "new $csclassname($iminput, false)" %typemap(csdirectorin) SWIGTYPE && "new $csclassname($iminput, false)"
%typemap(csdirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE &, SWIGTYPE && "$csclassname.getCPtr($cscall).Handle" %typemap(csdirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE &, SWIGTYPE && "$csclassname.getCPtr($cscall).Handle"
@ -683,8 +701,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
return ret; return ret;
} }
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE *, SWIGTYPE [] { %typemap(csout, excode=SWIGEXCODE) SWIGTYPE *, SWIGTYPE [] {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode $csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
return ret; return ret;
} }
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE (CLASS::*) { %typemap(csout, excode=SWIGEXCODE) SWIGTYPE (CLASS::*) {
@ -803,8 +821,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
} %} } %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE *, SWIGTYPE [] %{ %typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE *, SWIGTYPE [] %{
get { get {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode $csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
return ret; return ret;
} %} } %}
@ -817,12 +835,12 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
/* Pointer reference typemaps */ /* Pointer reference typemaps */
%typemap(ctype) SWIGTYPE *const& "void *" %typemap(ctype) SWIGTYPE *const& "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE *const& "HandleRef" %typemap(imtype, out="global::System.IntPtr") SWIGTYPE *const& "global::System.Runtime.InteropServices.HandleRef"
%typemap(cstype) SWIGTYPE *const& "$*csclassname" %typemap(cstype) SWIGTYPE *const& "$*csclassname"
%typemap(csin) SWIGTYPE *const& "$*csclassname.getCPtr($csinput)" %typemap(csin) SWIGTYPE *const& "$*csclassname.getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE *const& { %typemap(csout, excode=SWIGEXCODE) SWIGTYPE *const& {
IntPtr cPtr = $imcall; global::System.IntPtr cPtr = $imcall;
$*csclassname ret = (cPtr == IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode $*csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode
return ret; return ret;
} }
%typemap(in) SWIGTYPE *const& ($*1_ltype temp = 0) %typemap(in) SWIGTYPE *const& ($*1_ltype temp = 0)
@ -831,15 +849,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(out) SWIGTYPE *const& %typemap(out) SWIGTYPE *const&
%{ $result = (void *)*$1; %} %{ $result = (void *)*$1; %}
/* Marshal C/C++ pointer to IntPtr */ /* Marshal C/C++ pointer to global::System.IntPtr */
%typemap(ctype) void *VOID_INT_PTR "void *" %typemap(ctype) void *VOID_INT_PTR "void *"
%typemap(imtype) void *VOID_INT_PTR "IntPtr" %typemap(imtype) void *VOID_INT_PTR "global::System.IntPtr"
%typemap(cstype) void *VOID_INT_PTR "IntPtr" %typemap(cstype) void *VOID_INT_PTR "global::System.IntPtr"
%typemap(in) void *VOID_INT_PTR %{ $1 = ($1_ltype)$input; %} %typemap(in) void *VOID_INT_PTR %{ $1 = ($1_ltype)$input; %}
%typemap(out) void *VOID_INT_PTR %{ $result = (void *)$1; %} %typemap(out) void *VOID_INT_PTR %{ $result = (void *)$1; %}
%typemap(csin) void *VOID_INT_PTR "$csinput" %typemap(csin) void *VOID_INT_PTR "$csinput"
%typemap(csout, excode=SWIGEXCODE) void *VOID_INT_PTR { %typemap(csout, excode=SWIGEXCODE) void *VOID_INT_PTR {
IntPtr ret = $imcall;$excode global::System.IntPtr ret = $imcall;$excode
return ret; return ret;
} }
@ -848,8 +866,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%typemap(csbase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" %typemap(csbase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(csclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class" %typemap(csclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class"
%typemap(cscode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" %typemap(cscode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(csimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "\nusing System;\nusing System.Runtime.InteropServices;\n" %typemap(csinterfaces) SWIGTYPE "global::System.IDisposable"
%typemap(csinterfaces) SWIGTYPE "IDisposable"
%typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" %typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" %typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
@ -859,29 +876,29 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%define SWIG_CSBODY_PROXY(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...) %define SWIG_CSBODY_PROXY(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...)
// Proxy classes (base classes, ie, not derived classes) // Proxy classes (base classes, ie, not derived classes)
%typemap(csbody) TYPE %{ %typemap(csbody) TYPE %{
private HandleRef swigCPtr; private global::System.Runtime.InteropServices.HandleRef swigCPtr;
protected bool swigCMemOwn; protected bool swigCMemOwn;
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) { PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn; swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
} }
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
} }
%} %}
// Derived proxy classes // Derived proxy classes
%typemap(csbody_derived) TYPE %{ %typemap(csbody_derived) TYPE %{
private HandleRef swigCPtr; private global::System.Runtime.InteropServices.HandleRef swigCPtr;
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGUpcast(cPtr), cMemoryOwn) { PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
} }
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
} }
%} %}
%enddef %enddef
@ -889,18 +906,18 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%define SWIG_CSBODY_TYPEWRAPPER(PTRCTOR_VISIBILITY, DEFAULTCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...) %define SWIG_CSBODY_TYPEWRAPPER(PTRCTOR_VISIBILITY, DEFAULTCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...)
// Typewrapper classes // Typewrapper classes
%typemap(csbody) TYPE *, TYPE &, TYPE &&, TYPE [] %{ %typemap(csbody) TYPE *, TYPE &, TYPE &&, TYPE [] %{
private HandleRef swigCPtr; private global::System.Runtime.InteropServices.HandleRef swigCPtr;
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool futureUse) { PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool futureUse) {
swigCPtr = new HandleRef(this, cPtr); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
} }
DEFAULTCTOR_VISIBILITY $csclassname() { DEFAULTCTOR_VISIBILITY $csclassname() {
swigCPtr = new HandleRef(null, IntPtr.Zero); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
} }
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
} }
%} %}
@ -938,27 +955,27 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") SWIGTYPE { %typemap(csdestruct, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
lock(this) { lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) { if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) { if (swigCMemOwn) {
swigCMemOwn = false; swigCMemOwn = false;
$imcall; $imcall;
} }
swigCPtr = new HandleRef(null, IntPtr.Zero); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
} }
GC.SuppressFinalize(this); global::System.GC.SuppressFinalize(this);
} }
} }
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") SWIGTYPE { %typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
lock(this) { lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) { if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) { if (swigCMemOwn) {
swigCMemOwn = false; swigCMemOwn = false;
$imcall; $imcall;
} }
swigCPtr = new HandleRef(null, IntPtr.Zero); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
} }
GC.SuppressFinalize(this); global::System.GC.SuppressFinalize(this);
base.Dispose(); base.Dispose();
} }
} }
@ -981,16 +998,6 @@ SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
%pragma(csharp) imclassclassmodifiers="class" %pragma(csharp) imclassclassmodifiers="class"
%pragma(csharp) moduleclassmodifiers="public class" %pragma(csharp) moduleclassmodifiers="public class"
%pragma(csharp) moduleimports=%{
using System;
using System.Runtime.InteropServices;
%}
%pragma(csharp) imclassimports=%{
using System;
using System.Runtime.InteropServices;
%}
/* Some ANSI C typemaps */ /* Some ANSI C typemaps */
%apply unsigned long { size_t }; %apply unsigned long { size_t };
@ -1015,23 +1022,23 @@ using System.Runtime.InteropServices;
/* /*
// Alternative char * typemaps. // Alternative char * typemaps.
%pragma(csharp) imclasscode=%{ %pragma(csharp) imclasscode=%{
public class SWIGStringMarshal : IDisposable { public class SWIGStringMarshal : global::System.IDisposable {
public readonly HandleRef swigCPtr; public readonly global::System.Runtime.InteropServices.HandleRef swigCPtr;
public SWIGStringMarshal(string str) { public SWIGStringMarshal(string str) {
swigCPtr = new HandleRef(this, System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(str)); swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, global::System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(str));
} }
public virtual void Dispose() { public virtual void Dispose() {
System.Runtime.InteropServices.Marshal.FreeHGlobal(swigCPtr.Handle); global::System.Runtime.InteropServices.Marshal.FreeHGlobal(swigCPtr.Handle);
GC.SuppressFinalize(this); global::System.GC.SuppressFinalize(this);
} }
} }
%} %}
%typemap(imtype, out="IntPtr") char *, char[ANY], char[] "HandleRef" %typemap(imtype, out="global::System.IntPtr") char *, char[ANY], char[] "global::System.Runtime.InteropServices.HandleRef"
%typemap(out) char *, char[ANY], char[] %{ $result = $1; %} %typemap(out) char *, char[ANY], char[] %{ $result = $1; %}
%typemap(csin) char *, char[ANY], char[] "new $imclassname.SWIGStringMarshal($csinput).swigCPtr" %typemap(csin) char *, char[ANY], char[] "new $imclassname.SWIGStringMarshal($csinput).swigCPtr"
%typemap(csout, excode=SWIGEXCODE) char *, char[ANY], char[] { %typemap(csout, excode=SWIGEXCODE) char *, char[ANY], char[] {
string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
return ret; return ret;
} }
%typemap(csvarin, excode=SWIGEXCODE2) char *, char[ANY], char[] %{ %typemap(csvarin, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
@ -1040,7 +1047,7 @@ using System.Runtime.InteropServices;
} %} } %}
%typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{ %typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
get { get {
string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
return ret; return ret;
} %} } %}
*/ */

View file

@ -149,7 +149,7 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException); static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException);
static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException); static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException);
[DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionCallbacks_$module")] [global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionCallbacks_$module")]
public static extern void SWIGRegisterExceptionCallbacks_$module( public static extern void SWIGRegisterExceptionCallbacks_$module(
ExceptionDelegate applicationDelegate, ExceptionDelegate applicationDelegate,
ExceptionDelegate arithmeticDelegate, ExceptionDelegate arithmeticDelegate,
@ -163,58 +163,58 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
ExceptionDelegate overflowDelegate, ExceptionDelegate overflowDelegate,
ExceptionDelegate systemExceptionDelegate); ExceptionDelegate systemExceptionDelegate);
[DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_$module")] [global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_$module")]
public static extern void SWIGRegisterExceptionCallbacksArgument_$module( public static extern void SWIGRegisterExceptionCallbacksArgument_$module(
ExceptionArgumentDelegate argumentDelegate, ExceptionArgumentDelegate argumentDelegate,
ExceptionArgumentDelegate argumentNullDelegate, ExceptionArgumentDelegate argumentNullDelegate,
ExceptionArgumentDelegate argumentOutOfRangeDelegate); ExceptionArgumentDelegate argumentOutOfRangeDelegate);
static void SetPendingApplicationException(string message) { static void SetPendingApplicationException(string message) {
SWIGPendingException.Set(new System.ApplicationException(message, SWIGPendingException.Retrieve())); SWIGPendingException.Set(new global::System.ApplicationException(message, SWIGPendingException.Retrieve()));
} }
static void SetPendingArithmeticException(string message) { static void SetPendingArithmeticException(string message) {
SWIGPendingException.Set(new System.ArithmeticException(message, SWIGPendingException.Retrieve())); SWIGPendingException.Set(new global::System.ArithmeticException(message, SWIGPendingException.Retrieve()));
} }
static void SetPendingDivideByZeroException(string message) { static void SetPendingDivideByZeroException(string message) {
SWIGPendingException.Set(new System.DivideByZeroException(message, SWIGPendingException.Retrieve())); SWIGPendingException.Set(new global::System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
} }
static void SetPendingIndexOutOfRangeException(string message) { static void SetPendingIndexOutOfRangeException(string message) {
SWIGPendingException.Set(new System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve())); SWIGPendingException.Set(new global::System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
} }
static void SetPendingInvalidCastException(string message) { static void SetPendingInvalidCastException(string message) {
SWIGPendingException.Set(new System.InvalidCastException(message, SWIGPendingException.Retrieve())); SWIGPendingException.Set(new global::System.InvalidCastException(message, SWIGPendingException.Retrieve()));
} }
static void SetPendingInvalidOperationException(string message) { static void SetPendingInvalidOperationException(string message) {
SWIGPendingException.Set(new System.InvalidOperationException(message, SWIGPendingException.Retrieve())); SWIGPendingException.Set(new global::System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
} }
static void SetPendingIOException(string message) { static void SetPendingIOException(string message) {
SWIGPendingException.Set(new System.IO.IOException(message, SWIGPendingException.Retrieve())); SWIGPendingException.Set(new global::System.IO.IOException(message, SWIGPendingException.Retrieve()));
} }
static void SetPendingNullReferenceException(string message) { static void SetPendingNullReferenceException(string message) {
SWIGPendingException.Set(new System.NullReferenceException(message, SWIGPendingException.Retrieve())); SWIGPendingException.Set(new global::System.NullReferenceException(message, SWIGPendingException.Retrieve()));
} }
static void SetPendingOutOfMemoryException(string message) { static void SetPendingOutOfMemoryException(string message) {
SWIGPendingException.Set(new System.OutOfMemoryException(message, SWIGPendingException.Retrieve())); SWIGPendingException.Set(new global::System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
} }
static void SetPendingOverflowException(string message) { static void SetPendingOverflowException(string message) {
SWIGPendingException.Set(new System.OverflowException(message, SWIGPendingException.Retrieve())); SWIGPendingException.Set(new global::System.OverflowException(message, SWIGPendingException.Retrieve()));
} }
static void SetPendingSystemException(string message) { static void SetPendingSystemException(string message) {
SWIGPendingException.Set(new System.SystemException(message, SWIGPendingException.Retrieve())); SWIGPendingException.Set(new global::System.SystemException(message, SWIGPendingException.Retrieve()));
} }
static void SetPendingArgumentException(string message, string paramName) { static void SetPendingArgumentException(string message, string paramName) {
SWIGPendingException.Set(new System.ArgumentException(message, paramName, SWIGPendingException.Retrieve())); SWIGPendingException.Set(new global::System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
} }
static void SetPendingArgumentNullException(string message, string paramName) { static void SetPendingArgumentNullException(string message, string paramName) {
Exception e = SWIGPendingException.Retrieve(); global::System.Exception e = SWIGPendingException.Retrieve();
if (e != null) message = message + " Inner Exception: " + e.Message; if (e != null) message = message + " Inner Exception: " + e.Message;
SWIGPendingException.Set(new System.ArgumentNullException(paramName, message)); SWIGPendingException.Set(new global::System.ArgumentNullException(paramName, message));
} }
static void SetPendingArgumentOutOfRangeException(string message, string paramName) { static void SetPendingArgumentOutOfRangeException(string message, string paramName) {
Exception e = SWIGPendingException.Retrieve(); global::System.Exception e = SWIGPendingException.Retrieve();
if (e != null) message = message + " Inner Exception: " + e.Message; if (e != null) message = message + " Inner Exception: " + e.Message;
SWIGPendingException.Set(new System.ArgumentOutOfRangeException(paramName, message)); SWIGPendingException.Set(new global::System.ArgumentOutOfRangeException(paramName, message));
} }
static SWIGExceptionHelper() { static SWIGExceptionHelper() {
@ -241,8 +241,8 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper(); protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper();
public class SWIGPendingException { public class SWIGPendingException {
[ThreadStatic] [global::System.ThreadStatic]
private static Exception pendingException = null; private static global::System.Exception pendingException = null;
private static int numExceptionsPending = 0; private static int numExceptionsPending = 0;
public static bool Pending { public static bool Pending {
@ -255,17 +255,17 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
} }
} }
public static void Set(Exception e) { public static void Set(global::System.Exception e) {
if (pendingException != null) if (pendingException != null)
throw new ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e); throw new global::System.ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
pendingException = e; pendingException = e;
lock(typeof($imclassname)) { lock(typeof($imclassname)) {
numExceptionsPending++; numExceptionsPending++;
} }
} }
public static Exception Retrieve() { public static global::System.Exception Retrieve() {
Exception e = null; global::System.Exception e = null;
if (numExceptionsPending > 0) { if (numExceptionsPending > 0) {
if (pendingException != null) { if (pendingException != null) {
e = pendingException; e = pendingException;
@ -294,7 +294,7 @@ static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback = NULL;
public delegate string SWIGStringDelegate(string message); public delegate string SWIGStringDelegate(string message);
static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString); static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
[DllImport("$dllimport", EntryPoint="SWIGRegisterStringCallback_$module")] [global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterStringCallback_$module")]
public static extern void SWIGRegisterStringCallback_$module(SWIGStringDelegate stringDelegate); public static extern void SWIGRegisterStringCallback_$module(SWIGStringDelegate stringDelegate);
static string CreateString(string cString) { static string CreateString(string cString) {

View file

@ -97,7 +97,7 @@
for (int i = 0; i < swigValues.Length; i++) for (int i = 0; i < swigValues.Length; i++)
if (swigValues[i].swigValue == swigValue) if (swigValues[i].swigValue == swigValue)
return swigValues[i]; return swigValues[i];
throw new System.ArgumentOutOfRangeException("No enum $csclassname with value " + swigValue); throw new global::System.ArgumentOutOfRangeException("No enum $csclassname with value " + swigValue);
} }
public override string ToString() { public override string ToString() {

View file

@ -11,9 +11,7 @@
* %template(MapIntDouble) std::map<int, double> * %template(MapIntDouble) std::map<int, double>
* *
* Notes: * Notes:
* 1) For .NET 1 compatibility, define SWIG_DOTNET_1 when compiling the C# code. In this case * 1) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
* the C# wrapper has only basic functionality.
* 2) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
* C++ std::map wrappers. * C++ std::map wrappers.
* *
* Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents! * Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents!
@ -28,7 +26,7 @@
/* K is the C++ key type, T is the C++ value type */ /* K is the C++ key type, T is the C++ value type */
%define SWIG_STD_MAP_INTERNAL(K, T, C) %define SWIG_STD_MAP_INTERNAL(K, T, C)
%typemap(csinterfaces) std::map< K, T, C > "IDisposable \n#if !SWIG_DOTNET_1\n , System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n#endif\n"; %typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n";
%typemap(cscode) std::map<K, T, C > %{ %typemap(cscode) std::map<K, T, C > %{
public $typemap(cstype, T) this[$typemap(cstype, K) key] { public $typemap(cstype, T) this[$typemap(cstype, K) key] {
@ -62,14 +60,12 @@
} }
} }
#if !SWIG_DOTNET_1 public global::System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys {
public System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys {
get { get {
System.Collections.Generic.ICollection<$typemap(cstype, K)> keys = new System.Collections.Generic.List<$typemap(cstype, K)>(); global::System.Collections.Generic.ICollection<$typemap(cstype, K)> keys = new global::System.Collections.Generic.List<$typemap(cstype, K)>();
int size = this.Count; int size = this.Count;
if (size > 0) { if (size > 0) {
IntPtr iter = create_iterator_begin(); global::System.IntPtr iter = create_iterator_begin();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
keys.Add(get_next_key(iter)); keys.Add(get_next_key(iter));
} }
@ -79,21 +75,21 @@
} }
} }
public System.Collections.Generic.ICollection<$typemap(cstype, T)> Values { public global::System.Collections.Generic.ICollection<$typemap(cstype, T)> Values {
get { get {
System.Collections.Generic.ICollection<$typemap(cstype, T)> vals = new System.Collections.Generic.List<$typemap(cstype, T)>(); global::System.Collections.Generic.ICollection<$typemap(cstype, T)> vals = new global::System.Collections.Generic.List<$typemap(cstype, T)>();
foreach (System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> pair in this) { foreach (global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> pair in this) {
vals.Add(pair.Value); vals.Add(pair.Value);
} }
return vals; return vals;
} }
} }
public void Add(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) { public void Add(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
Add(item.Key, item.Value); Add(item.Key, item.Value);
} }
public bool Remove(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) { public bool Remove(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
if (Contains(item)) { if (Contains(item)) {
return Remove(item.Key); return Remove(item.Key);
} else { } else {
@ -101,7 +97,7 @@
} }
} }
public bool Contains(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) { public bool Contains(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
if (this[item.Key] == item.Value) { if (this[item.Key] == item.Value) {
return true; return true;
} else { } else {
@ -109,32 +105,32 @@
} }
} }
public void CopyTo(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array) { public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array) {
CopyTo(array, 0); CopyTo(array, 0);
} }
public void CopyTo(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array, int arrayIndex) { public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array, int arrayIndex) {
if (array == null) if (array == null)
throw new ArgumentNullException("array"); throw new global::System.ArgumentNullException("array");
if (arrayIndex < 0) if (arrayIndex < 0)
throw new ArgumentOutOfRangeException("arrayIndex", "Value is less than zero"); throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
if (array.Rank > 1) if (array.Rank > 1)
throw new ArgumentException("Multi dimensional array.", "array"); throw new global::System.ArgumentException("Multi dimensional array.", "array");
if (arrayIndex+this.Count > array.Length) if (arrayIndex+this.Count > array.Length)
throw new ArgumentException("Number of elements to copy is too large."); throw new global::System.ArgumentException("Number of elements to copy is too large.");
System.Collections.Generic.IList<$typemap(cstype, K)> keyList = new System.Collections.Generic.List<$typemap(cstype, K)>(this.Keys); global::System.Collections.Generic.IList<$typemap(cstype, K)> keyList = new global::System.Collections.Generic.List<$typemap(cstype, K)>(this.Keys);
for (int i = 0; i < keyList.Count; i++) { for (int i = 0; i < keyList.Count; i++) {
$typemap(cstype, K) currentKey = keyList[i]; $typemap(cstype, K) currentKey = keyList[i];
array.SetValue(new System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, this[currentKey]), arrayIndex+i); array.SetValue(new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, this[currentKey]), arrayIndex+i);
} }
} }
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>.GetEnumerator() { global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>> global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>.GetEnumerator() {
return new $csclassnameEnumerator(this); return new $csclassnameEnumerator(this);
} }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
return new $csclassnameEnumerator(this); return new $csclassnameEnumerator(this);
} }
@ -147,38 +143,38 @@
/// whenever the collection is modified. This has been done for changes in the size of the /// whenever the collection is modified. This has been done for changes in the size of the
/// collection but not when one of the elements of the collection is modified as it is a bit /// collection but not when one of the elements of the collection is modified as it is a bit
/// tricky to detect unmanaged code that modifies the collection under our feet. /// tricky to detect unmanaged code that modifies the collection under our feet.
public sealed class $csclassnameEnumerator : System.Collections.IEnumerator, public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator,
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>> global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>
{ {
private $csclassname collectionRef; private $csclassname collectionRef;
private System.Collections.Generic.IList<$typemap(cstype, K)> keyCollection; private global::System.Collections.Generic.IList<$typemap(cstype, K)> keyCollection;
private int currentIndex; private int currentIndex;
private object currentObject; private object currentObject;
private int currentSize; private int currentSize;
public $csclassnameEnumerator($csclassname collection) { public $csclassnameEnumerator($csclassname collection) {
collectionRef = collection; collectionRef = collection;
keyCollection = new System.Collections.Generic.List<$typemap(cstype, K)>(collection.Keys); keyCollection = new global::System.Collections.Generic.List<$typemap(cstype, K)>(collection.Keys);
currentIndex = -1; currentIndex = -1;
currentObject = null; currentObject = null;
currentSize = collectionRef.Count; currentSize = collectionRef.Count;
} }
// Type-safe iterator Current // Type-safe iterator Current
public System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> Current { public global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> Current {
get { get {
if (currentIndex == -1) if (currentIndex == -1)
throw new InvalidOperationException("Enumeration not started."); throw new global::System.InvalidOperationException("Enumeration not started.");
if (currentIndex > currentSize - 1) if (currentIndex > currentSize - 1)
throw new InvalidOperationException("Enumeration finished."); throw new global::System.InvalidOperationException("Enumeration finished.");
if (currentObject == null) if (currentObject == null)
throw new InvalidOperationException("Collection modified."); throw new global::System.InvalidOperationException("Collection modified.");
return (System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>)currentObject; return (global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>)currentObject;
} }
} }
// Type-unsafe IEnumerator.Current // Type-unsafe IEnumerator.Current
object System.Collections.IEnumerator.Current { object global::System.Collections.IEnumerator.Current {
get { get {
return Current; return Current;
} }
@ -190,7 +186,7 @@
if (moveOkay) { if (moveOkay) {
currentIndex++; currentIndex++;
$typemap(cstype, K) currentKey = keyCollection[currentIndex]; $typemap(cstype, K) currentKey = keyCollection[currentIndex];
currentObject = new System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, collectionRef[currentKey]); currentObject = new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, collectionRef[currentKey]);
} else { } else {
currentObject = null; currentObject = null;
} }
@ -201,7 +197,7 @@
currentIndex = -1; currentIndex = -1;
currentObject = null; currentObject = null;
if (collectionRef.Count != currentSize) { if (collectionRef.Count != currentSize) {
throw new InvalidOperationException("Collection modified."); throw new global::System.InvalidOperationException("Collection modified.");
} }
} }
@ -210,7 +206,6 @@
currentObject = null; currentObject = null;
} }
} }
#endif
%} %}

View file

@ -4,8 +4,6 @@
* SWIG typemaps for std::vector<T> * SWIG typemaps for std::vector<T>
* C# implementation * C# implementation
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.List<> collection. * The C# wrapper is made to look and feel like a C# System.Collections.Generic.List<> collection.
* For .NET 1 compatibility, define SWIG_DOTNET_1 when compiling the C# code; then the C# wrapper is
* made to look and feel like a typesafe C# System.Collections.ArrayList.
* *
* Note that IEnumerable<> is implemented in the proxy class which is useful for using LINQ with * Note that IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
* C++ std::vector wrappers. The IList<> interface is also implemented to provide enhanced functionality * C++ std::vector wrappers. The IList<> interface is also implemented to provide enhanced functionality
@ -26,11 +24,11 @@
// MACRO for use within the std::vector class body // MACRO for use within the std::vector class body
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...) %define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...)
%typemap(csinterfaces) std::vector< CTYPE > "IDisposable, System.Collections.IEnumerable\n#if !SWIG_DOTNET_1\n , System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n#endif\n"; %typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n";
%typemap(cscode) std::vector< CTYPE > %{ %typemap(cscode) std::vector< CTYPE > %{
public $csclassname(System.Collections.ICollection c) : this() { public $csclassname(global::System.Collections.ICollection c) : this() {
if (c == null) if (c == null)
throw new ArgumentNullException("c"); throw new global::System.ArgumentNullException("c");
foreach ($typemap(cstype, CTYPE) element in c) { foreach ($typemap(cstype, CTYPE) element in c) {
this.Add(element); this.Add(element);
} }
@ -63,7 +61,7 @@
} }
set { set {
if (value < size()) if (value < size())
throw new ArgumentOutOfRangeException("Capacity"); throw new global::System.ArgumentOutOfRangeException("Capacity");
reserve((uint)value); reserve((uint)value);
} }
} }
@ -80,53 +78,39 @@
} }
} }
#if SWIG_DOTNET_1
public void CopyTo(System.Array array)
#else
public void CopyTo($typemap(cstype, CTYPE)[] array) public void CopyTo($typemap(cstype, CTYPE)[] array)
#endif
{ {
CopyTo(0, array, 0, this.Count); CopyTo(0, array, 0, this.Count);
} }
#if SWIG_DOTNET_1
public void CopyTo(System.Array array, int arrayIndex)
#else
public void CopyTo($typemap(cstype, CTYPE)[] array, int arrayIndex) public void CopyTo($typemap(cstype, CTYPE)[] array, int arrayIndex)
#endif
{ {
CopyTo(0, array, arrayIndex, this.Count); CopyTo(0, array, arrayIndex, this.Count);
} }
#if SWIG_DOTNET_1
public void CopyTo(int index, System.Array array, int arrayIndex, int count)
#else
public void CopyTo(int index, $typemap(cstype, CTYPE)[] array, int arrayIndex, int count) public void CopyTo(int index, $typemap(cstype, CTYPE)[] array, int arrayIndex, int count)
#endif
{ {
if (array == null) if (array == null)
throw new ArgumentNullException("array"); throw new global::System.ArgumentNullException("array");
if (index < 0) if (index < 0)
throw new ArgumentOutOfRangeException("index", "Value is less than zero"); throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
if (arrayIndex < 0) if (arrayIndex < 0)
throw new ArgumentOutOfRangeException("arrayIndex", "Value is less than zero"); throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
if (count < 0) if (count < 0)
throw new ArgumentOutOfRangeException("count", "Value is less than zero"); throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
if (array.Rank > 1) if (array.Rank > 1)
throw new ArgumentException("Multi dimensional array.", "array"); throw new global::System.ArgumentException("Multi dimensional array.", "array");
if (index+count > this.Count || arrayIndex+count > array.Length) if (index+count > this.Count || arrayIndex+count > array.Length)
throw new ArgumentException("Number of elements to copy is too large."); throw new global::System.ArgumentException("Number of elements to copy is too large.");
for (int i=0; i<count; i++) for (int i=0; i<count; i++)
array.SetValue(getitemcopy(index+i), arrayIndex+i); array.SetValue(getitemcopy(index+i), arrayIndex+i);
} }
#if !SWIG_DOTNET_1 global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() {
System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() {
return new $csclassnameEnumerator(this); return new $csclassnameEnumerator(this);
} }
#endif
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
return new $csclassnameEnumerator(this); return new $csclassnameEnumerator(this);
} }
@ -139,10 +123,8 @@
/// whenever the collection is modified. This has been done for changes in the size of the /// whenever the collection is modified. This has been done for changes in the size of the
/// collection but not when one of the elements of the collection is modified as it is a bit /// collection but not when one of the elements of the collection is modified as it is a bit
/// tricky to detect unmanaged code that modifies the collection under our feet. /// tricky to detect unmanaged code that modifies the collection under our feet.
public sealed class $csclassnameEnumerator : System.Collections.IEnumerator public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator
#if !SWIG_DOTNET_1 , global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
, System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
#endif
{ {
private $csclassname collectionRef; private $csclassname collectionRef;
private int currentIndex; private int currentIndex;
@ -160,17 +142,17 @@
public $typemap(cstype, CTYPE) Current { public $typemap(cstype, CTYPE) Current {
get { get {
if (currentIndex == -1) if (currentIndex == -1)
throw new InvalidOperationException("Enumeration not started."); throw new global::System.InvalidOperationException("Enumeration not started.");
if (currentIndex > currentSize - 1) if (currentIndex > currentSize - 1)
throw new InvalidOperationException("Enumeration finished."); throw new global::System.InvalidOperationException("Enumeration finished.");
if (currentObject == null) if (currentObject == null)
throw new InvalidOperationException("Collection modified."); throw new global::System.InvalidOperationException("Collection modified.");
return ($typemap(cstype, CTYPE))currentObject; return ($typemap(cstype, CTYPE))currentObject;
} }
} }
// Type-unsafe IEnumerator.Current // Type-unsafe IEnumerator.Current
object System.Collections.IEnumerator.Current { object global::System.Collections.IEnumerator.Current {
get { get {
return Current; return Current;
} }
@ -192,16 +174,14 @@
currentIndex = -1; currentIndex = -1;
currentObject = null; currentObject = null;
if (collectionRef.Count != currentSize) { if (collectionRef.Count != currentSize) {
throw new InvalidOperationException("Collection modified."); throw new global::System.InvalidOperationException("Collection modified.");
} }
} }
#if !SWIG_DOTNET_1
public void Dispose() { public void Dispose() {
currentIndex = -1; currentIndex = -1;
currentObject = null; currentObject = null;
} }
#endif
} }
%} %}

View file

@ -23,7 +23,7 @@ class wstring;
// wstring // wstring
%typemap(ctype, out="void *") wstring "wchar_t *" %typemap(ctype, out="void *") wstring "wchar_t *"
%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]") wstring "string" %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") wstring "string"
%typemap(cstype) wstring "string" %typemap(cstype) wstring "string"
%typemap(csdirectorin) wstring "$iminput" %typemap(csdirectorin) wstring "$iminput"
%typemap(csdirectorout) wstring "$cscall" %typemap(csdirectorout) wstring "$cscall"
@ -60,7 +60,7 @@ class wstring;
// const wstring & // const wstring &
%typemap(ctype, out="void *") const wstring & "wchar_t *" %typemap(ctype, out="void *") const wstring & "wchar_t *"
%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]") const wstring & "string" %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") const wstring & "string"
%typemap(cstype) const wstring & "string" %typemap(cstype) const wstring & "string"
%typemap(csdirectorin) const wstring & "$iminput" %typemap(csdirectorin) const wstring & "$iminput"

View file

@ -55,7 +55,7 @@ In C# you could then use it like this:
%define INPUT_TYPEMAP(TYPE, CTYPE, CSTYPE) %define INPUT_TYPEMAP(TYPE, CTYPE, CSTYPE)
%typemap(ctype, out="void *") TYPE *INPUT, TYPE &INPUT "CTYPE" %typemap(ctype, out="void *") TYPE *INPUT, TYPE &INPUT "CTYPE"
%typemap(imtype, out="IntPtr") TYPE *INPUT, TYPE &INPUT "CSTYPE" %typemap(imtype, out="global::System.IntPtr") TYPE *INPUT, TYPE &INPUT "CSTYPE"
%typemap(cstype, out="$csclassname") TYPE *INPUT, TYPE &INPUT "CSTYPE" %typemap(cstype, out="$csclassname") TYPE *INPUT, TYPE &INPUT "CSTYPE"
%typemap(csin) TYPE *INPUT, TYPE &INPUT "$csinput" %typemap(csin) TYPE *INPUT, TYPE &INPUT "$csinput"
@ -135,7 +135,7 @@ value returned in the second output parameter. In C# you would use it like this:
%define OUTPUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE) %define OUTPUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE)
%typemap(ctype, out="void *") TYPE *OUTPUT, TYPE &OUTPUT "CTYPE *" %typemap(ctype, out="void *") TYPE *OUTPUT, TYPE &OUTPUT "CTYPE *"
%typemap(imtype, out="IntPtr") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE" %typemap(imtype, out="global::System.IntPtr") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE"
%typemap(cstype, out="$csclassname") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE" %typemap(cstype, out="$csclassname") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE"
%typemap(csin) TYPE *OUTPUT, TYPE &OUTPUT "out $csinput" %typemap(csin) TYPE *OUTPUT, TYPE &OUTPUT "out $csinput"
@ -224,7 +224,7 @@ of the function return value.
%define INOUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE) %define INOUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE)
%typemap(ctype, out="void *") TYPE *INOUT, TYPE &INOUT "CTYPE *" %typemap(ctype, out="void *") TYPE *INOUT, TYPE &INOUT "CTYPE *"
%typemap(imtype, out="IntPtr") TYPE *INOUT, TYPE &INOUT "ref CSTYPE" %typemap(imtype, out="global::System.IntPtr") TYPE *INOUT, TYPE &INOUT "ref CSTYPE"
%typemap(cstype, out="$csclassname") TYPE *INOUT, TYPE &INOUT "ref CSTYPE" %typemap(cstype, out="$csclassname") TYPE *INOUT, TYPE &INOUT "ref CSTYPE"
%typemap(csin) TYPE *INOUT, TYPE &INOUT "ref $csinput" %typemap(csin) TYPE *INOUT, TYPE &INOUT "ref $csinput"

View file

@ -20,14 +20,14 @@ static SWIG_CSharpWStringHelperCallback SWIG_csharp_wstring_callback = NULL;
%pragma(csharp) imclasscode=%{ %pragma(csharp) imclasscode=%{
protected class SWIGWStringHelper { protected class SWIGWStringHelper {
public delegate string SWIGWStringDelegate(IntPtr message); public delegate string SWIGWStringDelegate(global::System.IntPtr message);
static SWIGWStringDelegate wstringDelegate = new SWIGWStringDelegate(CreateWString); static SWIGWStringDelegate wstringDelegate = new SWIGWStringDelegate(CreateWString);
[DllImport("$dllimport", EntryPoint="SWIGRegisterWStringCallback_$module")] [global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterWStringCallback_$module")]
public static extern void SWIGRegisterWStringCallback_$module(SWIGWStringDelegate wstringDelegate); public static extern void SWIGRegisterWStringCallback_$module(SWIGWStringDelegate wstringDelegate);
static string CreateWString([MarshalAs(UnmanagedType.LPWStr)]IntPtr cString) { static string CreateWString([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString) {
return System.Runtime.InteropServices.Marshal.PtrToStringUni(cString); return global::System.Runtime.InteropServices.Marshal.PtrToStringUni(cString);
} }
static SWIGWStringHelper() { static SWIGWStringHelper() {
@ -77,12 +77,12 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStri
// wchar_t * // wchar_t *
%typemap(ctype) wchar_t * "wchar_t *" %typemap(ctype) wchar_t * "wchar_t *"
%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]", out="IntPtr" ) wchar_t * "string" %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", out="global::System.IntPtr" ) wchar_t * "string"
%typemap(cstype) wchar_t * "string" %typemap(cstype) wchar_t * "string"
%typemap(csin) wchar_t * "$csinput" %typemap(csin) wchar_t * "$csinput"
%typemap(csout, excode=SWIGEXCODE) wchar_t * { %typemap(csout, excode=SWIGEXCODE) wchar_t * {
string ret = System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode
return ret; return ret;
} }
%typemap(csvarin, excode=SWIGEXCODE2) wchar_t * %{ %typemap(csvarin, excode=SWIGEXCODE2) wchar_t * %{

View file

@ -776,7 +776,7 @@ public:
} }
} }
Printv(imclass_class_code, "\n [DllImport(\"", dllimport, "\", EntryPoint=\"", wname, "\")]\n", NIL); Printv(imclass_class_code, "\n [global::System.Runtime.InteropServices.DllImport(\"", dllimport, "\", EntryPoint=\"", wname, "\")]\n", NIL);
if (im_outattributes) if (im_outattributes)
Printf(imclass_class_code, " %s\n", im_outattributes); Printf(imclass_class_code, " %s\n", im_outattributes);
@ -1699,7 +1699,7 @@ public:
if (*Char(destructor_call)) if (*Char(destructor_call))
Replaceall(destruct, "$imcall", destructor_call); Replaceall(destruct, "$imcall", destructor_call);
else else
Replaceall(destruct, "$imcall", "throw new MethodAccessException(\"C++ destructor does not have public access\")"); Replaceall(destruct, "$imcall", "throw new global::System.MethodAccessException(\"C++ destructor does not have public access\")");
if (*Char(destruct)) if (*Char(destruct))
Printv(proxy_class_def, "\n ", destruct_methodmodifiers, " ", derived ? "override" : "virtual", " void ", destruct_methodname, "() ", destruct, "\n", Printv(proxy_class_def, "\n ", destruct_methodmodifiers, " ", derived ? "override" : "virtual", " void ", destruct_methodname, "() ", destruct, "\n",
NIL); NIL);
@ -1732,9 +1732,9 @@ public:
if (first_class_dmethod < curr_class_dmethod) { if (first_class_dmethod < curr_class_dmethod) {
// Only emit if there is at least one director method // Only emit if there is at least one director method
Printf(proxy_class_code, "\n"); Printf(proxy_class_code, "\n");
Printf(proxy_class_code, " private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes) {\n"); Printf(proxy_class_code, " private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) {\n");
Printf(proxy_class_code, Printf(proxy_class_code,
" System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, methodTypes, null);\n"); " global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, methodTypes, null);\n");
Printf(proxy_class_code, " bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(%s));\n", proxy_class_name); Printf(proxy_class_code, " bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(%s));\n", proxy_class_name);
/* Could add this code to cover corner case where the GetMethod() returns a method which allows type /* Could add this code to cover corner case where the GetMethod() returns a method which allows type
* promotion, eg it will return foo(double), if looking for foo(int). * promotion, eg it will return foo(double), if looking for foo(int).
@ -1798,8 +1798,8 @@ public:
String *upcast_method = Swig_name_member(getNSpace(), proxy_class_name, smartptr != 0 ? "SWIGSmartPtrUpcast" : "SWIGUpcast"); String *upcast_method = Swig_name_member(getNSpace(), proxy_class_name, smartptr != 0 ? "SWIGSmartPtrUpcast" : "SWIGUpcast");
String *wname = Swig_name_wrapper(upcast_method); String *wname = Swig_name_wrapper(upcast_method);
Printv(imclass_cppcasts_code, "\n [DllImport(\"", dllimport, "\", EntryPoint=\"", wname, "\")]\n", NIL); Printv(imclass_cppcasts_code, "\n [global::System.Runtime.InteropServices.DllImport(\"", dllimport, "\", EntryPoint=\"", wname, "\")]\n", NIL);
Printf(imclass_cppcasts_code, " public static extern IntPtr %s(IntPtr jarg1);\n", upcast_method); Printf(imclass_cppcasts_code, " public static extern global::System.IntPtr %s(global::System.IntPtr jarg1);\n", upcast_method);
Replaceall(imclass_cppcasts_code, "$csclassname", proxy_class_name); Replaceall(imclass_cppcasts_code, "$csclassname", proxy_class_name);
@ -3387,8 +3387,8 @@ public:
if (nspace) if (nspace)
Insert(qualified_classname, 0, NewStringf("%s.", nspace)); Insert(qualified_classname, 0, NewStringf("%s.", nspace));
Printv(imclass_class_code, "\n [DllImport(\"", dllimport, "\", EntryPoint=\"", wname, "\")]\n", NIL); Printv(imclass_class_code, "\n [global::System.Runtime.InteropServices.DllImport(\"", dllimport, "\", EntryPoint=\"", wname, "\")]\n", NIL);
Printf(imclass_class_code, " public static extern void %s(HandleRef jarg1", swig_director_connect); Printf(imclass_class_code, " public static extern void %s(global::System.Runtime.InteropServices.HandleRef jarg1", swig_director_connect);
Wrapper *code_wrap = NewWrapper(); Wrapper *code_wrap = NewWrapper();
Printf(code_wrap->def, "SWIGEXPORT void SWIGSTDCALL %s(void *objarg", wname); Printf(code_wrap->def, "SWIGEXPORT void SWIGSTDCALL %s(void *objarg", wname);
@ -3917,7 +3917,7 @@ public:
Printf(director_delegate_definitions, " SwigDelegate%s_%s(%s);\n", classname, methid, delegate_parms); Printf(director_delegate_definitions, " SwigDelegate%s_%s(%s);\n", classname, methid, delegate_parms);
Printf(director_delegate_instances, " private SwigDelegate%s_%s swigDelegate%s;\n", classname, methid, methid); Printf(director_delegate_instances, " private SwigDelegate%s_%s swigDelegate%s;\n", classname, methid, methid);
Printf(director_method_types, " private static Type[] swigMethodTypes%s = new Type[] { %s };\n", methid, proxy_method_types); Printf(director_method_types, " private static global::System.Type[] swigMethodTypes%s = new global::System.Type[] { %s };\n", methid, proxy_method_types);
Printf(director_connect_parms, "SwigDirector%s%s delegate%s", classname, methid, methid); Printf(director_connect_parms, "SwigDirector%s%s delegate%s", classname, methid, methid);
} }