Mercurial > mm7
comparison lib/swig/swigwin-2.0.11/Lib/shared_ptr.i @ 1899:b3009adc0e2f
Adding swig, gitignore, hgignore
author | Nomad |
---|---|
date | Mon, 21 Oct 2013 10:42:27 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1867:eb580660bbbb | 1899:b3009adc0e2f |
---|---|
1 // This is a helper file for shared_ptr and should not be included directly. | |
2 | |
3 // The main implementation detail in using this smart pointer of a type is to customise the code generated | |
4 // to use a pointer to the smart pointer of the type, rather than the usual pointer to the underlying type. | |
5 // So for some type T, shared_ptr<T> * is used rather than T *. | |
6 | |
7 // shared_ptr namespaces could be boost or std or std::tr1 | |
8 // For example for std::tr1, use: | |
9 // #define SWIG_SHARED_PTR_NAMESPACE std | |
10 // #define SWIG_SHARED_PTR_SUBNAMESPACE tr1 | |
11 | |
12 #if !defined(SWIG_SHARED_PTR_NAMESPACE) | |
13 # define SWIG_SHARED_PTR_NAMESPACE boost | |
14 #endif | |
15 | |
16 #if defined(SWIG_SHARED_PTR_SUBNAMESPACE) | |
17 # define SWIG_SHARED_PTR_QNAMESPACE SWIG_SHARED_PTR_NAMESPACE::SWIG_SHARED_PTR_SUBNAMESPACE | |
18 #else | |
19 # define SWIG_SHARED_PTR_QNAMESPACE SWIG_SHARED_PTR_NAMESPACE | |
20 #endif | |
21 | |
22 namespace SWIG_SHARED_PTR_NAMESPACE { | |
23 #if defined(SWIG_SHARED_PTR_SUBNAMESPACE) | |
24 namespace SWIG_SHARED_PTR_SUBNAMESPACE { | |
25 #endif | |
26 template <class T> class shared_ptr { | |
27 }; | |
28 #if defined(SWIG_SHARED_PTR_SUBNAMESPACE) | |
29 } | |
30 #endif | |
31 } | |
32 | |
33 %fragment("SWIG_null_deleter", "header") { | |
34 struct SWIG_null_deleter { | |
35 void operator() (void const *) const { | |
36 } | |
37 }; | |
38 %#define SWIG_NO_NULL_DELETER_0 , SWIG_null_deleter() | |
39 %#define SWIG_NO_NULL_DELETER_1 | |
40 %#define SWIG_NO_NULL_DELETER_SWIG_POINTER_NEW | |
41 %#define SWIG_NO_NULL_DELETER_SWIG_POINTER_OWN | |
42 } | |
43 | |
44 | |
45 // Workaround empty first macro argument bug | |
46 #define SWIGEMPTYHACK | |
47 // Main user macro for defining shared_ptr typemaps for both const and non-const pointer types | |
48 %define %shared_ptr(TYPE...) | |
49 %feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > } | |
50 SWIG_SHARED_PTR_TYPEMAPS(SWIGEMPTYHACK, TYPE) | |
51 SWIG_SHARED_PTR_TYPEMAPS(const, TYPE) | |
52 %enddef | |
53 | |
54 // Legacy macros | |
55 %define SWIG_SHARED_PTR(PROXYCLASS, TYPE...) | |
56 #warning "SWIG_SHARED_PTR(PROXYCLASS, TYPE) is deprecated. Please use %shared_ptr(TYPE) instead." | |
57 %shared_ptr(TYPE) | |
58 %enddef | |
59 | |
60 %define SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE...) | |
61 #warning "SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE) is deprecated. Please use %shared_ptr(TYPE) instead." | |
62 %shared_ptr(TYPE) | |
63 %enddef | |
64 |