x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
extract.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\python\extract.hpp
旋转
特效
属性
历史版本
// 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 EXTRACT_DWA200265_HPP # define EXTRACT_DWA200265_HPP # include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || BOOST_WORKAROUND(BOOST_INTEL_WIN, <= 900) // workaround for VC++ 6.x or 7.0 # define BOOST_EXTRACT_WORKAROUND () #else # define BOOST_EXTRACT_WORKAROUND #endif namespace boost { namespace python { namespace api { class object; } namespace converter { template
struct extract_pointer { typedef Ptr result_type; extract_pointer(PyObject*); bool check() const; Ptr operator()() const; private: PyObject* m_source; void* m_result; }; template
struct extract_reference { typedef Ref result_type; extract_reference(PyObject*); bool check() const; Ref operator()() const; private: PyObject* m_source; void* m_result; }; template
struct extract_rvalue : private noncopyable { typedef typename mpl::if_< python::detail::copy_ctor_mutates_rhs
, T& , typename call_traits
::param_type >::type result_type; extract_rvalue(PyObject*); bool check() const; result_type operator()() const; private: PyObject* m_source; mutable rvalue_from_python_data
m_data; }; template
struct extract_object_manager { typedef T result_type; extract_object_manager(PyObject*); bool check() const; result_type operator()() const; private: PyObject* m_source; }; template
struct select_extract { BOOST_STATIC_CONSTANT( bool, obj_mgr = is_object_manager
::value); BOOST_STATIC_CONSTANT( bool, ptr = is_pointer
::value); BOOST_STATIC_CONSTANT( bool, ref = is_reference
::value); typedef typename mpl::if_c< obj_mgr , extract_object_manager
, typename mpl::if_c< ptr , extract_pointer
, typename mpl::if_c< ref , extract_reference
, extract_rvalue
>::type >::type >::type type; }; } template
struct extract : converter::select_extract
::type { private: typedef typename converter::select_extract
::type base; public: typedef typename base::result_type result_type; operator result_type() const { return (*this)(); } extract(PyObject*); extract(api::object const&); }; // // Implementations // template
inline extract
::extract(PyObject* o) : base(o) { } template
inline extract
::extract(api::object const& o) : base(o.ptr()) { } namespace converter { template
inline extract_rvalue
::extract_rvalue(PyObject* x) : m_source(x) , m_data( (rvalue_from_python_stage1)(x, registered
::converters) ) { } template
inline bool extract_rvalue
::check() const { return m_data.stage1.convertible; } template
inline typename extract_rvalue
::result_type extract_rvalue
::operator()() const { return *(T*)( // Only do the stage2 conversion once m_data.stage1.convertible == m_data.storage.bytes ? m_data.storage.bytes : (rvalue_from_python_stage2)(m_source, m_data.stage1, registered
::converters) ); } template
inline extract_reference
::extract_reference(PyObject* obj) : m_source(obj) , m_result( (get_lvalue_from_python)(obj, registered
::converters) ) { } template
inline bool extract_reference
::check() const { return m_result != 0; } template
inline Ref extract_reference
::operator()() const { if (m_result == 0) (throw_no_reference_from_python)(m_source, registered
::converters); return python::detail::void_ptr_to_reference(m_result, (Ref(*)())0); } template
inline extract_pointer
::extract_pointer(PyObject* obj) : m_source(obj) , m_result( obj == Py_None ? 0 : (get_lvalue_from_python)(obj, registered_pointee
::converters) ) { } template
inline bool extract_pointer
::check() const { return m_source == Py_None || m_result != 0; } template
inline Ptr extract_pointer
::operator()() const { if (m_result == 0 && m_source != Py_None) (throw_no_pointer_from_python)(m_source, registered_pointee
::converters); return Ptr(m_result); } template
inline extract_object_manager
::extract_object_manager(PyObject* obj) : m_source(obj) { } template
inline bool extract_object_manager
::check() const { return object_manager_traits
::check(m_source); } template
inline T extract_object_manager
::operator()() const { return T( object_manager_traits
::adopt(python::incref(m_source)) ); } } }} // namespace boost::python::converter #endif // EXTRACT_DWA200265_HPP
extract.hpp
网页地址
文件地址
上一页
25/85
下一页
下载
( 6 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.