home | help
std::strstr...::pbackfail(3)   C++ Standard Libary  std::strstr...::pbackfail(3)

NAME
     std::strstreambuf::pbackfail - std::strstreambuf::pbackfail

Synopsis
	protected:					 (deprecated in C++98)
	virtual int_type pbackfail( int_type c = EOF );  (removed in C++26)

	This protected virtual function is called by the public functions
	basic_streambuf::sungetc and basic_streambuf::sputbackc (which, in turn,
     are called
	by basic_istream::unget and basic_istream::putback).

	1)  The caller is requesting that the get area is backed up by one char-
     acter
	(pbackfail() is called with no arguments or with EOF as the argument)
	a) First, checks if there is a putback position,  and  if  there  really
     isn't, fails
	(strstreambuf has no external character source to re-read).
	b)  If	the  caller was wrong and the putback position is in fact avail-
     able, simply
	decrements basic_streambuf::gptr(), e.g. by calling gbump(-1).
	2) The caller attempts to putback a different character from the one re-
     trieved
	earlier (pbackfail() is called with the character that needs to  be  put
     back), in
	which case
	a)  First,  checks  if	there is a putback position, and if there isn't,
     fails.
	b) Then checks what character is in the putback position. If the charac-
     ter held
	there is already equal to (char)c, then simply decrements  basic_stream-
     buf::gptr().
	c)  Otherwise, if the buffer is unmodifiable (this strstreambuf was con-
     structed with
	a string literal or some other const array), fails.
	d) Otherwise, decrements basic_streambuf::gptr() and writes c to the lo-
     cation
	pointed to gptr() after adjustment.

Parameters
	c - the character to put back, or Traits::eof() to indicate that backing
     up of the
	    get area is requested

Return value
	c on success except if c was EOF, in which case unspecified value  other
     than EOF is
	returned.

	EOF on failure.

Example
	 This section is incomplete
	 Reason: no example

See also
		  puts	a character back into the input sequence, possibly modi-
     fying the
	pbackfail input sequence
	[virtual]  (virtual  protected	member	function  of  std::basic_stream-
     buf<CharT,Traits>)

	sungetc   moves the next pointer in the input sequence back by one
		  (public member function of std::basic_streambuf<CharT,Traits>)
	sputbackc puts one character back in the input sequence
		  (public member function of std::basic_streambuf<CharT,Traits>)
	unget	  unextracts a character
		  (public member function of std::basic_istream<CharT,Traits>)
	putback   puts a character into input stream
		  (public member function of std::basic_istream<CharT,Traits>)

Category:
	  * Todo no example

http://cppreference.com 	   2024.06.10	    std::strstr...::pbackfail(3)

home | help