Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/python/object_protocol.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright David Abrahams 2002.
0002 // Distributed under the Boost Software License, Version 1.0. (See
0003 // accompanying file LICENSE_1_0.txt or copy at
0004 // http://www.boost.org/LICENSE_1_0.txt)
0005 #ifndef OBJECT_PROTOCOL_DWA2002615_HPP
0006 # define OBJECT_PROTOCOL_DWA2002615_HPP
0007 
0008 # include <boost/python/detail/prefix.hpp>
0009 
0010 # include <boost/python/object_protocol_core.hpp>
0011 # include <boost/python/object_core.hpp>
0012 
0013 # include <boost/detail/workaround.hpp>
0014 
0015 namespace boost { namespace python { namespace api {
0016 
0017 # if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
0018 // attempt to use SFINAE to prevent functions accepting T const& from
0019 // coming up as ambiguous with the one taking a char const* when a
0020 // string literal is passed
0021 #  define BOOST_PYTHON_NO_ARRAY_ARG(T)             , T (*)() = 0
0022 # else 
0023 #  define BOOST_PYTHON_NO_ARRAY_ARG(T) 
0024 # endif
0025 
0026 template <class Target, class Key>
0027 object getattr(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
0028 {
0029     return getattr(object(target), object(key));
0030 }
0031 
0032 template <class Target, class Key, class Default>
0033 object getattr(Target const& target, Key const& key, Default const& default_ BOOST_PYTHON_NO_ARRAY_ARG(Key))
0034 {
0035     return getattr(object(target), object(key), object(default_));
0036 }
0037 
0038 
0039 template <class Key, class Value>
0040 void setattr(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(Key))
0041 {
0042     setattr(target, object(key), object(value));
0043 }
0044 
0045 template <class Key>
0046 void delattr(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
0047 {
0048     delattr(target, object(key));
0049 }
0050 
0051 template <class Target, class Key>
0052 object getitem(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
0053 {
0054     return getitem(object(target), object(key));
0055 }
0056 
0057 
0058 template <class Key, class Value>
0059 void setitem(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(Key))
0060 {
0061     setitem(target, object(key), object(value));
0062 }
0063 
0064 template <class Key>
0065 void delitem(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
0066 {
0067     delitem(target, object(key));
0068 }
0069 
0070 template <class Target, class Begin, class End>
0071 object getslice(Target const& target, Begin const& begin, End const& end)
0072 {
0073     return getslice(object(target), object(begin), object(end));
0074 }
0075 
0076 template <class Begin, class End, class Value>
0077 void setslice(object const& target, Begin const& begin, End const& end, Value const& value)
0078 {
0079     setslice(target, object(begin), object(end), object(value));
0080 }
0081 
0082 template <class Begin, class End>
0083 void delslice(object const& target, Begin const& begin, End const& end)
0084 {
0085     delslice(target, object(begin), object(end));
0086 }
0087 
0088 }}} // namespace boost::python::api
0089 
0090 #endif // OBJECT_PROTOCOL_DWA2002615_HPP