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_STREAMBUF_HPP_INCLUDED #define BOOST_IOSTREAMS_DETAIL_DIRECT_STREAMBUF_HPP_INCLUDED #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include
#include
#include
#include
// pair. #include
// BOOST_DEDUCED_TYPENAME, #include
// member template friends. #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
// Must come last. #include
// MSVC. namespace boost { namespace iostreams { namespace detail { template< typename T, typename Tr = BOOST_IOSTREAMS_CHAR_TRAITS( BOOST_DEDUCED_TYPENAME char_type_of
::type ) > class direct_streambuf : public linked_streambuf
::type, Tr> { public: typedef typename char_type_of
::type char_type; BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) private: typedef linked_streambuf
base_type; typedef typename category_of
::type category; typedef BOOST_IOSTREAMS_BASIC_STREAMBUF( char_type, traits_type ) streambuf_type; public: // stream needs access. void open(const T& t, int buffer_size, int pback_size); bool is_open() const; void close(); bool auto_close() const { return auto_close_; } void set_auto_close(bool close) { auto_close_ = close; } bool strict_sync() { return true; } // Declared in linked_streambuf. T* component() { return storage_.get(); } protected: #if !BOOST_WORKAROUND(__GNUC__, == 2) BOOST_IOSTREAMS_USING_PROTECTED_STREAMBUF_MEMBERS(base_type) #endif direct_streambuf(); //--------------Virtual functions-----------------------------------------// // Declared in linked_streambuf. void close_impl(BOOST_IOS::openmode m); const std::type_info& component_type() const { return typeid(T); } void* component_impl() { return component(); } #ifdef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES public: #endif // Declared in basic_streambuf. int_type underflow(); int_type pbackfail(int_type c); int_type overflow(int_type c); pos_type seekoff( off_type off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which ); pos_type seekpos(pos_type sp, BOOST_IOS::openmode which); private: pos_type seek_impl( stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which ); void init_input(any_tag) { } void init_input(input); void init_output(any_tag) { } void init_output(output); void init_get_area(); void init_put_area(); bool one_head() const; bool two_head() const; optional
storage_; char_type *ibeg_, *iend_, *obeg_, *oend_; bool auto_close_; }; //------------------Implementation of direct_streambuf------------------------// template
direct_streambuf
::direct_streambuf() : ibeg_(0), iend_(0), obeg_(0), oend_(0), auto_close_(true) { this->set_true_eof(true); } template
void direct_streambuf
::open(const T& t, int, int) { storage_.reset(t); init_input(category()); init_output(category()); setg(0, 0, 0); setp(0, 0); } template
bool direct_streambuf
::is_open() const { return ibeg_ != 0 || obeg_ != 0; } template
void direct_streambuf
::close() { base_type* self = this; detail::execute_all( detail::call_member_close(*self, BOOST_IOS::in), detail::call_member_close(*self, BOOST_IOS::out), detail::call_reset(storage_) ); } template
typename direct_streambuf
::int_type direct_streambuf
::underflow() { if (!ibeg_) throw cant_read(); if (!gptr()) init_get_area(); return gptr() != iend_ ? traits_type::to_int_type(*gptr()) : traits_type::eof(); } template
typename direct_streambuf
::int_type direct_streambuf
::pbackfail(int_type c) { using namespace std; if (!ibeg_) throw cant_read(); if (gptr() != 0 && gptr() != ibeg_) { gbump(-1); if (!traits_type::eq_int_type(c, traits_type::eof())) *gptr() = traits_type::to_char_type(c); return traits_type::not_eof(c); } throw bad_putback(); } template
typename direct_streambuf
::int_type direct_streambuf
::overflow(int_type c) { using namespace std; if (!obeg_) throw BOOST_IOSTREAMS_FAILURE("no write access"); if (!pptr()) init_put_area(); if (!traits_type::eq_int_type(c, traits_type::eof())) { if (pptr() == oend_) throw BOOST_IOSTREAMS_FAILURE("write area exhausted"); *pptr() = traits_type::to_char_type(c); pbump(1); return c; } return traits_type::not_eof(c); } template
inline typename direct_streambuf
::pos_type direct_streambuf
::seekoff (off_type off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) { return seek_impl(off, way, which); } template
inline typename direct_streambuf
::pos_type direct_streambuf
::seekpos (pos_type sp, BOOST_IOS::openmode which) { return seek_impl(position_to_offset(sp), BOOST_IOS::beg, which); } template
void direct_streambuf
::close_impl(BOOST_IOS::openmode which) { if (which == BOOST_IOS::in && ibeg_ != 0) { setg(0, 0, 0); ibeg_ = iend_ = 0; } if (which == BOOST_IOS::out && obeg_ != 0) { sync(); setp(0, 0); obeg_ = oend_ = 0; } boost::iostreams::close(*storage_, which); } template
typename direct_streambuf
::pos_type direct_streambuf
::seek_impl (stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) { using namespace std; BOOST_IOS::openmode both = BOOST_IOS::in | BOOST_IOS::out; if (two_head() && (which & both) == both) throw bad_seek(); stream_offset result = -1; bool one = one_head(); if (one && (pptr() != 0 || gptr()== 0)) init_get_area(); // Switch to input mode, for code reuse. if (one || (which & BOOST_IOS::in) != 0 && ibeg_ != 0) { if (!gptr()) setg(ibeg_, ibeg_, iend_); ptrdiff_t next = 0; switch (way) { case BOOST_IOS::beg: next = off; break; case BOOST_IOS::cur: next = (gptr() - ibeg_) + off; break; case BOOST_IOS::end: next = (iend_ - ibeg_) + off; break; default: assert(0); } if (next < 0 || next > (iend_ - ibeg_)) throw bad_seek(); setg(ibeg_, ibeg_ + next, iend_); result = next; } if (!one && (which & BOOST_IOS::out) != 0 && obeg_ != 0) { if (!pptr()) setp(obeg_, oend_); ptrdiff_t next = 0; switch (way) { case BOOST_IOS::beg: next = off; break; case BOOST_IOS::cur: next = (pptr() - obeg_) + off; break; case BOOST_IOS::end: next = (oend_ - obeg_) + off; break; default: assert(0); } if (next < 0 || next > (oend_ - obeg_)) throw bad_seek(); pbump(static_cast
(next - (pptr() - obeg_))); result = next; } return offset_to_position(result); } template
void direct_streambuf
::init_input(input) { std::pair
p = input_sequence(*storage_); ibeg_ = p.first; iend_ = p.second; } template
void direct_streambuf
::init_output(output) { std::pair
p = output_sequence(*storage_); obeg_ = p.first; oend_ = p.second; } template
void direct_streambuf
::init_get_area() { setg(ibeg_, ibeg_, iend_); if (one_head() && pptr()) { gbump(static_cast
(pptr() - obeg_)); setp(0, 0); } } template
void direct_streambuf
::init_put_area() { setp(obeg_, oend_); if (one_head() && gptr()) { pbump(static_cast
(gptr() - ibeg_)); setg(0, 0, 0); } } template
inline bool direct_streambuf
::one_head() const { return ibeg_ && obeg_ && ibeg_ == obeg_; } template
inline bool direct_streambuf
::two_head() const { return ibeg_ && obeg_ && ibeg_ != obeg_; } //----------------------------------------------------------------------------// } // End namespace detail. } } // End namespaces iostreams, boost. #include
// MSVC #endif // #ifndef BOOST_IOSTREAMS_DETAIL_DIRECT_STREAMBUF_HPP_INCLUDED
direct_streambuf.hpp
Page URL
File URL
Prev
2/4
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.