x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
invert.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\iostreams\invert.hpp
旋转
特效
属性
历史版本
// (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_INVERT_HPP_INCLUDED #define BOOST_IOSTREAMS_INVERT_HPP_INCLUDED #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include
// copy, min. #include
#include
// BOOST_DEDUCED_TYPENAME. #include
// default_filter_buffer_size. #include
#include
#include
#include
#include
#include
#include
#include
// clear_flags, call_reset #include
#include
#include
#include
// Must come last. #include
// MSVC. namespace boost { namespace iostreams { // // Template name: inverse. // Template paramters: // Filter - A model of InputFilter or OutputFilter. // Description: Generates an InputFilter from an OutputFilter or // vice versa. // template
class inverse { private: typedef typename category_of
::type base_category; typedef reference_wrapper
filter_ref; public: typedef typename char_type_of
::type char_type; typedef typename int_type_of
::type int_type; typedef char_traits
traits_type; typedef typename mpl::if_< is_convertible< base_category, input >, output, input >::type mode; struct category : mode, filter_tag, multichar_tag, closable_tag { }; explicit inverse( const Filter& filter, std::streamsize buffer_size = default_filter_buffer_size) : pimpl_(new impl(filter, buffer_size)) { } template
std::streamsize read(Source& src, char* s, std::streamsize n) { typedef detail::counted_array_sink
array_sink; typedef composite
filtered_array_sink; assert((flags() & f_write) == 0); if (flags() == 0) { flags() = f_read; buf().set(0, 0); } filtered_array_sink snk(filter(), array_sink(s, n)); int_type status; for ( status = traits_type::good(); snk.second().count() < n && status == traits_type::good(); ) { status = buf().fill(src); buf().flush(snk); } return snk.second().count() == 0 && status == traits_type::eof() ? -1 : snk.second().count(); } template
std::streamsize write(Sink& dest, const char* s, std::streamsize n) { typedef detail::counted_array_source
array_source; typedef composite
filtered_array_source; assert((flags() & f_read) == 0); if (flags() == 0) { flags() = f_write; buf().set(0, 0); } filtered_array_source src(filter(), array_source(s, n)); for (bool good = true; src.second().count() < n && good; ) { buf().fill(src); good = buf().flush(dest); } return src.second().count(); } template
void close(Device& dev) { detail::execute_all( detail::flush_buffer(buf(), dev, (flags() & f_write) != 0), detail::call_close_all(pimpl_->filter_, dev), detail::clear_flags(flags()) ); } private: filter_ref filter() { return boost::ref(pimpl_->filter_); } detail::buffer
& buf() { return pimpl_->buf_; } int& flags() { return pimpl_->flags_; } enum flags_ { f_read = 1, f_write = 2 }; struct impl { impl(const Filter& filter, std::streamsize n) : filter_(filter), buf_(n), flags_(0) { buf_.set(0, 0); } Filter filter_; detail::buffer
buf_; int flags_; }; shared_ptr
pimpl_; }; // // Template name: invert. // Template paramters: // Filter - A model of InputFilter or OutputFilter. // Description: Returns an instance of an appropriate specialization of inverse. // template
inverse
invert(const Filter& f) { return inverse
(f); } //----------------------------------------------------------------------------// } } // End namespaces iostreams, boost. #include
// MSVC. #endif // #ifndef BOOST_IOSTREAMS_INVERT_HPP_INCLUDED
invert.hpp
网页地址
文件地址
上一页
18/37
下一页
下载
( 5 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.