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. // Contains: The function template copy, which reads data from a Source // and writes it to a Sink until the end of the sequence is reached, returning // the number of characters transfered. // The implementation is complicated by the need to handle smart adapters // and direct devices. #ifndef BOOST_IOSTREAMS_COPY_HPP_INCLUDED #define BOOST_IOSTREAMS_COPY_HPP_INCLUDED #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include
// Make sure ptrdiff_t is in std. #include
// copy, min. #include
// ptrdiff_t. #include
// pair. #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
// failure, streamsize. #include
#include
#include
// read, write, close. #include
#include
#include
namespace boost { namespace iostreams { namespace detail { // The following four overloads of copy_impl() optimize // copying in the case that one or both of the two devices // models Direct (see // http://www.boost.org/libs/iostreams/doc/index.html?path=4.1.1.4) // Copy from a direct source to a direct sink template
std::streamsize copy_impl( Source& src, Sink& snk, std::streamsize /* buffer_size */, mpl::true_, mpl::true_ ) { using namespace std; typedef typename char_type_of
::type char_type; typedef std::pair
pair_type; pair_type p1 = iostreams::input_sequence(src); pair_type p2 = iostreams::output_sequence(snk); std::streamsize total = static_cast
( (std::min)(p1.second - p1.first, p2.second - p2.first) ); std::copy(p1.first, p1.first + total, p2.first); return total; } // Copy from a direct source to an indirect sink template
std::streamsize copy_impl( Source& src, Sink& snk, std::streamsize /* buffer_size */, mpl::true_, mpl::false_ ) { using namespace std; typedef typename char_type_of
::type char_type; typedef std::pair
pair_type; pair_type p = iostreams::input_sequence(src); std::streamsize size, total; for ( total = 0, size = static_cast
(p.second - p.first); total < size; ) { std::streamsize amt = iostreams::write(snk, p.first + total, size - total); total += amt; } return total; } // Copy from an indirect source to a direct sink template
std::streamsize copy_impl( Source& src, Sink& snk, std::streamsize buffer_size, mpl::false_, mpl::true_ ) { typedef typename char_type_of
::type char_type; typedef std::pair
pair_type; detail::basic_buffer
buf(buffer_size); pair_type p = snk.output_sequence(); std::streamsize total = 0; std::ptrdiff_t capacity = p.second - p.first; while (true) { std::streamsize amt = iostreams::read( src, buf.data(), buffer_size < capacity - total ? buffer_size : static_cast
(capacity - total) ); if (amt == -1) break; std::copy(buf.data(), buf.data() + amt, p.first + total); total += amt; } return total; } // Copy from an indirect source to an indirect sink template
std::streamsize copy_impl( Source& src, Sink& snk, std::streamsize buffer_size, mpl::false_, mpl::false_ ) { typedef typename char_type_of
::type char_type; detail::basic_buffer
buf(buffer_size); non_blocking_adapter
nb(snk); std::streamsize total = 0; bool done = false; while (!done) { std::streamsize amt; done = (amt = iostreams::read(src, buf.data(), buffer_size)) == -1; if (amt != -1) { iostreams::write(nb, buf.data(), amt); total += amt; } } return total; } // The following function object is used with // boost::iostreams::detail::execute() in the primary // overload of copy_impl(), below // Function object that delegates to one of the above four // overloads of compl_impl() template
class copy_operation { public: typedef std::streamsize result_type; copy_operation(Source& src, Sink& snk, std::streamsize buffer_size) : src_(src), snk_(snk), buffer_size_(buffer_size) { } std::streamsize operator()() { return copy_impl( src_, snk_, buffer_size_, is_direct
(), is_direct
() ); } private: copy_operation& operator=(const copy_operation&); Source& src_; Sink& snk_; std::streamsize buffer_size_; }; // Primary overload of copy_impl. Delegates to one of the above four // overloads of compl_impl(), depending on which of the two given // devices, if any, models Direct (see // http://www.boost.org/libs/iostreams/doc/index.html?path=4.1.1.4) template
std::streamsize copy_impl(Source src, Sink snk, std::streamsize buffer_size) { using namespace std; typedef typename char_type_of
::type src_char; typedef typename char_type_of
::type snk_char; BOOST_STATIC_ASSERT((is_same
::value)); return detail::execute_all( copy_operation
(src, snk, buffer_size), detail::call_close_all(src), detail::call_close_all(snk) ); } } // End namespace detail. //------------------Definition of copy----------------------------------------// // Overload of copy() for the case where neither the source nor the sink is // a standard stream or stream buffer template
std::streamsize copy( const Source& src, const Sink& snk, std::streamsize buffer_size = default_device_buffer_size BOOST_IOSTREAMS_DISABLE_IF_STREAM(Source) BOOST_IOSTREAMS_DISABLE_IF_STREAM(Sink) ) { typedef typename char_type_of
::type char_type; return detail::copy_impl( detail::resolve
(src), detail::resolve
(snk), buffer_size ); } #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// // Overload of copy() for the case where the source, but not the sink, is // a standard stream or stream buffer template
std::streamsize copy( Source& src, const Sink& snk, std::streamsize buffer_size = default_device_buffer_size BOOST_IOSTREAMS_ENABLE_IF_STREAM(Source) BOOST_IOSTREAMS_DISABLE_IF_STREAM(Sink) ) { typedef typename char_type_of
::type char_type; return detail::copy_impl( detail::wrap(src), detail::resolve
(snk), buffer_size ); } // Overload of copy() for the case where the sink, but not the source, is // a standard stream or stream buffer template
std::streamsize copy( const Source& src, Sink& snk, std::streamsize buffer_size = default_device_buffer_size BOOST_IOSTREAMS_DISABLE_IF_STREAM(Source) BOOST_IOSTREAMS_ENABLE_IF_STREAM(Sink) ) { typedef typename char_type_of
::type char_type; return detail::copy_impl( detail::resolve
(src), detail::wrap(snk), buffer_size ); } // Overload of copy() for the case where neither the source nor the sink is // a standard stream or stream buffer template
std::streamsize copy( Source& src, Sink& snk, std::streamsize buffer_size = default_device_buffer_size BOOST_IOSTREAMS_ENABLE_IF_STREAM(Source) BOOST_IOSTREAMS_ENABLE_IF_STREAM(Sink) ) { return detail::copy_impl(detail::wrap(src), detail::wrap(snk), buffer_size); } #endif // #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //-----------------------// } } // End namespaces iostreams, boost. #endif // #ifndef BOOST_IOSTREAMS_COPY_HPP_INCLUDED
copy.hpp
Page URL
File URL
Prev
11/37
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.