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