Blame view

3rdparty/boost_1_81_0/boost/python/object_protocol.hpp 2.67 KB
0b6a182c   Hu Chunming   添加无鉴权注册和注销
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
  // Copyright David Abrahams 2002.
  // Distributed under the Boost Software License, Version 1.0. (See
  // accompanying file LICENSE_1_0.txt or copy at
  // http://www.boost.org/LICENSE_1_0.txt)
  #ifndef OBJECT_PROTOCOL_DWA2002615_HPP
  # define OBJECT_PROTOCOL_DWA2002615_HPP
  
  # include <boost/python/detail/prefix.hpp>
  
  # include <boost/python/object_protocol_core.hpp>
  # include <boost/python/object_core.hpp>
  
  # include <boost/detail/workaround.hpp>
  
  namespace boost { namespace python { namespace api {
  
  # if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
  // attempt to use SFINAE to prevent functions accepting T const& from
  // coming up as ambiguous with the one taking a char const* when a
  // string literal is passed
  #  define BOOST_PYTHON_NO_ARRAY_ARG(T)             , T (*)() = 0
  # else 
  #  define BOOST_PYTHON_NO_ARRAY_ARG(T) 
  # endif
  
  template <class Target, class Key>
  object getattr(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
  {
      return getattr(object(target), object(key));
  }
  
  template <class Target, class Key, class Default>
  object getattr(Target const& target, Key const& key, Default const& default_ BOOST_PYTHON_NO_ARRAY_ARG(Key))
  {
      return getattr(object(target), object(key), object(default_));
  }
  
  
  template <class Key, class Value>
  void setattr(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(Key))
  {
      setattr(target, object(key), object(value));
  }
  
  template <class Key>
  void delattr(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
  {
      delattr(target, object(key));
  }
  
  template <class Target, class Key>
  object getitem(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
  {
      return getitem(object(target), object(key));
  }
  
  
  template <class Key, class Value>
  void setitem(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(Key))
  {
      setitem(target, object(key), object(value));
  }
  
  template <class Key>
  void delitem(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
  {
      delitem(target, object(key));
  }
  
  template <class Target, class Begin, class End>
  object getslice(Target const& target, Begin const& begin, End const& end)
  {
      return getslice(object(target), object(begin), object(end));
  }
  
  template <class Begin, class End, class Value>
  void setslice(object const& target, Begin const& begin, End const& end, Value const& value)
  {
      setslice(target, object(begin), object(end), object(value));
  }
  
  template <class Begin, class End>
  void delslice(object const& target, Begin const& begin, End const& end)
  {
      delslice(target, object(begin), object(end));
  }
  
  }}} // namespace boost::python::api
  
  #endif // OBJECT_PROTOCOL_DWA2002615_HPP