Library: Foundation
Package: Streams
Header: Poco/CountingStream.h
The base class for CountingInputStream and CountingOutputStream.
This class is needed to ensure the correct initialization order of the stream buffer and base classes.
Direct Base Classes: std::ios
All Base Classes: std::ios
Known Derived Classes: CountingInputStream, CountingOutputStream
Member Functions: chars, getCurrentLineNumber, lines, pos, rdbuf, reset, setCurrentLineNumber
CountingIOS();
Creates the basic stream and leaves it unconnected.
CountingIOS(
std::istream & istr
);
Creates the basic stream and connects it to the given input stream.
CountingIOS(
std::ostream & ostr
);
Creates the basic stream and connects it to the given output stream.
~CountingIOS();
Destroys the stream.
int chars() const;
Returns the total number of characters.
int getCurrentLineNumber() const;
Returns the current line number (same as lines()).
int lines() const;
Returns the total number of lines.
int pos() const;
Returns the number of characters on the current line.
CountingStreamBuf * rdbuf();
Returns a pointer to the underlying streambuf.
void reset();
Resets all counters.
void setCurrentLineNumber(
int line
);
Sets the current line number.
This is mainly useful when parsing C/C++ preprocessed source code containing #line directives.
CountingStreamBuf _buf;