Poco

class CountingIOS

File Information

Library: Foundation
Package: Streams
Header: Poco/CountingStream.h

Description

The base class for CountingInputStream and CountingOutputStream.

This class is needed to ensure the correct initialization order of the stream buffer and base classes.

Inheritance

Direct Base Classes: std::ios

All Base Classes: std::ios

Known Derived Classes: CountingInputStream, CountingOutputStream

Member Summary

Member Functions: addChars, addLines, addPos, chars, getCurrentLineNumber, lines, pos, rdbuf, reset, setCurrentLineNumber

Constructors

CountingIOS

CountingIOS();

Creates the basic stream and leaves it unconnected.

CountingIOS

CountingIOS(
    std::istream & istr
);

Creates the basic stream and connects it to the given input stream.

CountingIOS

CountingIOS(
    std::ostream & ostr
);

Creates the basic stream and connects it to the given output stream.

Destructor

~CountingIOS

~CountingIOS();

Destroys the stream.

Member Functions

addChars

void addChars(
    std::streamsize chars
);

Add to the total number of characters.

addLines

void addLines(
    std::streamsize lines
);

Add to the total number of lines.

addPos

void addPos(
    std::streamsize pos
);

Add to the number of characters on the current line.

chars inline

std::streamsize chars() const;

Returns the total number of characters.

getCurrentLineNumber inline

std::streamsize getCurrentLineNumber() const;

Returns the current line number (same as lines()).

lines inline

std::streamsize lines() const;

Returns the total number of lines.

pos inline

std::streamsize pos() const;

Returns the number of characters on the current line.

rdbuf

CountingStreamBuf * rdbuf();

Returns a pointer to the underlying streambuf.

reset

void reset();

Resets all counters.

setCurrentLineNumber

void setCurrentLineNumber(
    std::streamsize line
);

Sets the current line number.

This is mainly useful when parsing C/C++ preprocessed source code containing #line directives.

Variables

_buf protected

CountingStreamBuf _buf;

Securely control IoT edge devices from anywhere   Connect a Device