|
14 | 14 | using boost::python::wrap; |
15 | 15 | using boost::python::unwrap; |
16 | 16 |
|
17 | | -extern "C" |
| 17 | +// Get a simple (by value) from the argument, and return the |
| 18 | +// string it holds. |
| 19 | +PyObject* unwrap_simple(simple x) |
18 | 20 | { |
19 | | - // Get a simple (by value) from the argument, and return the |
20 | | - // string it holds. |
21 | | - PyObject* unwrap_simple(simple x) |
22 | | - { |
23 | | - return PyString_FromString(x.s); |
24 | | - } |
25 | | - |
26 | | - // Likewise, but demands that its possible to get a non-const |
27 | | - // reference to the simple. |
28 | | - PyObject* unwrap_simple_ref(simple& x) |
29 | | - { |
30 | | - return PyString_FromString(x.s); |
31 | | - } |
| 21 | + return PyString_FromString(x.s); |
| 22 | +} |
32 | 23 |
|
33 | | - // Likewise, with a const reference to the simple object. |
34 | | - PyObject* unwrap_simple_const_ref(simple const& x) |
35 | | - { |
36 | | - return PyString_FromString(x.s); |
37 | | - } |
| 24 | +// Likewise, but demands that its possible to get a non-const |
| 25 | +// reference to the simple. |
| 26 | +PyObject* unwrap_simple_ref(simple& x) |
| 27 | +{ |
| 28 | + return PyString_FromString(x.s); |
| 29 | +} |
38 | 30 |
|
39 | | - // Get an int (by value) from the argument, and convert it to a |
40 | | - // Python Int. |
41 | | - PyObject* unwrap_int(int x) |
42 | | - { |
43 | | - return PyInt_FromLong(x); |
44 | | - } |
| 31 | +// Likewise, with a const reference to the simple object. |
| 32 | +PyObject* unwrap_simple_const_ref(simple const& x) |
| 33 | +{ |
| 34 | + return PyString_FromString(x.s); |
| 35 | +} |
45 | 36 |
|
46 | | - // Get a non-const reference to an int from the argument |
47 | | - PyObject* unwrap_int_ref(int& x) |
48 | | - { |
49 | | - return PyInt_FromLong(x); |
50 | | - } |
| 37 | +// Get an int (by value) from the argument, and convert it to a |
| 38 | +// Python Int. |
| 39 | +PyObject* unwrap_int(int x) |
| 40 | +{ |
| 41 | + return PyInt_FromLong(x); |
| 42 | +} |
51 | 43 |
|
52 | | - // Get a const reference to an int from the argument. |
53 | | - PyObject* unwrap_int_const_ref(int const& x) |
54 | | - { |
55 | | - return PyInt_FromLong(x); |
56 | | - } |
| 44 | +// Get a non-const reference to an int from the argument |
| 45 | +PyObject* unwrap_int_ref(int& x) |
| 46 | +{ |
| 47 | + return PyInt_FromLong(x); |
| 48 | +} |
57 | 49 |
|
58 | | - // ------------------- |
| 50 | +// Get a const reference to an int from the argument. |
| 51 | +PyObject* unwrap_int_const_ref(int const& x) |
| 52 | +{ |
| 53 | + return PyInt_FromLong(x); |
59 | 54 | } |
60 | 55 |
|
61 | 56 | // MSVC6 bug workaround |
|
0 commit comments