class Poco::CountingInputStream

Overview

This stream counts all characters and lines going through it. Moreā€¦

#include <CountingStream.h>

class CountingInputStream:
    public Poco::CountingIOS,
    public istream
{
public:
    // construction

    CountingInputStream(std::istream& istr);
};

Inherited Members

public:
    // methods

    int
    chars() const;

    int
    lines() const;

    int
    pos() const;

    void
    reset();

    void
    setCurrentLineNumber(int line);

    int
    getCurrentLineNumber() const;

    void
    addChars(int chars);

    void
    addLines(int lines);

    void
    addPos(int pos);

    CountingStreamBuf*
    rdbuf();

protected:
    // fields

    CountingStreamBuf _buf;

Detailed Documentation

This stream counts all characters and lines going through it.

This is useful for lexers and parsers that need to determine the current position in the stream.

Construction

CountingInputStream(std::istream& istr)

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