shared_ptr improvements so the proxy class does not need to be specified - SWIG_SHARED_PTR macro deprecated and replaced by %shared_ptr

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12037 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-05-22 23:57:19 +00:00
commit 3dfac02269
11 changed files with 117 additions and 75 deletions

View file

@ -44,18 +44,39 @@ struct SWIG_null_deleter {
%#define SWIG_NO_NULL_DELETER_1
}
// Workaround empty first macro argument bug
#define SWIGEMPTYHACK
// Main user macro for defining intrusive_ptr typemaps for both const and non-const pointer types
%define %intrusive_ptr(TYPE...)
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
SWIG_INTRUSIVE_PTR_TYPEMAPS(SWIGEMPTYHACK, TYPE)
SWIG_INTRUSIVE_PTR_TYPEMAPS(const, TYPE)
%enddef
%define %intrusive_ptr_no_wrap(TYPE...)
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(SWIGEMPTYHACK, TYPE)
SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(const, TYPE)
%enddef
// Legacy macros
%define SWIG_INTRUSIVE_PTR(PROXYCLASS, TYPE...)
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
SWIG_INTRUSIVE_PTR_TYPEMAPS(PROXYCLASS, , TYPE)
SWIG_INTRUSIVE_PTR_TYPEMAPS(PROXYCLASS, const, TYPE)
#warning "SWIG_INTRUSIVE_PTR(PROXYCLASS, TYPE) is deprecated. Please use %intrusive_ptr(TYPE) instead."
%intrusive_ptr(TYPE)
%enddef
%define SWIG_INTRUSIVE_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE...)
#warning "SWIG_INTRUSIVE_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE) is deprecated. Please use %intrusive_ptr(TYPE) instead."
%intrusive_ptr(TYPE)
%enddef
// Extra user macro for including classes in intrusive_ptr typemaps for both const and non-const pointer types
// This caters for classes which cannot be wrapped by intrusive_ptrs but are still part of the class hierarchy
%define SWIG_INTRUSIVE_PTR_NO_WRAP(PROXYCLASS, TYPE...)
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > }
SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(PROXYCLASS, , TYPE)
SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(PROXYCLASS, const, TYPE)
#warning "SWIG_INTRUSIVE_PTR_NO_WRAP(PROXYCLASS, TYPE) is deprecated. Please use %intrusive_ptr_no_wrap(TYPE) instead."
%intrusive_ptr_no_wrap(TYPE)
%enddef
%define SWIG_INTRUSIVE_PTR_DERIVED_NO_WRAP(PROXYCLASS, BASECLASSTYPE, TYPE...)
#warning "SWIG_INTRUSIVE_PTR_DERIVED_NO_WRAP(PROXYCLASS, BASECLASSTYPE, TYPE) is deprecated. Please use %intrusive_ptr_no_wrap(TYPE) instead."
%intrusive_ptr_no_wrap(TYPE)
%enddef