1 | // Copyright David Abrahams 2002.
|
---|
2 | // Distributed under the Boost Software License, Version 1.0. (See
|
---|
3 | // accompanying file LICENSE_1_0.txt or copy at
|
---|
4 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
5 | #ifndef OBJECT_PROTOCOL_DWA2002615_HPP
|
---|
6 | # define OBJECT_PROTOCOL_DWA2002615_HPP
|
---|
7 |
|
---|
8 | # include <boost/python/detail/prefix.hpp>
|
---|
9 |
|
---|
10 | # include <boost/python/object_protocol_core.hpp>
|
---|
11 | # include <boost/python/object_core.hpp>
|
---|
12 |
|
---|
13 | namespace boost { namespace python { namespace api {
|
---|
14 |
|
---|
15 | template <class Target, class Key>
|
---|
16 | object getattr(Target const& target, Key const& key)
|
---|
17 | {
|
---|
18 | return getattr(object(target), object(key));
|
---|
19 | }
|
---|
20 |
|
---|
21 | template <class Target, class Key, class Default>
|
---|
22 | object getattr(Target const& target, Key const& key, Default const& default_)
|
---|
23 | {
|
---|
24 | return getattr(object(target), object(key), object(default_));
|
---|
25 | }
|
---|
26 |
|
---|
27 |
|
---|
28 | template <class Key, class Value>
|
---|
29 | void setattr(object const& target, Key const& key, Value const& value)
|
---|
30 | {
|
---|
31 | setattr(target, object(key), object(value));
|
---|
32 | }
|
---|
33 |
|
---|
34 | template <class Key>
|
---|
35 | void delattr(object const& target, Key const& key)
|
---|
36 | {
|
---|
37 | delattr(target, object(key));
|
---|
38 | }
|
---|
39 |
|
---|
40 | template <class Target, class Key>
|
---|
41 | object getitem(Target const& target, Key const& key)
|
---|
42 | {
|
---|
43 | return getitem(object(target), object(key));
|
---|
44 | }
|
---|
45 |
|
---|
46 |
|
---|
47 | template <class Key, class Value>
|
---|
48 | void setitem(object const& target, Key const& key, Value const& value)
|
---|
49 | {
|
---|
50 | setitem(target, object(key), object(value));
|
---|
51 | }
|
---|
52 |
|
---|
53 | template <class Key>
|
---|
54 | void delitem(object const& target, Key const& key)
|
---|
55 | {
|
---|
56 | delitem(target, object(key));
|
---|
57 | }
|
---|
58 |
|
---|
59 | template <class Target, class Begin, class End>
|
---|
60 | object getslice(Target const& target, Begin const& begin, End const& end)
|
---|
61 | {
|
---|
62 | return getslice(object(target), object(begin), object(end));
|
---|
63 | }
|
---|
64 |
|
---|
65 | template <class Begin, class End, class Value>
|
---|
66 | void setslice(object const& target, Begin const& begin, End const& end, Value const& value)
|
---|
67 | {
|
---|
68 | setslice(target, object(begin), object(end), object(value));
|
---|
69 | }
|
---|
70 |
|
---|
71 | template <class Begin, class End>
|
---|
72 | void delslice(object const& target, Begin const& begin, End const& end)
|
---|
73 | {
|
---|
74 | delslice(target, object(begin), object(end));
|
---|
75 | }
|
---|
76 |
|
---|
77 | }}} // namespace boost::python::api
|
---|
78 |
|
---|
79 | #endif // OBJECT_PROTOCOL_DWA2002615_HPP
|
---|