Back to Arangodb

Function Template get

3rdParty/boost/1.78.0/libs/iostreams/doc/functions/get.html

3.12.9.13.3 KB
Original Source

Function Template get

OverviewExampleHeadersReference

Overview

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).

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;
        }
    };

Headers

<boost/iostreams/get.hpp><boost/iostreams/operations.hpp>

Reference

Description

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

Synopsis

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

Template Parameters

| | | | Source | - | A model of Source. |

Function Parameters

| | | | src | - | An instance of Source |

Semantics

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>::typesemantics
convertible to direct_tagcompile-time error
convertible to istream_tagreturns src.get()
convertible to streambuf_tag but not to istream_tagreturns src.sbumpc()
otherwiseattempts 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)