diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2009-05-11 17:46:51 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2009-05-11 17:46:51 +0000 |
commit | 13cbd90553f4bb4254c677ff05078b2bc49e8fca (patch) | |
tree | 7f5a01b386e851a5c90e1dc38a45eb4490eaee64 /Lib/csharp/std_vector.i | |
parent | 2b5560d267ec6743fbd32c9062e0a9f758ce19cd (diff) | |
download | swig-13cbd90553f4bb4254c677ff05078b2bc49e8fca.tar.gz |
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
Diffstat (limited to 'Lib/csharp/std_vector.i')
-rw-r--r-- | Lib/csharp/std_vector.i | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/csharp/std_vector.i b/Lib/csharp/std_vector.i index f4ad88bae..07a24dfd6 100644 --- a/Lib/csharp/std_vector.i +++ b/Lib/csharp/std_vector.i @@ -19,7 +19,8 @@ * %template(VectKlass) std::vector<SomeNamespace::Klass>; * * 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! * ----------------------------------------------------------------------------- */ @@ -31,8 +32,8 @@ // MACRO for use within the std::vector class body // 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...) -%typemap(csinterfaces) std::vector<CTYPE > "IDisposable, System.Collections.IEnumerable\n#if !SWIG_DOTNET_1\n , System.Collections.Generic.IEnumerable<CSTYPE>\n#endif\n"; +%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.CSINTERFACE<CSTYPE>\n#endif\n"; %typemap(cscode) std::vector<CTYPE > %{ public $csclassname(System.Collections.ICollection c) : this() { if (c == null) @@ -325,10 +326,9 @@ %enddef %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 - // 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 // 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...) namespace std { 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) }; } @@ -409,7 +409,7 @@ namespace std { }; // bool is a bit different in the C++ standard 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) }; } |