3rdParty/boost/1.78.0/libs/iostreams/doc/functions/get.html
getOverviewExampleHeadersReference
The function template get provides a uniform interface for reading a character from a Source, for use in the definitions of new Filter types (see Example).
The following code illustrates the use of the function get in the definition of an InputFilter.
#include\<ctype.h\>// tolower#include[\<boost/iostreams/concepts.hpp\>](../../../../boost/iostreams/concepts.hpp)// input\_filter#include[\<boost/iostreams/operations.hpp\>](../../../../boost/iostreams/operations.hpp)// get, EOF, WOULD\_BLOCKusingnamespacestd;usingnamespaceboost::io;structtolower_filter :publicinput_filter {template<typenameSource>intget(Source& src)
{intc;return(c = boost::iostreams::get(src)) !=EOF&&
c != WOULD_BLOCK
?
tolower((unsignedchar) c) :
c;
}
};
<boost/iostreams/get.hpp><boost/iostreams/operations.hpp>
Attemps to extract a character from a given instance of the template parameter Source, returning the extracted character or one of the special values traits_type::eof or traits_type::would_block, where traits_type is an appropriate specialization of boost::iostreams::char_traits
namespaceboost {namespaceiostreams {template<typename[Source](#template_params)>typename[int\_type\_of](../guide/traits.html#int_type_of_ref)<Source>::type[get](#semantics)([Source](#template_params)&[src](#function_params));
} }// End namespace boost::io
| | | | Source | - | A model of Source. |
|
| |
| src | - | An instance of Source |
template<typenameSource>typenameint_type_of<Source>::type
get(Source& src);
The semantics of get depends on the category of Source as follows:
category_of<Source>::type | semantics |
|---|---|
convertible to direct_tag | compile-time error |
convertible to istream_tag | returns src.get() |
convertible to streambuf_tag but not to istream_tag | returns src.sbumpc() |
| otherwise | attempts to extract a single character using src.read(), returning the extracted character if successful and one of the special values traits_type::eof or traits_type::would_block otherwise, where traits_type is boost::iostreams::char_traits<Source> |
© Copyright 2008 CodeRage, LLC
© Copyright 2004-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)