x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
read.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\iostreams\read.hpp
旋转
特效
属性
历史版本
// (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_READ_HPP_INCLUDED #define BOOST_IOSTREAMS_READ_HPP_INCLUDED #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include
// DEDUCED_TYPENAME, MSVC. #include
#include
#include
#include
#include
// streamsize. #include
#include
#include
#include
// Must come last. #include
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //-----------------------------------// # include
#else // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //--------------------------// namespace boost { namespace iostreams { namespace detail { template
struct read_device_impl; template
struct read_filter_impl; } // End namespace detail. template
typename int_type_of
::type get(T& t) { return detail::read_device_impl
::get(detail::unwrap(t)); } template
inline std::streamsize read(T& t, typename char_type_of
::type* s, std::streamsize n) { return detail::read_device_impl
::read(detail::unwrap(t), s, n); } template
std::streamsize read(T& t, Source& src, typename char_type_of
::type* s, std::streamsize n) { return detail::read_filter_impl
::read(detail::unwrap(t), src, s, n); } template
bool putback(T& t, typename char_type_of
::type c) { return detail::read_device_impl
::putback(detail::unwrap(t), c); } //----------------------------------------------------------------------------// namespace detail { // Helper function for adding -1 as EOF indicator. inline std::streamsize check_eof(std::streamsize n) { return n != 0 ? n : -1; } // Helper templates for reading from streambufs. template
struct true_eof_impl; template<> struct true_eof_impl
{ template
static bool true_eof(T& t) { return t.true_eof(); } }; template<> struct true_eof_impl
{ template
static bool true_eof(T&) { return true; } }; template
inline bool true_eof(T& t) { const bool linked = is_linked
::value; return true_eof_impl
::true_eof(t); } //------------------Definition of read_device_impl----------------------------// template
struct read_device_impl : mpl::if_< detail::is_custom
, operations
, read_device_impl< BOOST_DEDUCED_TYPENAME detail::dispatch< T, istream_tag, streambuf_tag, input >::type > >::type { }; template<> struct read_device_impl
{ template
static typename int_type_of
::type get(T& t) { return t.get(); } template
static std::streamsize read(T& t, typename char_type_of
::type* s, std::streamsize n) { return check_eof(t.rdbuf()->sgetn(s, n)); } template
static bool putback(T& t, typename char_type_of
::type c) { typedef typename char_type_of
::type char_type; typedef BOOST_IOSTREAMS_CHAR_TRAITS(char_type) traits_type; return !traits_type::eq_int_type( t.rdbuf()->sputbackc(c), traits_type::eof() ); } }; template<> struct read_device_impl
{ template
static typename int_type_of
::type get(T& t) { // gcc 2.95 needs namespace qualification for char_traits. typedef typename char_type_of
::type char_type; typedef iostreams::char_traits
traits_type; typename int_type_of
::type c; return !traits_type::is_eof(c = t.sbumpc()) || detail::true_eof(t) ? c : traits_type::would_block(); } template
static std::streamsize read(T& t, typename char_type_of
::type* s, std::streamsize n) { std::streamsize amt; return (amt = t.sgetn(s, n)) != 0 ? amt : detail::true_eof(t) ? -1 : 0; } template
static bool putback(T& t, typename char_type_of
::type c) { // gcc 2.95 needs namespace qualification for char_traits. typedef typename char_type_of
::type char_type; typedef iostreams::char_traits
traits_type; return !traits_type::is_eof(t.sputbackc(c)); } }; template<> struct read_device_impl
{ template
static typename int_type_of
::type get(T& t) { // gcc 2.95 needs namespace qualification for char_traits. typedef typename char_type_of
::type char_type; typedef iostreams::char_traits
traits_type; char_type c; std::streamsize amt; return (amt = t.read(&c, 1)) == 1 ? traits_type::to_int_type(c) : amt == -1 ? traits_type::eof() : traits_type::would_block(); } template
static std::streamsize read(T& t, typename char_type_of
::type* s, std::streamsize n) { return t.read(s, n); } template
static bool putback(T& t, typename char_type_of
::type c) { // T must be Peekable. return t.putback(c); } }; //------------------Definition of read_filter_impl----------------------------// template
struct read_filter_impl : mpl::if_< detail::is_custom
, operations
, read_filter_impl< BOOST_DEDUCED_TYPENAME detail::dispatch< T, multichar_tag, any_tag >::type > >::type { }; template<> struct read_filter_impl
{ template
static std::streamsize read (T& t, Source& src, typename char_type_of
::type* s, std::streamsize n) { return t.read(src, s, n); } }; template<> struct read_filter_impl
{ template
static std::streamsize read (T& t, Source& src, typename char_type_of
::type* s, std::streamsize n) { // gcc 2.95 needs namespace qualification for char_traits. typedef typename char_type_of
::type char_type; typedef iostreams::char_traits
traits_type; for (std::streamsize off = 0; off < n; ++off) { typename traits_type::int_type c = t.get(src); if (traits_type::is_eof(c)) return check_eof(off); if (traits_type::would_block(c)) return off; s[off] = traits_type::to_char_type(c); } return n; } }; } // End namespace detail. } } // End namespaces iostreams, boost. #endif // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //-------------------------// #include
#endif // #ifndef BOOST_IOSTREAMS_READ_HPP_INCLUDED
read.hpp
网页地址
文件地址
上一页
27/37
下一页
下载
( 7 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.