Improved std::vector wrappers on the C# proxy side from Yuval Baror to implement IList<> instead of IEnumerable<> where possible.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11209 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
2b5560d267
commit
13cbd90553
2 changed files with 11 additions and 7 deletions
|
|
@ -1,6 +1,10 @@
|
||||||
Version 1.3.40 (in progress)
|
Version 1.3.40 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
2009-05-11: wsfulton
|
||||||
|
[C#] Improved std::vector wrappers on the C# proxy side from Yuval Baror. These
|
||||||
|
implement IList<> instead of IEnumerable<> where possible.
|
||||||
|
|
||||||
2009-04-29: wsfulton
|
2009-04-29: wsfulton
|
||||||
[Java, C#] Add the 'notderived' attribute to the javabase and csbase typemaps.
|
[Java, C#] Add the 'notderived' attribute to the javabase and csbase typemaps.
|
||||||
When this attribute is set, the typemap will not apply to classes that are derived
|
When this attribute is set, the typemap will not apply to classes that are derived
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,8 @@
|
||||||
* %template(VectKlass) std::vector<SomeNamespace::Klass>;
|
* %template(VectKlass) std::vector<SomeNamespace::Klass>;
|
||||||
*
|
*
|
||||||
* 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.
|
* C++ std::vector wrappers. IEnumerable<> is replaced by IList<> wherever we are confident that the
|
||||||
|
* required C++ operator== is available for correct compilation.
|
||||||
*
|
*
|
||||||
* 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!
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
@ -31,8 +32,8 @@
|
||||||
|
|
||||||
// MACRO for use within the std::vector class body
|
// MACRO for use within the std::vector class body
|
||||||
// CSTYPE and CTYPE respectively correspond to the types in the cstype and ctype typemaps
|
// CSTYPE and CTYPE respectively correspond to the types in the cstype and ctype typemaps
|
||||||
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CONST_REFERENCE_TYPE, CSTYPE, CTYPE...)
|
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE_TYPE, CSTYPE, CTYPE...)
|
||||||
%typemap(csinterfaces) std::vector<CTYPE > "IDisposable, System.Collections.IEnumerable\n#if !SWIG_DOTNET_1\n , System.Collections.Generic.IEnumerable<CSTYPE>\n#endif\n";
|
%typemap(csinterfaces) std::vector<CTYPE > "IDisposable, System.Collections.IEnumerable\n#if !SWIG_DOTNET_1\n , System.Collections.Generic.CSINTERFACE<CSTYPE>\n#endif\n";
|
||||||
%typemap(cscode) std::vector<CTYPE > %{
|
%typemap(cscode) std::vector<CTYPE > %{
|
||||||
public $csclassname(System.Collections.ICollection c) : this() {
|
public $csclassname(System.Collections.ICollection c) : this() {
|
||||||
if (c == null)
|
if (c == null)
|
||||||
|
|
@ -325,10 +326,9 @@
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
%define SWIG_STD_VECTOR_MINIMUM(CSTYPE, CTYPE...)
|
%define SWIG_STD_VECTOR_MINIMUM(CSTYPE, CTYPE...)
|
||||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(const value_type&, CSTYPE, CTYPE)
|
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, const value_type&, CSTYPE, CTYPE)
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
||||||
// Extra methods added to the collection class if operator== is defined for the class being wrapped
|
// Extra methods added to the collection class if operator== is defined for the class being wrapped
|
||||||
// CSTYPE and CTYPE respectively correspond to the types in the cstype and ctype typemaps
|
// CSTYPE and CTYPE respectively correspond to the types in the cstype and ctype typemaps
|
||||||
// The class will then implement IList<>, which adds extra functionality
|
// The class will then implement IList<>, which adds extra functionality
|
||||||
|
|
@ -367,7 +367,7 @@ SWIG_STD_VECTOR_MINIMUM_INTERNAL(const value_type&, CSTYPE, CTYPE)
|
||||||
%define SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE...)
|
%define SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE...)
|
||||||
namespace std {
|
namespace std {
|
||||||
template<> class vector<CTYPE > {
|
template<> class vector<CTYPE > {
|
||||||
SWIG_STD_VECTOR_MINIMUM(CSTYPE, CTYPE)
|
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, CSTYPE, CTYPE)
|
||||||
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CSTYPE, CTYPE)
|
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CSTYPE, CTYPE)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -409,7 +409,7 @@ namespace std {
|
||||||
};
|
};
|
||||||
// bool is a bit different in the C++ standard
|
// bool is a bit different in the C++ standard
|
||||||
template<> class vector<bool> {
|
template<> class vector<bool> {
|
||||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(bool, bool, bool)
|
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, bool, bool, bool)
|
||||||
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(bool, bool)
|
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(bool, bool)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue