Inherited by YGP::extStream< std::ifstream > [private], and YGP::extStream< T > [private].
Public Member Functions | |
| extStreambuf () | |
| extStreambuf (std::streambuf &source) | |
| extStreambuf (std::streambuf *source) | |
| virtual | ~extStreambuf () |
Exception-handling | |
| virtual int | overflow (int ch) |
| virtual int | underflow () |
| virtual int | pbackfail (int c) |
Position handling | |
| virtual std::streampos | seekoff (std::streamoff, std::ios_base::seekdir, std::ios_base::openmode mode=std::ios::in|std::ios::out) |
| virtual std::streampos | seekpos (std::streampos pos, std::ios_base::openmode mode=std::ios::in|std::ios::out) |
Setting of data-sink | |
| void | setSource (std::streambuf *source) |
| void | setSource (std::streambuf &source) |
Accessing stream values | |
| unsigned int | getLine () const |
| unsigned int | getColumn () const |
It overcomes two drawbacks of the original streambuf:
| YGP::extStreambuf::extStreambuf | ( | ) |
Defaultconstructor; Although reading from this object should work and should also return some "random" data, to provide a "real" data-sink is highly recommended.
This method might be declared private (or at least protected) in the future.
| YGP::extStreambuf::extStreambuf | ( | std::streambuf & | source | ) |
Constructur; creates an extended streambuf which takes its input from the provided source.
| source | Actual datasink to use |
| YGP::extStreambuf::extStreambuf | ( | std::streambuf * | source | ) |
Constructur; creates an extended streambuf which takes its input from the provided source.
| source | Actual datasink to use |
| YGP::extStreambuf::~extStreambuf | ( | ) | [virtual] |
Destructor.
| unsigned int YGP::extStreambuf::getColumn | ( | ) | const [inline] |
Returns the actual column of the stream read from.
Reimplemented in YGP::extStream< T >, and YGP::extStream< std::ifstream >.
| unsigned int YGP::extStreambuf::getLine | ( | ) | const [inline] |
Returns the actual line of the stream read from.
Reimplemented in YGP::extStream< T >, and YGP::extStream< std::ifstream >.
| int YGP::extStreambuf::overflow | ( | int | ch | ) | [virtual] |
Called if output would cause the streambuf to overrun.
Because this class is designed for input, this method shouldn't be called.
| ch | Char to write, causing the overflow |
| int YGP::extStreambuf::pbackfail | ( | int | c | ) | [virtual] |
Manages the failure of a pushback of a character into the stream.
There are two reasons why this method could be called while pushing back characters:
| c | Character to put back (not EOF) |
| std::streampos YGP::extStreambuf::seekoff | ( | std::streamoff | off, | |
| std::ios_base::seekdir | dir, | |||
| std::ios_base::openmode | mode = std::ios::in|std::ios::out | |||
| ) | [virtual] |
Positionates the read pointer to the passed offset (either starting from the beginning or the end of the stream or from the current position).
| off | Offset to change in the stream | |
| dir | Direction to change offset to | |
| mode | Which pointer to move (get, put) |
| std::streampos YGP::extStreambuf::seekpos | ( | std::streampos | pos, | |
| std::ios_base::openmode | mode = std::ios::in|std::ios::out | |||
| ) | [virtual] |
Positionates the read pointer to the passed position.
| pos | New position in the stream | |
| mode | Which pointer to move (get, put) |
| void YGP::extStreambuf::setSource | ( | std::streambuf & | source | ) | [inline] |
Sets the data sink to read from.
| void YGP::extStreambuf::setSource | ( | std::streambuf * | source | ) | [inline] |
Sets the data sink to read from.
| int YGP::extStreambuf::underflow | ( | ) | [virtual] |
Called if the object doesn't contain data in the input-buffer.
It then copies characters from its data-sink (the streambuf passed while constructing or defined with setSource) til the next line-feed character (10, 0x0a, '
') and sets this data as its input. This method is called automatically and should NOT be used. It also might be declared protected in the future.