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
// (C) Copyright Gennadiy Rozental 2005-2007. // 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) // See http://www.boost.org/libs/test for the library home page. // // File : $RCSfile$ // // Version : $Revision: 43798 $ // // Description : facilities for named function parameters support // *************************************************************************** #ifndef BOOST_TEST_NAMED_PARAM_022505GER #define BOOST_TEST_NAMED_PARAM_022505GER // Boost #include
#include
// Boost.Test #include
#include
#include
//____________________________________________________________________________// namespace boost { namespace nfp { // named function parameters // ************************************************************************** // // ************** forward declarations ************** // // ************************************************************************** // template
struct named_parameter; template
struct keyword; namespace nfp_detail { template
struct named_parameter_combine; // ************************************************************************** // // ************** access_to_invalid_parameter ************** // // ************************************************************************** // struct access_to_invalid_parameter {}; //____________________________________________________________________________// inline void report_access_to_invalid_parameter() { throw access_to_invalid_parameter(); } //____________________________________________________________________________// // ************************************************************************** // // ************** nil ************** // // ************************************************************************** // struct nil { template
operator T() const { report_access_to_invalid_parameter(); static T* v = 0; return *v; } template
nil operator()( Arg1 const& ) { report_access_to_invalid_parameter(); return nil(); } template
nil operator()( Arg1 const&, Arg2 const& ) { report_access_to_invalid_parameter(); return nil(); } template
nil operator()( Arg1 const&, Arg2 const&, Arg3 const& ) { report_access_to_invalid_parameter(); return nil(); } // Visitation support template
void apply_to( Visitor& V ) const {} }; // ************************************************************************** // // ************** named_parameter_base ************** // // ************************************************************************** // template
struct named_parameter_base { template
named_parameter_combine
operator,( NP const& np ) const { return named_parameter_combine
( np, *static_cast
(this) ); } }; //____________________________________________________________________________// // ************************************************************************** // // ************** named_parameter_combine ************** // // ************************************************************************** // template
struct named_parameter_combine : Rest, named_parameter_base
> { typedef typename NP::ref_type res_type; typedef named_parameter_combine
self_type; // Constructor named_parameter_combine( NP const& np, Rest const& r ) : Rest( r ), m_param( np ) {} // Access methods res_type operator[]( keyword
kw ) const { return m_param[kw]; } res_type operator[]( keyword
kw ) const { return m_param[kw]; } using Rest::operator[]; bool has( keyword
) const { return true; } using Rest::has; #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) template
named_parameter_combine
operator,( NP const& np ) const { return named_parameter_combine
( np, *this ); } #else using named_parameter_base
>::operator,; #endif // Visitation support template
void apply_to( Visitor& V ) const { m_param.apply_to( V ); Rest::apply_to( V ); } private: // Data members NP m_param; }; } // namespace nfp_detail // ************************************************************************** // // ************** named_parameter_combine ************** // // ************************************************************************** // template
struct named_parameter : nfp_detail::named_parameter_base
> { typedef T data_type; typedef ReferenceType ref_type; typedef unique_id id; // Constructor explicit named_parameter( ref_type v ) : m_value( v ) {} // Access methods ref_type operator[]( keyword
) const { return m_value; } ref_type operator[]( keyword
) const { return m_value; } template
nfp_detail::nil operator[]( keyword
) const { return nfp_detail::nil(); } bool has( keyword
) const { return true; } template
bool has( keyword
) const { return false; } // Visitation support template
void apply_to( Visitor& V ) const { V.set_parameter( rtti::type_id
(), m_value ); } private: // Data members ref_type m_value; }; //____________________________________________________________________________// // ************************************************************************** // // ************** no_params ************** // // ************************************************************************** // namespace nfp_detail { typedef named_parameter
no_params_type; } namespace { nfp_detail::no_params_type no_params( '\0' ); } // local namespace //____________________________________________________________________________// // ************************************************************************** // // ************** keyword ************** // // ************************************************************************** // template
struct keyword { typedef unique_id id; template
named_parameter
operator=( T const& t ) const { return named_parameter
( t ); } template
named_parameter
operator=( T& t ) const { return named_parameter
( t ); } named_parameter
operator=( char const* t ) const { return named_parameter
( t ); } }; //____________________________________________________________________________// // ************************************************************************** // // ************** typed_keyword ************** // // ************************************************************************** // template
struct typed_keyword : keyword
{ named_parameter
operator=( T const& t ) const { return named_parameter
( t ); } named_parameter
operator=( T& t ) const { return named_parameter
( t ); } }; //____________________________________________________________________________// template
struct typed_keyword
: keyword
, named_parameter
{ typedef unique_id id; typed_keyword() : named_parameter
( true ) {} named_parameter
operator!() const { return named_parameter
( false ); } }; //____________________________________________________________________________// // ************************************************************************** // // ************** optionally_assign ************** // // ************************************************************************** // template
inline void optionally_assign( T&, nfp_detail::nil ) { nfp_detail::report_access_to_invalid_parameter(); } //____________________________________________________________________________// template
inline void #if BOOST_WORKAROUND( __MWERKS__, BOOST_TESTED_AT( 0x3003 ) ) \ || BOOST_WORKAROUND( __DECCXX_VER, BOOST_TESTED_AT(60590042) ) optionally_assign( T& target, Source src ) #else optionally_assign( T& target, Source const& src ) #endif { using namespace unit_test; assign_op( target, src, 0 ); } //____________________________________________________________________________// template
inline void optionally_assign( T& target, Params const& p, Keyword k ) { if( p.has(k) ) optionally_assign( target, p[k] ); } //____________________________________________________________________________// } // namespace nfp } // namespace boost #include
#endif // BOOST_TEST_NAMED_PARAM_022505GER
named_params.hpp
Page URL
File URL
Prev
8/13
Next
Download
( 10 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.