std::basic_istream< _CharT, _Traits >
Template class basic_istream.
- Provided by: libstdc++-7-doc (Version: 7.5.0-6ubuntu2)
- Source: gcc-7
- Report a bug
Template class basic_istream.
Inherited by std::basic_ifstream< _CharT, _Traits >.
class sentry
Performs setup work for input streams.
typedef ctype< _CharT > __ctype_type
typedef basic_ios< _CharT, _Traits > __ios_type
typedef basic_istream< _CharT, _Traits > __istream_type
typedef num_get< _CharT, istreambuf_iterator< _CharT,
_Traits > > __num_get_type
typedef basic_streambuf< _CharT, _Traits >
__streambuf_type
typedef _CharT char_type
typedef _Traits::int_type int_type
typedef _Traits::off_type off_type
typedef _Traits::pos_type pos_type
typedef _Traits traits_type
basic_istream (__streambuf_type *__sb)
Base constructor. virtual ~basic_istream ()
Base destructor. template<typename _ValueT > basic_istream<
_CharT, _Traits > & _M_extract (_ValueT &__v)
basic_istream< char > & getline (char_type *__s,
streamsize __n, char_type __delim)
Explicit specialization declarations, defined in src/istream.cc.
basic_istream< wchar_t > & getline (char_type *__s,
streamsize __n, char_type __delim)
basic_istream< char > & ignore (streamsize __n)
basic_istream< wchar_t > & ignore (streamsize
__n)
basic_istream< char > & ignore (streamsize __n,
int_type __delim)
basic_istream< wchar_t > & ignore (streamsize
__n, int_type __delim)
__istream_type & operator>> (__ios_type
&(*__pf)(__ios_type &))
__istream_type & operator>> (__istream_type
&(*__pf)(__istream_type &))
Interface for manipulators. __istream_type &
operator>> (ios_base &(*__pf)(ios_base
&))
streamsize _M_gcount
class sentry
All the unformatted input functions have some common behavior. Each starts by constructing a temporary object of type std::basic_istream::sentry with the second argument (noskipws) set to true. This has several effects, concluding with the setting of a status flag; see the sentry documentation for more.
If the sentry status is good, the function tries to extract whatever data is appropriate for the type of the argument.
The number of characters extracted is stored for later retrieval by gcount().
If an exception is thrown during extraction, ios_base::badbit will
be turned on in the stream's error state (without causing an
ios_base::failure to be thrown) and the original exception will be rethrown
if badbit is set in the exceptions mask.
int_type get ()
Simple extraction. __istream_type & get (char_type &__c)
Simple extraction. __istream_type & get (char_type *__s,
streamsize __n, char_type __delim)
Simple multiple-character extraction. __istream_type & get
(char_type *__s, streamsize __n)
Simple multiple-character extraction. __istream_type & get
(__streambuf_type &__sb, char_type __delim)
Extraction into another streambuf. __istream_type & get
(__streambuf_type &__sb)
Extraction into another streambuf. __istream_type & getline
(char_type *__s, streamsize __n, char_type __delim)
String extraction. __istream_type & getline (char_type *__s,
streamsize __n)
String extraction. __istream_type & ignore
(streamsize __n, int_type __delim)
Discarding characters. __istream_type & ignore
(streamsize __n)
Simple extraction. __istream_type & ignore ()
Simple extraction. int_type peek ()
Looking ahead in the stream. __istream_type & read
(char_type *__s, streamsize __n)
Extraction without delimiters. streamsize readsome (char_type
*__s, streamsize __n)
Extraction until the buffer is exhausted, but no more. __istream_type
& putback (char_type __c)
Unextracting a single character. __istream_type & unget ()
Unextracting the previous character. int sync ()
Synchronizing the stream buffer. pos_type tellg ()
Getting the current read position. __istream_type & seekg
(pos_type)
Changing the current read position. __istream_type & seekg
(off_type, ios_base::seekdir)
Changing the current read position. basic_istream ()
Simple extraction. basic_istream (const basic_istream
&)=delete
Simple extraction. basic_istream (basic_istream &&__rhs)
Simple extraction. basic_istream & operator= (const
basic_istream &)=delete
Simple extraction. basic_istream & operator=
(basic_istream &&__rhs)
Simple extraction. void swap (basic_istream &__rhs)
Simple extraction. template<typename _ValueT > __istream_type
& _M_extract (_ValueT &__v)
Simple extraction.
class std::basic_istream< _CharT, _Traits >" Template class basic_istream.
Template Parameters
This is the base class for all input streams. It provides text formatting of all builtin types, and communicates with any class derived from basic_streambuf to do the actual input.
Definition at line 83 of file iosfwd.
Base constructor. This ctor is almost never called by the user directly, rather from derived classes' initialization lists, which pass a pointer to their own stream buffer.
Definition at line 93 of file istream.
Base destructor. This does very little apart from providing a virtual base dtor.
Definition at line 103 of file istream.
Simple extraction.
Returns
Tries to extract a character. If none are available, sets failbit and returns traits::eof().
Definition at line 606 of file istream.
Simple extraction.
Returns
Tries to extract a character. If none are available, sets failbit and returns traits::eof().
Simple extraction.
Returns
Tries to extract a character. If none are available, sets failbit and returns traits::eof().
Definition at line 613 of file istream.
Simple extraction.
Returns
Tries to extract a character. If none are available, sets failbit and returns traits::eof().
Character counting.
Returns
Definition at line 269 of file istream.
Simple extraction.
Returns
Tries to extract a character. If none are available, sets failbit and returns traits::eof().
Definition at line 244 of file istream.tcc.
Extraction into another streambuf.
Parameters
Returns
Returns get(__sb,widen('\n')).
Definition at line 387 of file istream.
Extraction into another streambuf.
Parameters
Returns
Characters are extracted and inserted into __sb until one of the following happens:
If no characters are stored, failbit is set in the stream's error state.
Definition at line 364 of file istream.tcc.
Simple extraction.
Parameters
Returns
Tries to extract a character and store it in __c. If none are available, sets failbit and returns traits::eof().
Note
Definition at line 280 of file istream.tcc.
Simple multiple-character extraction.
Parameters
Returns
Returns get(__s,__n,widen('\n')).
Definition at line 354 of file istream.
Simple multiple-character extraction.
Parameters
Returns
Characters are extracted and stored into __s until one of the following happens:
If no characters are stored, failbit is set in the stream's error state.
In any case, a null character is stored into the next location in the array.
Note
Definition at line 317 of file istream.tcc.
String extraction.
Parameters
Returns
Returns getline(__s,__n,widen('\n')).
Definition at line 427 of file istream.
String extraction.
Parameters
Returns
Extracts and stores characters into __s until one of the following happens. Note that these criteria are required to be tested in the order listed here, to allow an input line to exactly fill the __s array without setting failbit.
If no characters are extracted, failbit is set. (An empty line of input should therefore not cause failbit to be set.)
In any case, a null character is stored in the next location in the array.
Definition at line 408 of file istream.tcc.
Explicit specialization declarations, defined in src/istream.cc.
Simple extraction.
Returns
Tries to extract a character. If none are available, sets failbit and returns traits::eof().
Definition at line 468 of file istream.tcc.
Simple extraction.
Returns
Tries to extract a character. If none are available, sets failbit and returns traits::eof().
Definition at line 501 of file istream.tcc.
Discarding characters.
Parameters
Returns
Extracts characters and throws them away until one of the following happens:
NB: Provide three overloads, instead of the single function (with defaults) mandated by the Standard: this leads to a better performing implementation, while still conforming to the Standard.
Definition at line 563 of file istream.tcc.
Simple extraction.
Returns
Tries to extract a character. If none are available, sets failbit and returns traits::eof().
Definition at line 625 of file istream.
Simple extraction.
Returns
Tries to extract a character. If none are available, sets failbit and returns traits::eof().
Interface for manipulators. Manipulators such as std::ws and std::dec use these functions in constructs like std::cin >> std::ws. For more information, see the iomanip header.
Definition at line 120 of file istream.
Extracting into another streambuf.
Parameters
This function behaves like one of the basic arithmetic extractors, in that it also constructs a sentry object and has the same error handling behavior.
If __sb is NULL, the stream will set failbit in its error state.
Characters are extracted from this stream and inserted into the __sb streambuf until one of the following occurs:
If the function inserts no characters, failbit is set.
Definition at line 212 of file istream.tcc.
Integer arithmetic extractors.
Parameters
Returns
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
Definition at line 168 of file istream.
Integer arithmetic extractors.
Parameters
Returns
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
Definition at line 218 of file istream.
Floating point arithmetic extractors.
Parameters
Returns
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
Definition at line 214 of file istream.
Integer arithmetic extractors.
Parameters
Returns
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
Definition at line 167 of file istream.tcc.
Integer arithmetic extractors.
Parameters
Returns
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
Definition at line 186 of file istream.
Integer arithmetic extractors.
Parameters
Returns
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
Definition at line 222 of file istream.
Integer arithmetic extractors.
Parameters
Returns
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
Definition at line 195 of file istream.
Integer arithmetic extractors.
Parameters
Returns
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
Definition at line 122 of file istream.tcc.
Integer arithmetic extractors.
Parameters
Returns
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
Definition at line 182 of file istream.
Integer arithmetic extractors.
Parameters
Returns
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
Definition at line 190 of file istream.
Integer arithmetic extractors.
Parameters
Returns
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
Definition at line 199 of file istream.
Integer arithmetic extractors.
Parameters
Returns
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
Definition at line 175 of file istream.
Basic arithmetic extractors.
Parameters
Returns
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
Definition at line 235 of file istream.
Looking ahead in the stream.
Returns
If, after constructing the sentry object, good() is false, returns traits::eof(). Otherwise reads but does not extract the next input character.
Definition at line 628 of file istream.tcc.
Unextracting a single character.
Parameters
Returns
If rdbuf() is not null, calls rdbuf()->sputbackc(c).
If rdbuf() is null or if sputbackc() fails, sets badbit in the error state.
Note
Definition at line 719 of file istream.tcc.
Extraction without delimiters.
Parameters
Returns
If the stream state is good(), extracts characters and stores them into __s until one of the following happens:
Note
Definition at line 658 of file istream.tcc.
Extraction until the buffer is exhausted, but no more.
Parameters
Returns
Extracts characters and stores them into __s depending on the number of characters remaining in the streambuf's buffer, rdbuf()->in_avail(), called A here:
The goal is to empty the current buffer, and to not request any more from the external input sequence controlled by the streambuf.
Definition at line 687 of file istream.tcc.
Changing the current read position.
Parameters
Returns
If fail() is not true, calls rdbuf()->pubseekoff(__off,__dir). If that function fails, sets failbit.
Note
Definition at line 892 of file istream.tcc.
Changing the current read position.
Parameters
Returns
If fail() is not true, calls rdbuf()->pubseekpos(__pos). If that function fails, sets failbit.
Note
Definition at line 853 of file istream.tcc.
Simple extraction.
Returns
Tries to extract a character. If none are available, sets failbit and returns traits::eof().
Definition at line 632 of file istream.
Synchronizing the stream buffer.
Returns
If rdbuf() is a null pointer, returns -1.
Otherwise, calls rdbuf()->pubsync(), and if that returns -1, sets badbit and returns -1.
Otherwise, returns 0.
Note
Definition at line 789 of file istream.tcc.
Getting the current read position.
Returns
If fail() is not false, returns pos_type(-1) to indicate failure. Otherwise returns rdbuf()->pubseekoff(0,cur,in).
Note
Definition at line 825 of file istream.tcc.
Unextracting the previous character.
Returns
If rdbuf() is not null, calls rdbuf()->sungetc(c).
If rdbuf() is null or if sungetc() fails, sets badbit in the error state.
Note
Definition at line 754 of file istream.tcc.
Referenced by std::__detail::operator>>().
The number of characters extracted in the previous unformatted function; see gcount().
Definition at line 82 of file istream.
Referenced by std::basic_istream< char >::get(), std::basic_istream< char >::getline(), std::basic_istream< char >::ignore(), std::basic_istream< char >::peek(), std::basic_istream< char >::putback(), std::basic_istream< char >::read(), std::basic_istream< char >::readsome(), and std::basic_istream< char >::unget().
Generated automatically by Doxygen for libstdc++ from the source code.