os/ossrv/ossrv_pub/boost_apis/boost/python/object_protocol.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/python/object_protocol.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,79 @@
     1.4 +// Copyright David Abrahams 2002.
     1.5 +// Distributed under the Boost Software License, Version 1.0. (See
     1.6 +// accompanying file LICENSE_1_0.txt or copy at
     1.7 +// http://www.boost.org/LICENSE_1_0.txt)
     1.8 +#ifndef OBJECT_PROTOCOL_DWA2002615_HPP
     1.9 +# define OBJECT_PROTOCOL_DWA2002615_HPP
    1.10 +
    1.11 +# include <boost/python/detail/prefix.hpp>
    1.12 +
    1.13 +# include <boost/python/object_protocol_core.hpp>
    1.14 +# include <boost/python/object_core.hpp>
    1.15 +
    1.16 +namespace boost { namespace python { namespace api {
    1.17 +
    1.18 +template <class Target, class Key>
    1.19 +object getattr(Target const& target, Key const& key)
    1.20 +{
    1.21 +    return getattr(object(target), object(key));
    1.22 +}
    1.23 +
    1.24 +template <class Target, class Key, class Default>
    1.25 +object getattr(Target const& target, Key const& key, Default const& default_)
    1.26 +{
    1.27 +    return getattr(object(target), object(key), object(default_));
    1.28 +}
    1.29 +
    1.30 +
    1.31 +template <class Key, class Value>
    1.32 +void setattr(object const& target, Key const& key, Value const& value)
    1.33 +{
    1.34 +    setattr(target, object(key), object(value));
    1.35 +}
    1.36 +
    1.37 +template <class Key>
    1.38 +void delattr(object const& target, Key const& key)
    1.39 +{
    1.40 +    delattr(target, object(key));
    1.41 +}
    1.42 +
    1.43 +template <class Target, class Key>
    1.44 +object getitem(Target const& target, Key const& key)
    1.45 +{
    1.46 +    return getitem(object(target), object(key));
    1.47 +}
    1.48 +
    1.49 +
    1.50 +template <class Key, class Value>
    1.51 +void setitem(object const& target, Key const& key, Value const& value)
    1.52 +{
    1.53 +    setitem(target, object(key), object(value));
    1.54 +}
    1.55 +
    1.56 +template <class Key>
    1.57 +void delitem(object const& target, Key const& key)
    1.58 +{
    1.59 +    delitem(target, object(key));
    1.60 +}
    1.61 +
    1.62 +template <class Target, class Begin, class End>
    1.63 +object getslice(Target const& target, Begin const& begin, End const& end)
    1.64 +{
    1.65 +    return getslice(object(target), object(begin), object(end));
    1.66 +}
    1.67 +
    1.68 +template <class Begin, class End, class Value>
    1.69 +void setslice(object const& target, Begin const& begin, End const& end, Value const& value)
    1.70 +{
    1.71 +    setslice(target, object(begin), object(end), object(value));
    1.72 +}
    1.73 +
    1.74 +template <class Begin, class End>
    1.75 +void delslice(object const& target, Begin const& begin, End const& end)
    1.76 +{
    1.77 +    delslice(target, object(begin), object(end));
    1.78 +}
    1.79 +
    1.80 +}}} // namespace boost::python::api
    1.81 +
    1.82 +#endif // OBJECT_PROTOCOL_DWA2002615_HPP