Update contrib.
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
8 # include <boost/python/detail/prefix.hpp>
10 # include <boost/python/object_protocol_core.hpp>
11 # include <boost/python/object_core.hpp>
13 namespace boost { namespace python { namespace api {
15 template <class Target, class Key>
16 object getattr(Target const& target, Key const& key)
18 return getattr(object(target), object(key));
21 template <class Target, class Key, class Default>
22 object getattr(Target const& target, Key const& key, Default const& default_)
24 return getattr(object(target), object(key), object(default_));
28 template <class Key, class Value>
29 void setattr(object const& target, Key const& key, Value const& value)
31 setattr(target, object(key), object(value));
35 void delattr(object const& target, Key const& key)
37 delattr(target, object(key));
40 template <class Target, class Key>
41 object getitem(Target const& target, Key const& key)
43 return getitem(object(target), object(key));
47 template <class Key, class Value>
48 void setitem(object const& target, Key const& key, Value const& value)
50 setitem(target, object(key), object(value));
54 void delitem(object const& target, Key const& key)
56 delitem(target, object(key));
59 template <class Target, class Begin, class End>
60 object getslice(Target const& target, Begin const& begin, End const& end)
62 return getslice(object(target), object(begin), object(end));
65 template <class Begin, class End, class Value>
66 void setslice(object const& target, Begin const& begin, End const& end, Value const& value)
68 setslice(target, object(begin), object(end), object(value));
71 template <class Begin, class End>
72 void delslice(object const& target, Begin const& begin, End const& end)
74 delslice(target, object(begin), object(end));
77 }}} // namespace boost::python::api
79 #endif // OBJECT_PROTOCOL_DWA2002615_HPP