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