Mercurial > mm7
diff lib/swig/swigwin-2.0.11/Lib/std/std_pair.i @ 1899:b3009adc0e2f
Adding swig, gitignore, hgignore
author | Nomad |
---|---|
date | Mon, 21 Oct 2013 10:42:27 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/swig/swigwin-2.0.11/Lib/std/std_pair.i Mon Oct 21 10:42:27 2013 +0200 @@ -0,0 +1,163 @@ +%include <std_common.i> + +%{ +#include <utility> +%} + + +namespace std { + template <class T, class U > struct pair { + typedef T first_type; + typedef U second_type; + + %traits_swigtype(T); + %traits_swigtype(U); + + %fragment(SWIG_Traits_frag(std::pair<T,U >), "header", + fragment=SWIG_Traits_frag(T), + fragment=SWIG_Traits_frag(U), + fragment="StdPairTraits") { + namespace swig { + template <> struct traits<std::pair<T,U > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" #T "," #U " >"; + } + }; + } + } + +#ifndef SWIG_STD_PAIR_ASVAL + %typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair<T,U >); +#else + %typemap_traits(SWIG_TYPECHECK_PAIR, std::pair<T,U >); +#endif + + pair(); + pair(T first, U second); + pair(const pair& p); + + template <class U1, class U2> pair(const pair<U1, U2> &p); + + T first; + U second; + +#ifdef %swig_pair_methods + // Add swig/language extra methods + %swig_pair_methods(std::pair<T,U >) +#endif + }; + + // *** + // The following specializations should disappear or get + // simplified when a 'const SWIGTYPE*&' can be defined + // *** + template <class T, class U > struct pair<T, U*> { + typedef T first_type; + typedef U* second_type; + + %traits_swigtype(T); + %traits_swigtype(U); + + %fragment(SWIG_Traits_frag(std::pair<T,U* >), "header", + fragment=SWIG_Traits_frag(T), + fragment=SWIG_Traits_frag(U), + fragment="StdPairTraits") { + namespace swig { + template <> struct traits<std::pair<T,U* > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" #T "," #U " * >"; + } + }; + } + } + + %typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair<T,U* >); + + pair(); + pair(T __a, U* __b); + pair(const pair& __p); + + T first; + U* second; + +#ifdef %swig_pair_methods + // Add swig/language extra methods + %swig_pair_methods(std::pair<T,U*>) +#endif + }; + + template <class T, class U > struct pair<T*, U> { + typedef T* first_type; + typedef U second_type; + + %traits_swigtype(T); + %traits_swigtype(U); + + %fragment(SWIG_Traits_frag(std::pair<T*,U >), "header", + fragment=SWIG_Traits_frag(T), + fragment=SWIG_Traits_frag(U), + fragment="StdPairTraits") { + namespace swig { + template <> struct traits<std::pair<T*,U > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" #T " *," #U " >"; + } + }; + } + } + + %typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair<T*,U >); + + pair(); + pair(T* __a, U __b); + pair(const pair& __p); + + T* first; + U second; + +#ifdef %swig_pair_methods + // Add swig/language extra methods + %swig_pair_methods(std::pair<T*,U >) +#endif + }; + + template <class T, class U > struct pair<T*, U*> { + typedef T* first_type; + typedef U* second_type; + + %traits_swigtype(T); + %traits_swigtype(U); + + %fragment(SWIG_Traits_frag(std::pair<T*,U* >), "header", + fragment=SWIG_Traits_frag(T), + fragment=SWIG_Traits_frag(U), + fragment="StdPairTraits") { + namespace swig { + template <> struct traits<std::pair<T*,U* > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" #T " *," #U " * >"; + } + }; + } + } + + %typemap_traits(SWIG_TYPECHECK_PAIR, std::pair<T*,U* >); + + pair(); + pair(T* __a, U* __b); + pair(const pair& __p); + + T* first; + U* second; + +#ifdef %swig_pair_methods + // Add swig/language extra methods + %swig_pair_methods(std::pair<T*,U*>) +#endif + }; + +}