DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
// 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_CORE_DWA2002615_HPP # define OBJECT_CORE_DWA2002615_HPP # include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) # include
# endif # include
namespace boost { namespace python { namespace converter { template
struct arg_to_python; } // Put this in an inner namespace so that the generalized operators won't take over namespace api { // This file contains the definition of the object class and enough to // construct/copy it, but not enough to do operations like // attribute/item access or addition. template
class proxy; struct const_attribute_policies; struct attribute_policies; struct const_item_policies; struct item_policies; struct const_slice_policies; struct slice_policies; class slice_nil; typedef proxy
const_object_attribute; typedef proxy
object_attribute; typedef proxy
const_object_item; typedef proxy
object_item; typedef proxy
const_object_slice; typedef proxy
object_slice; // // is_proxy -- proxy type detection // BOOST_PYTHON_IS_XXX_DEF(proxy, boost::python::api::proxy, 1) template
struct object_initializer; class object; typedef PyObject* (object::*bool_type)() const; template
class object_operators : public def_visitor
{ protected: # if !defined(BOOST_MSVC) || BOOST_MSVC >= 1300 typedef object const& object_cref; # else typedef object object_cref; # endif public: // function call // object operator()() const; # define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PYTHON_MAX_ARITY,
)) # include BOOST_PP_ITERATE() // truth value testing // operator bool_type() const; bool operator!() const; // needed for vc6 // Attribute access // const_object_attribute attr(char const*) const; object_attribute attr(char const*); // item access // const_object_item operator[](object_cref) const; object_item operator[](object_cref); template
const_object_item operator[](T const& key) const # if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 ; # else { return (*this)[object(key)]; } # endif template
object_item operator[](T const& key) # if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 ; # else { return (*this)[object(key)]; } # endif // slicing // const_object_slice slice(object_cref, object_cref) const; object_slice slice(object_cref, object_cref); const_object_slice slice(slice_nil, object_cref) const; object_slice slice(slice_nil, object_cref); const_object_slice slice(object_cref, slice_nil) const; object_slice slice(object_cref, slice_nil); const_object_slice slice(slice_nil, slice_nil) const; object_slice slice(slice_nil, slice_nil); template
const_object_slice slice(T const& start, V const& end) const # if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 ; # else { return this->slice( slice_bound
::type(start) , slice_bound
::type(end)); } # endif template
object_slice slice(T const& start, V const& end) # if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 ; # else { return this->slice( slice_bound
::type(start) , slice_bound
::type(end)); } # endif private: // def visitation for adding callable objects as class methods template
void visit(ClassT& cl, char const* name, python::detail::def_helper
const& helper) const { // It's too late to specify anything other than docstrings if // the callable object is already wrapped. BOOST_STATIC_ASSERT( (is_same
::value || detail::is_string_literal
::value)); objects::add_to_namespace(cl, name, this->derived_visitor(), helper.doc()); } friend class python::def_visitor_access; private: // there is a confirmed CWPro8 codegen bug here. We prevent the // early destruction of a temporary by binding a named object // instead. # if __MWERKS__ < 0x3000 || __MWERKS__ > 0x3003 typedef object const& object_cref2; # else typedef object const object_cref2; # endif }; // VC6 and VC7 require this base class in order to generate the // correct copy constructor for object. We can't define it there // explicitly or it will complain of ambiguity. struct object_base : object_operators
{ // copy constructor without NULL checking, for efficiency. inline object_base(object_base const&); inline object_base(PyObject* ptr); object_base& operator=(object_base const& rhs); ~object_base(); // Underlying object access -- returns a borrowed reference PyObject* ptr() const; private: PyObject* m_ptr; }; # ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template
struct is_derived_impl { static T x; template
static X* to_pointer(X const&); static char test(U const*); typedef char (&no)[2]; static no test(...); BOOST_STATIC_CONSTANT(bool, value = sizeof(test(to_pointer(x))) == 1); }; template
struct is_derived : mpl::bool_
::value> {}; # else template
struct is_derived : is_convertible< typename remove_reference
::type* , U const* > {}; # endif template
typename objects::unforward_cref
::type do_unforward_cref(T const& x) { # if BOOST_WORKAROUND(__GNUC__, == 2) typedef typename objects::unforward_cref
::type ret; return ret(x); # else return x; # endif } # if BOOST_WORKAROUND(__GNUC__, == 2) // GCC 2.x has non-const string literals; this hacks around that problem. template
char const (& do_unforward_cref(char const(&x)[N]) )[N] { return x; } # endif class object; template
PyObject* object_base_initializer(T const& x) { typedef typename is_derived< BOOST_DEDUCED_TYPENAME objects::unforward_cref
::type , object >::type is_obj; return object_initializer< BOOST_DEDUCED_TYPENAME unwrap_reference
::type >::get( x , is_obj() ); } class object : public object_base { public: // default constructor creates a None object object(); // explicit conversion from any C++ object to Python template
explicit object( T const& x # if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // use some SFINAE to un-confuse MSVC about its // copy-initialization ambiguity claim. , typename mpl::if_
,int&,int>::type* = 0 # endif ) : object_base(object_base_initializer(x)) { } // Throw error_already_set() if the handle is null. BOOST_PYTHON_DECL explicit object(handle<> const&); private: public: // implementation detail -- for internal use only explicit object(detail::borrowed_reference); explicit object(detail::new_reference); explicit object(detail::new_non_null_reference); }; // Macros for forwarding constructors in classes derived from // object. Derived classes will usually want these as an // implementation detail # define BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS_(derived, base) \ inline explicit derived(python::detail::borrowed_reference p) \ : base(p) {} \ inline explicit derived(python::detail::new_reference p) \ : base(p) {} \ inline explicit derived(python::detail::new_non_null_reference p) \ : base(p) {} # if !defined(BOOST_MSVC) || BOOST_MSVC >= 1300 # define BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS_ # else // MSVC6 has a bug which causes an explicit template constructor to // be preferred over an appropriate implicit conversion operator // declared on the argument type. Normally, that would cause a // runtime failure when using extract
to extract a type with a // templated constructor. This additional constructor will turn that // runtime failure into an ambiguity error at compile-time due to // the lack of partial ordering, or at least a link-time error if no // generalized template constructor is declared. # define BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(derived, base) \ BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS_(derived, base) \ template
\ explicit derived(extract
const&); # endif // // object_initializer -- get the handle to construct the object with, // based on whether T is a proxy or derived from object // template
struct object_initializer_impl { static PyObject* get(object const& x, mpl::true_) { return python::incref(x.ptr()); } template
static PyObject* get(T const& x, mpl::false_) { return python::incref(converter::arg_to_python
(x).get()); } }; template <> struct object_initializer_impl
{ template
static PyObject* get(proxy
const& x, mpl::false_) { return python::incref(x.operator object().ptr()); } }; template <> struct object_initializer_impl
{ template
static PyObject* get(T const& x, U) { return python::incref(get_managed_object(x, tag)); } }; template <> struct object_initializer_impl
{}; // empty implementation should cause an error template
struct object_initializer : object_initializer_impl< is_proxy
::value , converter::is_object_manager
::value > {}; } using api::object; template
struct extract; // // implementation // inline object::object() : object_base(python::incref(Py_None)) {} // copy constructor without NULL checking, for efficiency inline api::object_base::object_base(object_base const& rhs) : m_ptr(python::incref(rhs.m_ptr)) {} inline api::object_base::object_base(PyObject* p) : m_ptr(p) {} inline api::object_base& api::object_base::operator=(api::object_base const& rhs) { Py_INCREF(rhs.m_ptr); Py_DECREF(this->m_ptr); this->m_ptr = rhs.m_ptr; return *this; } inline api::object_base::~object_base() { Py_DECREF(m_ptr); } inline object::object(detail::borrowed_reference p) : object_base(python::incref((PyObject*)p)) {} inline object::object(detail::new_reference p) : object_base(expect_non_null((PyObject*)p)) {} inline object::object(detail::new_non_null_reference p) : object_base((PyObject*)p) {} inline PyObject* api::object_base::ptr() const { return m_ptr; } // // Converter specialization implementations // namespace converter { template
struct object_manager_traits; template <> struct object_manager_traits
{ BOOST_STATIC_CONSTANT(bool, is_specialized = true); static bool check(PyObject*) { return true; } static python::detail::new_non_null_reference adopt(PyObject* x) { return python::detail::new_non_null_reference(x); } #ifndef BOOST_PYTHON_NO_PY_SIGNATURES static PyTypeObject const *get_pytype() {return 0;} #endif }; } inline PyObject* get_managed_object(object const& x, tag_t) { return x.ptr(); } }} // namespace boost::python # include
#endif // OBJECT_CORE_DWA2002615_HPP
object_core.hpp
Page URL
File URL
Prev
46/85
Next
Download
( 13 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.