DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
True Drop Box
FTP/SFTP Hosting
Group Account
Team Anywhere
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
|
Cloud-to-Cloud Backup
|
DVR/Camera Backup
FTP, Email & Web Service
FTP/SFTP Hosting
|
Email Hosting
|
Web Hosting
|
Webcam Hosting
Other Products & Services
Team Anywhere
|
Connect to Remote PC
|
Cloud Surveillance
|
Virtual CCTV NVR
Quick Links
Security and Privacy
Customer Support
Service Manual
Use Cases
Group Account
Online Help
Support Forum
Contact Us
About DriveHQ
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
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
Other Features
Team Anywhere (Remote Desktop Service)
CameraFTP Cloud Surveillance
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Team Anywhere for Windows (Beta)
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. #ifndef BOOST_IOSTREAMS_FILTER_TEST_HPP_INCLUDED #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include
// BOOST_MSVC,put size_t in std. #include
#include
// min. #include
// size_t. #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || \ BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) || \ BOOST_WORKAROUND(__MWERKS__, <= 0x3003) \ /**/ # include
// rand. #endif #include
// memcpy, strlen. #include
#include
#include
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && \ !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ !BOOST_WORKAROUND(__MWERKS__, <= 0x3003) \ /**/ # include
# include
#endif #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#undef memcpy #undef rand #undef strlen #if defined(BOOST_NO_STDC_NAMESPACE) && !defined(__LIBCOMO__) namespace std { using ::memcpy; using ::strlen; #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || \ BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) || \ BOOST_WORKAROUND(__MWERKS__, <= 0x3003) \ /**/ using ::rand; #endif } #endif namespace boost { namespace iostreams { BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_string, std::basic_string, 3) const std::streamsize default_increment = 5; #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && \ !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ !BOOST_WORKAROUND(__MWERKS__, <= 0x3003) \ /**/ std::streamsize rand(int inc) { static rand48 random_gen; static uniform_smallint
random_dist(0, inc); return random_dist(random_gen); } #else std::streamsize rand(int inc) { return (std::rand() * inc + 1) / RAND_MAX; } #endif class non_blocking_source { public: typedef char char_type; struct category : source_tag, peekable_tag { }; explicit non_blocking_source( const std::string& data, std::streamsize inc = default_increment ) : data_(data), inc_(inc), pos_(0) { } std::streamsize read(char* s, std::streamsize n) { if (pos_ == static_cast
(data_.size())) return -1; std::streamsize avail = (std::min) (n, static_cast
(data_.size() - pos_)); std::streamsize amt = (std::min) (rand(inc_), avail); if (amt) std::memcpy(s, data_.c_str() + pos_, amt); pos_ += amt; return amt; } bool putback(char c) { if (pos_ > 0) { data_[--pos_] = c; return true; } return false; } private: std::string data_; std::streamsize inc_, pos_; }; class non_blocking_sink : public sink { public: non_blocking_sink( std::string& dest, std::streamsize inc = default_increment ) : dest_(dest), inc_(inc) { } std::streamsize write(const char* s, std::streamsize n) { std::streamsize amt = (std::min) (rand(inc_), n); dest_.insert(dest_.end(), s, s + amt); return amt; } private: non_blocking_sink& operator=(const non_blocking_sink&); std::string& dest_; std::streamsize inc_; }; //--------------Definition of test_input_filter-------------------------------// template
bool test_input_filter( Filter filter, const std::string& input, const std::string& output, mpl::true_ ) { for ( int inc = default_increment; inc < default_increment * 40; inc += default_increment ) { non_blocking_source src(input, inc); std::string dest; iostreams::copy(compose(filter, src), iostreams::back_inserter(dest)); if (dest != output) return false; } return true; } template
bool test_input_filter( Filter filter, const Source1& input, const Source2& output, mpl::false_ ) { std::string in; std::string out; iostreams::copy(input, iostreams::back_inserter(in)); iostreams::copy(output, iostreams::back_inserter(out)); return test_input_filter(filter, in, out); } template
bool test_input_filter( Filter filter, const Source1& input, const Source2& output ) { // Use tag dispatch to compensate for bad overload resolution. return test_input_filter( filter, input, output, is_string
() ); } //--------------Definition of test_output_filter------------------------------// template
bool test_output_filter( Filter filter, const std::string& input, const std::string& output, mpl::true_ ) { for ( int inc = default_increment; inc < default_increment * 40; inc += default_increment ) { array_source src(input.data(), input.data() + input.size()); std::string dest; iostreams::copy(src, compose(filter, non_blocking_sink(dest, inc))); if (dest != output ) return false; } return true; } template
bool test_output_filter( Filter filter, const Source1& input, const Source2& output, mpl::false_ ) { std::string in; std::string out; iostreams::copy(input, iostreams::back_inserter(in)); iostreams::copy(output, iostreams::back_inserter(out)); return test_output_filter(filter, in, out); } template
bool test_output_filter( Filter filter, const Source1& input, const Source2& output ) { // Use tag dispatch to compensate for bad overload resolution. return test_output_filter( filter, input, output, is_string
() ); } //--------------Definition of test_filter_pair--------------------------------// template
bool test_filter_pair( OutputFilter out, InputFilter in, const std::string& data, mpl::true_ ) { for ( int inc = default_increment; inc <= default_increment * 40; inc += default_increment ) { array_source src(data.data(), data.data() + data.size()); std::string temp; std::string dest; iostreams::copy(src, compose(out, non_blocking_sink(temp, inc))); iostreams::copy( compose(in, non_blocking_source(temp, inc)), iostreams::back_inserter(dest) ); if (dest != data) return false; } return true; } template
bool test_filter_pair( OutputFilter out, InputFilter in, const Source& data, mpl::false_ ) { std::string str; iostreams::copy(data, iostreams::back_inserter(str)); return test_filter_pair(out, in, str); } template
bool test_filter_pair( OutputFilter out, InputFilter in, const Source& data ) { // Use tag dispatch to compensate for bad overload resolution. return test_filter_pair(out, in, data, is_string
()); } } } // End namespaces iostreams, boost. #endif // #ifndef BOOST_IOSTREAMS_FILTER_TEST_HPP_INCLUDED
test.hpp
Page URL
File URL
Prev
10/11
Next
Download
( 8 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.