os/ossrv/ossrv_pub/boost_apis/boost/python/long.hpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
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 LONG_DWA2002627_HPP
sl@0
     6
# define LONG_DWA2002627_HPP
sl@0
     7
sl@0
     8
# include <boost/python/detail/prefix.hpp>
sl@0
     9
sl@0
    10
# include <boost/python/object.hpp>
sl@0
    11
# include <boost/python/converter/pytype_object_mgr_traits.hpp>
sl@0
    12
sl@0
    13
namespace boost { namespace python { 
sl@0
    14
sl@0
    15
namespace detail
sl@0
    16
{
sl@0
    17
  struct BOOST_PYTHON_DECL long_base : object
sl@0
    18
  {
sl@0
    19
   protected:
sl@0
    20
      long_base(); // new long_
sl@0
    21
      explicit long_base(object_cref rhs);
sl@0
    22
      explicit long_base(object_cref rhs, object_cref base);
sl@0
    23
      
sl@0
    24
      BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(long_base, object)
sl@0
    25
          
sl@0
    26
   private:
sl@0
    27
      static detail::new_non_null_reference call(object const&);
sl@0
    28
      static detail::new_non_null_reference call(object const&, object const&);
sl@0
    29
  };
sl@0
    30
}
sl@0
    31
sl@0
    32
class long_ : public detail::long_base
sl@0
    33
{
sl@0
    34
    typedef detail::long_base base;
sl@0
    35
 public:
sl@0
    36
    long_() {} // new long_
sl@0
    37
sl@0
    38
    template <class T>
sl@0
    39
    explicit long_(T const& rhs)
sl@0
    40
        : detail::long_base(object(rhs))
sl@0
    41
    {
sl@0
    42
    }
sl@0
    43
sl@0
    44
    template <class T, class U>
sl@0
    45
    explicit long_(T const& rhs, U const& base)
sl@0
    46
        : detail::long_base(object(rhs), object(base))
sl@0
    47
    {
sl@0
    48
    }
sl@0
    49
    
sl@0
    50
 public: // implementation detail -- for internal use only
sl@0
    51
    BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(long_, base)
sl@0
    52
};
sl@0
    53
sl@0
    54
//
sl@0
    55
// Converter Specializations
sl@0
    56
//
sl@0
    57
namespace converter
sl@0
    58
{
sl@0
    59
  template <>
sl@0
    60
  struct object_manager_traits<long_>
sl@0
    61
      : pytype_object_manager_traits<&PyLong_Type,long_>
sl@0
    62
  {
sl@0
    63
  };
sl@0
    64
}
sl@0
    65
sl@0
    66
}} // namespace boost::python
sl@0
    67
sl@0
    68
#endif // LONG_DWA2002627_HPP