mirror of https://github.com/swig/swig
Since SWIG 3.0 removes support for .NET 1.1, cleanup the C# library by removing the use of the SWIG_DOTNET_1 macro.
This commit is contained in:
parent
3235570619
commit
cb2df12630
|
@ -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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 , 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 > %{
|
%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,8 +60,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !SWIG_DOTNET_1
|
|
||||||
|
|
||||||
public global::System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys {
|
public global::System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys {
|
||||||
get {
|
get {
|
||||||
global::System.Collections.Generic.ICollection<$typemap(cstype, K)> keys = new global::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)>();
|
||||||
|
@ -210,7 +206,6 @@
|
||||||
currentObject = null;
|
currentObject = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
|
@ -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,7 +24,7 @@
|
||||||
|
|
||||||
// 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, 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 > %{
|
%typemap(cscode) std::vector< CTYPE > %{
|
||||||
public $csclassname(global::System.Collections.ICollection c) : this() {
|
public $csclassname(global::System.Collections.ICollection c) : this() {
|
||||||
if (c == null)
|
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)
|
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(global::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, global::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 ArgumentNullException("array");
|
||||||
|
@ -120,11 +106,9 @@
|
||||||
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() {
|
global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() {
|
||||||
return new $csclassnameEnumerator(this);
|
return new $csclassnameEnumerator(this);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
|
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
|
||||||
return new $csclassnameEnumerator(this);
|
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
|
/// 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 : global::System.Collections.IEnumerator
|
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator
|
||||||
#if !SWIG_DOTNET_1
|
|
||||||
, global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
|
, global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
private $csclassname collectionRef;
|
private $csclassname collectionRef;
|
||||||
private int currentIndex;
|
private int currentIndex;
|
||||||
|
@ -196,12 +178,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !SWIG_DOTNET_1
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
currentIndex = -1;
|
currentIndex = -1;
|
||||||
currentObject = null;
|
currentObject = null;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue