Skip to content
Browse files

Since SWIG 3.0 removes support for .NET 1.1, cleanup the C# library b…

…y removing the use of the SWIG_DOTNET_1 macro.
  • Loading branch information...
1 parent 3235570 commit cb2df12630874dd9b11fac8805e3169691305ee0 @BrantKyser BrantKyser committed Oct 17, 2013
Showing with 3 additions and 41 deletions.
  1. +0 −13 Examples/test-suite/csharp/li_std_vector_runme.cs
  2. +2 −7 Lib/csharp/std_map.i
  3. +1 −21 Lib/csharp/std_vector.i
View
13 Examples/test-suite/csharp/li_std_vector_runme.cs
@@ -82,17 +82,6 @@ public class li_std_vector_runme {
} 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();
int arrayLen = 10;
@@ -208,15 +197,13 @@ public class li_std_vector_runme {
throw new Exception("Repeat (1) test failed");
}
}
-#if !SWIG_DOTNET_1
{
System.Collections.Generic.IEnumerator<double> myEnumerator = dv.GetEnumerator();
while ( myEnumerator.MoveNext() ) {
if (myEnumerator.Current != 77.7)
throw new Exception("Repeat (2) test failed");
}
}
-#endif
}
{
View
9 Lib/csharp/std_map.i
@@ -11,9 +11,7 @@
* %template(MapIntDouble) std::map<int, double>
*
* Notes:
- * 1) For .NET 1 compatibility, define SWIG_DOTNET_1 when compiling the C# code. In this case
- * the C# wrapper has only basic functionality.
- * 2) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
+ * 1) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
* C++ std::map wrappers.
*
* 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 */
%define SWIG_STD_MAP_INTERNAL(K, T, C)
-%typemap(csinterfaces) std::map< K, T, C > "IDisposable \n#if !SWIG_DOTNET_1\n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n#endif\n";
+%typemap(csinterfaces) std::map< K, T, C > "IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n";
%typemap(cscode) std::map<K, T, C > %{
public $typemap(cstype, T) this[$typemap(cstype, K) key] {
@@ -62,8 +60,6 @@
}
}
-#if !SWIG_DOTNET_1
-
public global::System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys {
get {
global::System.Collections.Generic.ICollection<$typemap(cstype, K)> keys = new global::System.Collections.Generic.List<$typemap(cstype, K)>();
@@ -210,7 +206,6 @@
currentObject = null;
}
}
-#endif
%}
View
22 Lib/csharp/std_vector.i
@@ -4,8 +4,6 @@
* SWIG typemaps for std::vector<T>
* C# implementation
* 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
* C++ std::vector wrappers. The IList<> interface is also implemented to provide enhanced functionality
@@ -26,7 +24,7 @@
// MACRO for use within the std::vector class body
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...)
-%typemap(csinterfaces) std::vector< CTYPE > "IDisposable, global::System.Collections.IEnumerable\n#if !SWIG_DOTNET_1\n , global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n#endif\n";
+%typemap(csinterfaces) std::vector< CTYPE > "IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n";
%typemap(cscode) std::vector< CTYPE > %{
public $csclassname(global::System.Collections.ICollection c) : this() {
if (c == null)
@@ -80,29 +78,17 @@
}
}
-#if SWIG_DOTNET_1
- public void CopyTo(global::System.Array array)
-#else
public void CopyTo($typemap(cstype, CTYPE)[] array)
-#endif
{
CopyTo(0, array, 0, this.Count);
}
-#if SWIG_DOTNET_1
- public void CopyTo(global::System.Array array, int arrayIndex)
-#else
public void CopyTo($typemap(cstype, CTYPE)[] array, int arrayIndex)
-#endif
{
CopyTo(0, array, arrayIndex, this.Count);
}
-#if SWIG_DOTNET_1
- public void CopyTo(int index, global::System.Array array, int arrayIndex, int count)
-#else
public void CopyTo(int index, $typemap(cstype, CTYPE)[] array, int arrayIndex, int count)
-#endif
{
if (array == null)
throw new ArgumentNullException("array");
@@ -120,11 +106,9 @@
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() {
return new $csclassnameEnumerator(this);
}
-#endif
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
return new $csclassnameEnumerator(this);
@@ -140,9 +124,7 @@
/// 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.
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator
-#if !SWIG_DOTNET_1
, global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
-#endif
{
private $csclassname collectionRef;
private int currentIndex;
@@ -196,12 +178,10 @@
}
}
-#if !SWIG_DOTNET_1
public void Dispose() {
currentIndex = -1;
currentObject = null;
}
-#endif
}
%}

0 comments on commit cb2df12

Please sign in to comment.
Something went wrong with that request. Please try again.