Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/io/basic streambuf/uflow"

From cppreference.com
< cpp‎ | io‎ | basic streambuf
(+)
 
m
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{cpp/io/basic_streambuf/title|uflow}}
 
{{cpp/io/basic_streambuf/title|uflow}}
{{cpp/io/basic_streambuf/sidebar}}
+
{{cpp/io/basic_streambuf/}}
 
{{ddcl | 1=
 
{{ddcl | 1=
int_type uflow();
+
 +
int_type uflow();
 
}}
 
}}
  
Ensures that at least one character is available in the input area by updating the pointers to the input area (if needed). On success returns the value of that character and advances the value of the ''get pointer'' by one character. On failure returns {{cpp|traits::eof()}}.  
+
Ensures that at least one character is available in the input area by updating the pointers to the input area (if needed). On success returns the value of that character and advances the value of the ''get pointer'' by one character. On failure returns {{|traits::eof()}}.  
  
The function may update {{tt|gptr}}, {{tt|egptr}} and {{tt|eback}} pointers to define the location of newly loaded data (if any). On failure, the function ensures that either {{cpp|gptr() {{==}} nullptr}} or {{cpp|gptr() {{==}} egptr}}.
+
The function may update {{tt|gptr}}, {{tt|egptr}} and {{tt|eback}} pointers to define the location of newly loaded data (if any). On failure, the function ensures that either {{|gptr() {{==}} nullptr}} or {{|gptr() {{==}} egptr}}.
  
The base class version of the function calls {{rlpt|underflow}}. The derived classes may override this function to allow updates to the get area in the case of exhaustion.
+
The base class version of the function calls {{|underflow}}.  
  
 
===Parameters===
 
===Parameters===
Line 15: Line 16:
  
 
===Return value===
 
===Return value===
The value of the character pointed to by the ''get pointer'' after the call on success, or {{cpp|traits::eof()}} otherwise.
+
The value of the character pointed to by the ''get pointer'' , or {{|traits::eof()}} otherwise.
  
The base class version of the function returns the value returned by {{rlpt|underflow}}.
+
The base class version of the function returns the value returned by {{|underflow}}.
  
 
===Note===
 
===Note===
The public functions of {{cpp|std::streambuf}} call this function only if {{cpp|gptr() == nullptr}} or {{cpp|gptr() >= egptr()}}.
+
The public functions of {{|std::streambuf}} call this function only if {{|gptr() == nullptr}} or {{|gptr() >= egptr()}}
 +
 
 +
.
  
 
===Example===
 
===Example===
{{example cpp|
+
{{example|
 
  | code=
 
  | code=
 
  | output=
 
  | output=
Line 29: Line 32:
  
 
===See also===
 
===See also===
{{dcl list begin}}
+
{{begin}}
{{dcl list template | cpp/io/basic_streambuf/dcl list underflow}}
+
{{| cpp/io/basic_streambuf/underflow}}
{{dcl list template | cpp/io/basic_streambuf/dcl list overflow}}
+
{{| cpp/io/basic_streambuf/overflow}}
{{dcl list end}}
+
{{end}}
 +
 
 +
 +
 +
 +
 +
 +
 +
 +

Latest revision as of 19:42, 4 December 2020

 
 
 
 
protected:
virtual int_type uflow();

Ensures that at least one character is available in the input area by updating the pointers to the input area (if needed). On success returns the value of that character and advances the value of the get pointer by one character. On failure returns traits::eof().

The function may update gptr, egptr and eback pointers to define the location of newly loaded data (if any). On failure, the function ensures that either gptr() == nullptr or gptr() == egptr.

The base class version of the function calls underflow() and increments gptr().

Contents

[edit] Parameters

(none)

[edit] Return value

The value of the character that was pointed to by the get pointer before it was advanced by one, or traits::eof() otherwise.

The base class version of the function returns the value returned by underflow().

[edit] Note

The public functions of std::streambuf call this function only if gptr() == nullptr or gptr() >= egptr().

The custom streambuf classes that do not use the get area and do not set the get area pointers in basic_streambuf are required to override this function.

[edit] Example

[edit] See also

[virtual]
reads characters from the associated input sequence to the get area
(virtual protected member function) [edit]
[virtual]
writes characters to the associated output sequence from the put area
(virtual protected member function) [edit]