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_ATTRIBUTES_DWA2002615_HPP
6 # define OBJECT_ATTRIBUTES_DWA2002615_HPP
8 # include <boost/python/detail/prefix.hpp>
10 # include <boost/python/proxy.hpp>
11 # include <boost/python/object_core.hpp>
12 # include <boost/python/object_protocol.hpp>
14 namespace boost { namespace python { namespace api {
16 struct const_attribute_policies
18 typedef char const* key_type;
19 static object get(object const& target, char const* key);
22 struct attribute_policies : const_attribute_policies
24 static object const& set(object const& target, char const* key, object const& value);
25 static void del(object const&target, char const* key);
32 inline object_attribute object_operators<U>::attr(char const* name)
34 object_cref2 x = *static_cast<U*>(this);
35 return object_attribute(x, name);
39 inline const_object_attribute object_operators<U>::attr(char const* name) const
41 object_cref2 x = *static_cast<U const*>(this);
42 return const_object_attribute(x, name);
45 inline object const_attribute_policies::get(object const& target, char const* key)
47 return python::getattr(target, key);
50 inline object const& attribute_policies::set(
53 , object const& value)
55 python::setattr(target, key, value);
59 inline void attribute_policies::del(
63 python::delattr(target, key);
66 }}} // namespace boost::python::api
68 #endif // OBJECT_ATTRIBUTES_DWA2002615_HPP