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 2001. // 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 MAKE_CONSTRUCTOR_DWA20011221_HPP # define MAKE_CONSTRUCTOR_DWA20011221_HPP # include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
namespace boost { namespace python { namespace detail { template
struct install_holder : converter::context_result_converter { install_holder(PyObject* args_) : m_self(PyTuple_GetItem(args_, 0)) {} PyObject* operator()(T x) const { dispatch(x, is_pointer
()); return none(); } private: template
void dispatch(U* x, mpl::true_) const { std::auto_ptr
owner(x); dispatch(owner, mpl::false_()); } template
void dispatch(Ptr x, mpl::false_) const { typedef typename pointee
::type value_type; typedef objects::pointer_holder
holder; typedef objects::instance
instance_t; void* memory = holder::allocate(this->m_self, offsetof(instance_t, storage), sizeof(holder)); try { (new (memory) holder(x))->install(this->m_self); } catch(...) { holder::deallocate(this->m_self, memory); throw; } } PyObject* m_self; }; struct constructor_result_converter { template
struct apply { typedef install_holder
type; }; }; template
struct offset_args { offset_args(BaseArgs base_) : base(base_) {} BaseArgs base; }; template
inline PyObject* get(mpl::int_
, offset_args
const& args_) { return get(mpl::int_<(N+Offset::value)>(), args_.base); } template
inline unsigned arity(offset_args
const& args_) { return arity(args_.base) - Offset::value; } template
struct constructor_policy : BasePolicy_ { constructor_policy(BasePolicy_ base) : BasePolicy_(base) {} // If the BasePolicy_ supplied a result converter it would be // ignored; issue an error if it's not the default. #if defined _MSC_VER && _MSC_VER < 1300 typedef is_same< typename BasePolicy_::result_converter , default_result_converter > same_result_converter; //see above for explanation BOOST_STATIC_ASSERT(same_result_converter::value) ; #else BOOST_MPL_ASSERT_MSG( (is_same< typename BasePolicy_::result_converter , default_result_converter >::value) , MAKE_CONSTRUCTOR_SUPPLIES_ITS_OWN_RESULT_CONVERTER_THAT_WOULD_OVERRIDE_YOURS , (typename BasePolicy_::result_converter) ); #endif typedef constructor_result_converter result_converter; typedef offset_args
> argument_package; }; template
struct outer_constructor_signature { typedef typename mpl::pop_front
::type inner_args; typedef typename mpl::push_front
::type outer_args; typedef typename mpl::push_front
::type type; }; // ETI workaround template <> struct outer_constructor_signature
{ typedef int type; }; // // These helper functions for make_constructor (below) do the raw work // of constructing a Python object from some invokable entity. See //
for more information about how // the Sig arguments is used. // // @group make_constructor_aux { template
object make_constructor_aux( F f // An object that can be invoked by detail::invoke() , CallPolicies const& p // CallPolicies to use in the invocation , Sig const& // An MPL sequence of argument types expected by F ) { typedef typename outer_constructor_signature
::type outer_signature; typedef constructor_policy
inner_policy; return objects::function_object( objects::py_function( detail::caller
(f, inner_policy(p)) , outer_signature() ) ); } // As above, except that it accepts argument keywords. NumKeywords // is used only for a compile-time assertion to make sure the user // doesn't pass more keywords than the function can accept. To // disable all checking, pass mpl::int_<0> for NumKeywords. template
object make_constructor_aux( F f , CallPolicies const& p , Sig const& , detail::keyword_range const& kw // a [begin,end) pair of iterators over keyword names , NumKeywords // An MPL integral type wrapper: the size of kw ) { enum { arity = mpl::size
::value - 1 }; typedef typename detail::error::more_keywords_than_function_arguments< NumKeywords::value, arity >::too_many_keywords assertion; typedef typename outer_constructor_signature
::type outer_signature; typedef constructor_policy
inner_policy; return objects::function_object( objects::py_function( detail::caller
(f, inner_policy(p)) , outer_signature() ) , kw ); } // } // // These dispatch functions are used to discriminate between the // cases when the 3rd argument is keywords or when it is a // signature. // // @group Helpers for make_constructor when called with 3 arguments. { // template
object make_constructor_dispatch(F f, CallPolicies const& policies, Keywords const& kw, mpl::true_) { return detail::make_constructor_aux( f , policies , detail::get_signature(f) , kw.range() , mpl::int_
() ); } template
object make_constructor_dispatch(F f, CallPolicies const& policies, Signature const& sig, mpl::false_) { return detail::make_constructor_aux( f , policies , sig ); } // } } // These overloaded functions wrap a function or member function // pointer as a Python object, using optional CallPolicies, // Keywords, and/or Signature. @group { // template
object make_constructor(F f) { return detail::make_constructor_aux( f,default_call_policies(), detail::get_signature(f)); } template
object make_constructor(F f, CallPolicies const& policies) { return detail::make_constructor_aux( f, policies, detail::get_signature(f)); } template
object make_constructor( F f , CallPolicies const& policies , KeywordsOrSignature const& keywords_or_signature) { typedef typename detail::is_reference_to_keywords
::type is_kw; return detail::make_constructor_dispatch( f , policies , keywords_or_signature , is_kw() ); } template
object make_constructor( F f , CallPolicies const& policies , Keywords const& kw , Signature const& sig ) { return detail::make_constructor_aux( f , policies , sig , kw.range() , mpl::int_
() ); } // } }} #endif // MAKE_CONSTRUCTOR_DWA20011221_HPP
make_constructor.hpp
Page URL
File URL
Prev
37/85
Next
Download
( 8 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.