Inheritance diagram for std::basic_istream< _CharT, _Traits >:
Public Types | |
typedef _CharT | char_type |
typedef _Traits::int_type | int_type |
typedef _Traits::pos_type | pos_type |
typedef _Traits::off_type | off_type |
typedef _Traits | traits_type |
typedef basic_streambuf< _CharT, _Traits > | __streambuf_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 ctype< _CharT > | __ctype_type |
Public Member Functions | |
basic_istream (__streambuf_type *__sb) | |
Base constructor. | |
virtual | ~basic_istream () |
Base destructor. | |
streamsize | gcount () const |
Character counting. | |
__istream_type & | operator>> (__istream_type &(*__pf)(__istream_type &)) |
Interface for manipulators. | |
__istream_type & | operator>> (__ios_type &(*__pf)(__ios_type &)) |
__istream_type & | operator>> (ios_base &(*__pf)(ios_base &)) |
Arithmetic Extractors | |
All the operator>> functions (aka formatted 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 false. 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.
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. The original exception will then be rethrown. | |
__istream_type & | operator>> (bool &__n) |
Basic arithmetic extractors. | |
__istream_type & | operator>> (short &__n) |
__istream_type & | operator>> (unsigned short &__n) |
__istream_type & | operator>> (int &__n) |
__istream_type & | operator>> (unsigned int &__n) |
__istream_type & | operator>> (long &__n) |
__istream_type & | operator>> (unsigned long &__n) |
__istream_type & | operator>> (float &__f) |
__istream_type & | operator>> (double &__f) |
__istream_type & | operator>> (long double &__f) |
__istream_type & | operator>> (void *&__p) |
__istream_type & | operator>> (__streambuf_type *__sb) |
Extracting into another streambuf. | |
Unformatted Input Functions | |
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. The original exception will then be rethrown. | |
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=1, int_type __delim=traits_type::eof()) |
Discarding characters. | |
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. | |
Protected Member Functions | |
basic_istream () | |
Protected Attributes | |
streamsize | _M_gcount |
Friends | |
class | sentry |
template<typename _CharT2, typename _Traits2> basic_istream< _CharT2, _Traits2 > & | operator>> (basic_istream< _CharT2, _Traits2 > &, _CharT2 &) |
template<typename _CharT2, typename _Traits2> basic_istream< _CharT2, _Traits2 > & | operator>> (basic_istream< _CharT2, _Traits2 > &, _CharT2 *) |
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 59 of file istream.
|
Reimplemented from std::basic_ios< _CharT, _Traits >. |
|
Reimplemented in std::basic_fstream< _CharT, _Traits >. |
|
Reimplemented in std::basic_ifstream< _CharT, _Traits >, std::basic_iostream< _CharT, _Traits >, std::basic_istringstream< _CharT, _Traits, _Alloc >, and std::basic_iostream< char >. |
|
Reimplemented from std::basic_ios< _CharT, _Traits >. |
|
|
|
These are standard types. They permit a standardized way of referring to names of (or names dependant on) the template parameters, which are specific to the implementation. Reimplemented from std::basic_ios< _CharT, _Traits >. Reimplemented in std::strstream, std::basic_ifstream< _CharT, _Traits >, std::basic_fstream< _CharT, _Traits >, std::basic_iostream< _CharT, _Traits >, std::basic_istringstream< _CharT, _Traits, _Alloc >, std::basic_stringstream< _CharT, _Traits, _Alloc >, and std::basic_iostream< char >. Definition at line 63 of file istream. Referenced by std::basic_istream< _CharT, _Traits >::get(), and std::basic_istream< _CharT, _Traits >::getline(). |
|
|
Reimplemented from std::basic_ios< _CharT, _Traits >. Reimplemented in std::strstream, std::basic_ifstream< _CharT, _Traits >, std::basic_fstream< _CharT, _Traits >, std::basic_iostream< _CharT, _Traits >, std::basic_istringstream< _CharT, _Traits, _Alloc >, std::basic_stringstream< _CharT, _Traits, _Alloc >, and std::basic_iostream< char >. Definition at line 66 of file istream. Referenced by std::basic_istream< _CharT, _Traits >::seekg(). |
|
Reimplemented from std::basic_ios< _CharT, _Traits >. Reimplemented in std::strstream, std::basic_ifstream< _CharT, _Traits >, std::basic_fstream< _CharT, _Traits >, std::basic_iostream< _CharT, _Traits >, std::basic_istringstream< _CharT, _Traits, _Alloc >, std::basic_stringstream< _CharT, _Traits, _Alloc >, and std::basic_iostream< char >. Definition at line 65 of file istream. Referenced by std::basic_istream< _CharT, _Traits >::seekg(), and std::basic_istream< _CharT, _Traits >::tellg(). |
|
|
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. |
|
Base destructor. This does very little apart from providing a virtual base dtor. |
|
|
|
Character counting.
|
|
Extraction into another streambuf.
get (sb,widen('')). |
|
Extraction into another streambuf.
If no characters are stored, failbit is set in the stream's error state. Definition at line 542 of file istream.tcc. References std::basic_istream< _CharT, _Traits >::_M_gcount, std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Simple multiple-character extraction.
get (s,n,widen('')). |
|
Simple multiple-character extraction.
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.
Definition at line 503 of file istream.tcc. References std::basic_istream< _CharT, _Traits >::_M_gcount, std::basic_ios< _CharT, _Traits >::_M_setstate(), std::basic_istream< _CharT, _Traits >::char_type, std::ios_base::iostate, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::setstate(), and std::streamsize. |
|
Simple extraction.
Definition at line 471 of file istream.tcc. References std::basic_istream< _CharT, _Traits >::_M_gcount, std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Simple extraction.
Definition at line 440 of file istream.tcc. References std::basic_istream< _CharT, _Traits >::_M_gcount, std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate(). Referenced by std::basic_istream< char >::get(). |
|
String extraction.
getline (s,n,widen('')). |
|
String extraction.
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 581 of file istream.tcc. References std::basic_istream< _CharT, _Traits >::_M_gcount, std::basic_ios< _CharT, _Traits >::_M_setstate(), std::basic_istream< _CharT, _Traits >::char_type, std::ios_base::iostate, std::min(), std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::setstate(), and std::streamsize. Referenced by std::basic_istream< char >::getline(). |
|
Discarding characters.
Definition at line 647 of file istream.tcc. References std::basic_istream< _CharT, _Traits >::_M_gcount, std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::setstate(), and std::streamsize. |
|
Extracting into another streambuf.
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 416 of file istream.tcc. References std::__copy_streambufs(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Definition at line 394 of file istream.tcc. References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Definition at line 372 of file istream.tcc. References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Definition at line 350 of file istream.tcc. References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Definition at line 328 of file istream.tcc. References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Definition at line 260 of file istream.tcc. References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Definition at line 238 of file istream.tcc. References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Definition at line 216 of file istream.tcc. References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Definition at line 185 of file istream.tcc. References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Definition at line 163 of file istream.tcc. References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Definition at line 132 of file istream.tcc. References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Basic arithmetic extractors.
num_get facet) to parse the input data.
Definition at line 110 of file istream.tcc. References std::__check_facet(), std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Definition at line 101 of file istream.tcc. |
|
Definition at line 92 of file istream.tcc. |
|
Interface for manipulators.
Manuipulators such as Definition at line 86 of file istream.tcc. |
|
Looking ahead in the stream.
good() is false, returns traits::eof() . Otherwise reads but does not extract the next input character.
Definition at line 683 of file istream.tcc. References std::basic_istream< _CharT, _Traits >::_M_gcount, std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Unextracting a single character.
rdbuf() is not null, calls rdbuf()->sputbackc(c) .
If
Definition at line 759 of file istream.tcc. References std::basic_istream< _CharT, _Traits >::_M_gcount, std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate(). Referenced by std::operator>>(). |
|
Extraction without delimiters.
good() , extracts characters and stores them into s until one of the following happens:
Definition at line 708 of file istream.tcc. References std::basic_istream< _CharT, _Traits >::_M_gcount, std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::setstate(), and std::streamsize. |
|
Extraction until the buffer is exhausted, but no more.
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 732 of file istream.tcc. References std::basic_istream< _CharT, _Traits >::_M_gcount, std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::setstate(), and std::streamsize. |
|
Changing the current read position.
fail() is not true, calls rdbuf()->pubseekoff(off,dir) . If that function fails, sets failbit.
Definition at line 892 of file istream.tcc. References std::basic_ios< _CharT, _Traits >::_M_setstate(), std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::iostate, std::basic_istream< _CharT, _Traits >::off_type, std::basic_istream< _CharT, _Traits >::pos_type, std::basic_ios< _CharT, _Traits >::rdbuf(), std::ios_base::seekdir, and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Changing the current read position.
fail() is not true, calls rdbuf()->pubseekpos(pos) . If that function fails, sets failbit.
Definition at line 864 of file istream.tcc. References std::basic_ios< _CharT, _Traits >::_M_setstate(), std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::iostate, std::basic_istream< _CharT, _Traits >::off_type, std::basic_istream< _CharT, _Traits >::pos_type, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Synchronizing the stream buffer.
rdbuf() is a null pointer, returns -1.
Otherwise, calls Otherwise, returns 0.
Definition at line 815 of file istream.tcc. References std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate(). |
|
Getting the current read position.
fail() is not false, returns pos_type (-1) to indicate failure. Otherwise returns rdbuf()->pubseekoff(0,cur,in) .
Definition at line 846 of file istream.tcc. References std::basic_ios< _CharT, _Traits >::_M_setstate(), std::basic_ios< _CharT, _Traits >::fail(), std::basic_istream< _CharT, _Traits >::pos_type, and std::basic_ios< _CharT, _Traits >::rdbuf(). |
|
Unextracting the previous character.
rdbuf() is not null, calls rdbuf()->sungetc(c) .
If
Definition at line 787 of file istream.tcc. References std::basic_istream< _CharT, _Traits >::_M_gcount, std::basic_ios< _CharT, _Traits >::_M_setstate(), std::ios_base::iostate, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate(). |
|
|
|
|
|
|
|