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 2005-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. // Note: bidirectional streams are not supported. #ifndef BOOST_IOSTREAMS_COMPOSE_HPP_INCLUDED #define BOOST_IOSTREAMS_COMPOSE_HPP_INCLUDED #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include
// min. #include
// pair. #include
// DEDUCED_TYPENAME. #include
#include
#include
#include
#include
#include
#include
#include
// mode_of, is_direct. #include
#include
#include
#include
// Must come last. #include
// MSVC. namespace boost { namespace iostreams { namespace detail { template< typename First, typename Second, typename FirstMode = BOOST_DEDUCED_TYPENAME mode_of
::type, typename SecondMode = BOOST_DEDUCED_TYPENAME mode_of
::type > struct composite_mode : select< is_convertible
, FirstMode, is_convertible
, SecondMode, is_convertible
, input, else_, output > { }; // // Template name: composite_device. // Description: Provides a Device view of a Filter, Device pair. // Template paramters: // Filter - A model of Filter. // Device - An indirect model of Device. // template< typename Filter, typename Device, typename Mode = BOOST_DEDUCED_TYPENAME composite_mode
::type > class composite_device { private: typedef typename detail::param_type
::type param_type; typedef typename mode_of
::type filter_mode; typedef typename mode_of
::type device_mode; typedef typename iostreams::select< // Disambiguation for Tru64. is_direct
, direct_adapter
, is_std_io
, Device&, else_, Device >::type value_type; public: typedef typename char_type_of
::type char_type; struct category : Mode, device_tag, closable_tag, flushable_tag, localizable_tag, optimally_buffered_tag { }; composite_device(const Filter& flt, param_type dev); std::streamsize read(char_type* s, std::streamsize n); std::streamsize write(const char_type* s, std::streamsize n); std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out ); void close(); void close(BOOST_IOS::openmode which); bool flush(); std::streamsize optimal_buffer_size() const; template
// Avoid dependency on
void imbue(const Locale& loc) { iostreams::imbue(filter_, loc); iostreams::imbue(device_, loc); } Filter& first() { return filter_; } Device& second() { return device_; } private: Filter filter_; value_type device_; }; // // Template name: composite_device. // Description: Provides a Device view of a Filter, Device pair. // Template paramters: // Filter - A model of Filter. // Device - An indirect model of Device. // template< typename Filter1, typename Filter2, typename Mode = BOOST_DEDUCED_TYPENAME composite_mode
::type > class composite_filter { private: typedef reference_wrapper
filter_ref; typedef typename mode_of
::type first_mode; typedef typename mode_of
::type second_mode; // A dual-use filter cannot be composed with a read-write filter BOOST_STATIC_ASSERT( !(is_convertible
::value) || !(is_convertible
::value) || !(is_convertible
::value) || (is_convertible
::value) ); BOOST_STATIC_ASSERT( !(is_convertible
::value) || !(is_convertible
::value) || !(is_convertible
::value) || (is_convertible
::value) ); public: typedef typename char_type_of
::type char_type; struct category : Mode, filter_tag, multichar_tag, closable_tag, flushable_tag, localizable_tag, optimally_buffered_tag { }; composite_filter(const Filter1& filter1, const Filter2& filter2) : filter1_(filter1), filter2_(filter2) { } template
std::streamsize read(Source& src, char_type* s, std::streamsize n) { composite_device
cmp(boost::ref(filter2_), src); return iostreams::read(filter1_, cmp, s, n); } template
std::streamsize write(Sink& snk, const char_type* s, std::streamsize n) { composite_device
cmp(boost::ref(filter2_), snk); return iostreams::write(filter1_, cmp, s, n); } template
std::streampos seek( Device& dev, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out ) { composite_device
cmp(boost::ref(filter2_), dev); return iostreams::seek(filter1_, cmp, off, way, which); } template
void close(Device& dev) { BOOST_STATIC_ASSERT((!is_convertible
::value)); BOOST_STATIC_ASSERT((!is_convertible
::value)); // Create a new device by composing the second filter2_ with dev. composite_device
cmp(boost::ref(filter2_), dev); // Close input sequences in reverse order and output sequences in // forward order if (!is_convertible
::value) { detail::execute_all( detail::call_close(filter2_, dev, BOOST_IOS::in), detail::call_close(filter1_, cmp, BOOST_IOS::in), detail::call_close(filter1_, cmp, BOOST_IOS::out), detail::call_close(filter2_, dev, BOOST_IOS::out) ); } else if (is_convertible
::value) { detail::execute_all( detail::call_close(filter2_, dev, BOOST_IOS::in), detail::call_close(filter1_, cmp, BOOST_IOS::in) ); } else { detail::execute_all( detail::call_close(filter1_, cmp, BOOST_IOS::out), detail::call_close(filter2_, dev, BOOST_IOS::out) ); } } template
void close(Device& dev, BOOST_IOS::openmode which) { BOOST_STATIC_ASSERT( (is_convertible
::value) || (is_convertible
::value) ); // Create a new device by composing the second filter2_ with dev. composite_device
cmp(boost::ref(filter2_), dev); // Close input sequences in reverse order if ( which == BOOST_IOS::in && ( !is_convertible
::value || is_convertible
::value ) ) { detail::execute_all( detail::call_close(filter2_, dev, BOOST_IOS::in), detail::call_close(filter1_, cmp, BOOST_IOS::in) ); } // Close output sequences in forward order if ( which == BOOST_IOS::out && ( !is_convertible
::value || is_convertible
::value ) ) { detail::execute_all( detail::call_close(filter1_, cmp, BOOST_IOS::out), detail::call_close(filter2_, dev, BOOST_IOS::out) ); } } template
bool flush(Device& dev) { composite_device
cmp(filter2_, dev); return iostreams::flush(filter1_, cmp); } std::streamsize optimal_buffer_size() const { std::streamsize first = iostreams::optimal_buffer_size(filter1_); std::streamsize second = iostreams::optimal_buffer_size(filter2_); return first < second ? second : first; } template
// Avoid dependency on
void imbue(const Locale& loc) { // To do: consider using RAII. iostreams::imbue(filter1_, loc); iostreams::imbue(filter2_, loc); } Filter1& first() { return filter1_; } Filter2& second() { return filter2_; } private: Filter1 filter1_; Filter2 filter2_; }; template
struct composite_traits : mpl::if_< is_device
, composite_device
, composite_filter
> { }; } // End namespace detail. template
struct composite : detail::composite_traits
::type { typedef typename detail::param_type
::type param_type; typedef typename detail::composite_traits
::type base; composite(const Filter& flt, param_type dev) : base(flt, dev) { } }; //--------------Implementation of compose-------------------------------------// // Note: The following workarounds are patterned after resolve.hpp. It has not // yet been confirmed that they are necessary. #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //-------------------------// # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //-------------------------------// template
composite
compose( const Filter& filter, const FilterOrDevice& fod BOOST_IOSTREAMS_DISABLE_IF_STREAM(FilterOrDevice) ) { return composite
(filter, fod); } template
composite< Filter, std::basic_streambuf
> compose(const Filter& filter, std::basic_streambuf
& sb) { return composite< Filter, std::basic_streambuf
>(filter, sb); } template
composite< Filter, std::basic_istream
> compose(const Filter& filter, std::basic_istream
& is) { return composite< Filter, std::basic_istream
>(filter, is); } template
composite< Filter, std::basic_ostream
> compose(const Filter& filter, std::basic_ostream
& os) { return composite< Filter, std::basic_ostream
>(filter, os); } template
composite< Filter, std::basic_iostream
> compose(const Filter& filter, std::basic_iostream
& io) { return composite< Filter, std::basic_iostream
>(filter, io); } # else // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //---------------------// template
composite
compose( const Filter& filter, const FilterOrDevice& fod BOOST_IOSTREAMS_DISABLE_IF_STREAM(FilterOrDevice) ) { return composite
(filter, fod); } template
composite
compose(const Filter& filter, std::streambuf& sb) { return composite
(filter, sb); } template
composite
compose(const Filter& filter, std::istream& is) { return composite
(filter, is); } template
composite
compose(const Filter& filter, std::ostream& os) { return composite
(filter, os); } template
composite
compose(const Filter& filter, std::iostream& io) { return composite
(filter, io); } # endif // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------// #else // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //----------------// template
composite
compose(const Filter& flt, const Stream& strm, mpl::true_) { // Bad overload resolution. return composite
(flt, const_cast
(strm)); } template
composite
compose(const Filter& flt, const FilterOrDevice& fod, mpl::false_) { return composite
(flt, fod); } template
composite
compose( const Filter& flt, const FilterOrDevice& fod BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) ) { return compose(flt, fod, is_std_io
()); } # if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && \ !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && \ !defined(__GNUC__) // ---------------------------------------------------// template
composite
compose (const Filter& filter, FilterOrDevice& fod) { return composite
(filter, fod); } # endif // Borland 5.x, VC6-7.0 or GCC 2.9x //--------------------------------// #endif // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //---------------// //----------------------------------------------------------------------------// namespace detail { //--------------Implementation of composite_device---------------------------// template
composite_device
::composite_device (const Filter& flt, param_type dev) : filter_(flt), device_(dev) { } template
inline std::streamsize composite_device
::read (char_type* s, std::streamsize n) { return iostreams::read(filter_, device_, s, n); } template
inline std::streamsize composite_device
::write (const char_type* s, std::streamsize n) { return iostreams::write(filter_, device_, s, n); } template
std::streampos composite_device
::seek (stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) { return iostreams::seek(filter_, device_, off, way, which); } template
void composite_device
::close() { BOOST_STATIC_ASSERT((!is_convertible
::value)); BOOST_STATIC_ASSERT( !(is_convertible
::value) || !(is_convertible
::value) || !(is_convertible
::value) ); // Close input sequences in reverse order and output sequences // in forward order if (!is_convertible
::value) { detail::execute_all( detail::call_close(device_, BOOST_IOS::in), detail::call_close(filter_, device_, BOOST_IOS::in), detail::call_close(filter_, device_, BOOST_IOS::out), detail::call_close(device_, BOOST_IOS::out) ); } else if (is_convertible
::value) { detail::execute_all( detail::call_close(device_, BOOST_IOS::in), detail::call_close(filter_, device_, BOOST_IOS::in) ); } else { detail::execute_all( detail::call_close(filter_, device_, BOOST_IOS::out), detail::call_close(device_, BOOST_IOS::out) ); } } template
void composite_device
::close(BOOST_IOS::openmode which) { BOOST_STATIC_ASSERT((is_convertible
::value)); BOOST_STATIC_ASSERT(!(is_convertible
::value)); // Close input sequences in reverse order if (which == BOOST_IOS::in) { detail::execute_all( detail::call_close(device_, BOOST_IOS::in), detail::call_close(filter_, device_, BOOST_IOS::in) ); } // Close output sequences in forward order if (which == BOOST_IOS::out) { detail::execute_all( detail::call_close(filter_, device_, BOOST_IOS::out), detail::call_close(device_, BOOST_IOS::out) ); } } template
bool composite_device
::flush() { bool r1 = iostreams::flush(filter_, device_); bool r2 = iostreams::flush(device_); return r1 && r2; } template
std::streamsize composite_device
::optimal_buffer_size() const { return iostreams::optimal_buffer_size(device_); } } // End namespace detail. } } // End namespaces iostreams, boost. #include
#endif // #ifndef BOOST_IOSTREAMS_COMPOSE_HPP_INCLUDED
compose.hpp
Page URL
File URL
Prev
8/37
Next
Download
( 18 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.