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 2008 CodeRage, LLC (turkanis at coderage dot com) // (C) Copyright 2003-2007 Jonathan Turkanis // 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/iostreams for documentation. #ifndef BOOST_IOSTREAMS_DETAIL_DIRECT_ADAPTER_HPP_INCLUDED #define BOOST_IOSTREAMS_DETAIL_DIRECT_ADAPTER_HPP_INCLUDED #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include
// SFINAE, MSVC, put ptrdiff_t in std. #include
// copy, min. #include
// ptrdiff_t. #include
#include
#include
// forwarding. #include
// locale. #include
#include
#include
// openmode, seekdir, int types. #include
// mode_of, is_direct. #include
#include
#include
#include
#include
#include
#include
#include
// Must come last. #include
// VC7.1 namespace boost { namespace iostreams { namespace detail { //------------------Definition of direct_adapter_base-------------------------// // Put all initialization in base class to faciliate forwarding. template
class direct_adapter_base { public: typedef typename char_type_of
::type char_type; typedef typename mode_of
::type mode_type; struct category : mode_type, device_tag, closable_tag #ifndef BOOST_IOSTREAMS_NO_LOCALE , localizable_tag #endif { }; protected: explicit direct_adapter_base(const Direct& d); typedef is_convertible
is_double; struct pointers { char_type *beg, *ptr, *end; }; void init_input(mpl::true_); void init_input(mpl::false_) { } void init_output(mpl::true_); void init_output(mpl::false_) { } double_object
ptrs_; Direct d_; }; template
class direct_adapter : private direct_adapter_base
{ private: typedef direct_adapter_base
base_type; typedef typename base_type::pointers pointers; typedef typename base_type::is_double is_double; using base_type::ptrs_; using base_type::d_; public: typedef typename base_type::char_type char_type; typedef typename base_type::category category; // Constructors #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1310) direct_adapter(const Direct& d) : base_type(d) { } direct_adapter(const direct_adapter& d) : base_type(d) { } # define BOOST_PP_LOCAL_LIMITS (1, BOOST_IOSTREAMS_MAX_FORWARDING_ARITY) #else template
struct is_direct : mpl::or_< is_same
>, is_same
> { }; template
direct_adapter(const U& u) : base_type(forward(u, is_direct
())) { } # define BOOST_PP_LOCAL_LIMITS (2, BOOST_IOSTREAMS_MAX_FORWARDING_ARITY) #endif #define BOOST_PP_LOCAL_MACRO(n) \ template
\ direct_adapter(BOOST_PP_ENUM_BINARY_PARAMS(n, const P, &p)) \ : base_type(Direct(BOOST_PP_ENUM_PARAMS(n, p))) \ { } \ /**/ #include BOOST_PP_LOCAL_ITERATE() #undef BOOST_PP_LOCAL_MACRO // Device interface. std::streamsize read(char_type* s, std::streamsize n); std::streamsize write(const char_type* s, std::streamsize n); std::streampos seek( stream_offset, BOOST_IOS::seekdir, BOOST_IOS::openmode = BOOST_IOS::in | BOOST_IOS::out ); void close(); void close(BOOST_IOS::openmode which); #ifndef BOOST_IOSTREAMS_NO_LOCALE void imbue(const std::locale&); #endif // Direct device access. Direct& operator*() { return d_; } Direct* operator->() { return &d_; } #if BOOST_WORKAROUND(BOOST_MSVC, <= 1310) private: template
static Direct forward(const U& u, mpl::true_) { return u; } template
static Direct forward(const U& u, mpl::false_) { return Direct(u); } #endif }; //--------------Definition of wrap_direct and unwrap_direct-------------------// template
struct wrap_direct_traits : mpl::if_< is_direct
, direct_adapter
, Device > { }; template
typename wrap_direct_traits
::type inline wrap_direct(Device dev) { typedef typename wrap_direct_traits
::type type; return type(dev); } template
inline Device& unwrap_direct(Device& d) { return d; } template
inline Device& unwrap_direct(direct_adapter
& d) { return *d; } //--------------Implementation of direct_adapter_base-------------------------// template
direct_adapter_base
::direct_adapter_base(const Direct& d) : d_(d) { init_input(is_convertible
()); init_output(is_convertible
()); } template
void direct_adapter_base
::init_input(mpl::true_) { std::pair
seq = iostreams::input_sequence(d_); ptrs_.first().beg = seq.first; ptrs_.first().ptr = seq.first; ptrs_.first().end = seq.second; } template
void direct_adapter_base
::init_output(mpl::true_) { std::pair
seq = iostreams::output_sequence(d_); ptrs_.second().beg = seq.first; ptrs_.second().ptr = seq.first; ptrs_.second().end = seq.second; } //--------------Implementation of direct_adapter------------------------------// template
inline std::streamsize direct_adapter
::read (char_type* s, std::streamsize n) { using namespace std; pointers& get = ptrs_.first(); std::streamsize avail = static_cast
(get.end - get.ptr); std::streamsize result = (std::min)(n, avail); std::copy(get.ptr, get.ptr + result, s); get.ptr += result; return result != 0 ? result : -1; } template
inline std::streamsize direct_adapter
::write (const char_type* s, std::streamsize n) { using namespace std; pointers& put = ptrs_.second(); if (n > static_cast
(put.end - put.ptr)) throw write_area_exhausted(); std::copy(s, s + n, put.ptr); put.ptr += n; return n; } template
inline std::streampos direct_adapter
::seek ( stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) { using namespace std; pointers& get = ptrs_.first(); pointers& put = ptrs_.second(); if (way == BOOST_IOS::cur && get.ptr != put.ptr) throw bad_seek(); ptrdiff_t next = 0; if ((which & BOOST_IOS::in) || !is_double::value) { if (way == BOOST_IOS::beg) next = off; else if (way == BOOST_IOS::cur) next = get.ptr - get.beg + off; else next = get.end - get.beg + off; if (next >= 0 && next <= get.end - get.beg) get.ptr = get.beg + next; else throw bad_seek(); } if ((which & BOOST_IOS::out) && is_double::value) { if (way == BOOST_IOS::beg) next = off; else if (way == BOOST_IOS::cur) next = put.ptr - put.beg + off; else next = put.end - put.beg + off; if (next >= 0 && next <= put.end - put.beg) put.ptr = put.beg + next; else throw bad_seek(); } return offset_to_position(next); } template
void direct_adapter
::close() { BOOST_STATIC_ASSERT((!is_convertible
::value)); detail::close_all(d_); } template
void direct_adapter
::close(BOOST_IOS::openmode which) { BOOST_STATIC_ASSERT((is_convertible
::value)); boost::iostreams::close(d_, which); } #ifndef BOOST_IOSTREAMS_NO_LOCALE template
void direct_adapter
::imbue(const std::locale& loc) { boost::iostreams::imbue(d_, loc); } #endif } } } // End namespaces detail, iostreams, boost. #include
#endif // #ifndef BOOST_IOSTREAMS_DETAIL_DIRECT_ADAPTER_HPP_INCLUDED
direct_adapter.hpp
Page URL
File URL
Prev
3/8
Next
Download
( 9 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.