3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * Full author contact details are available in file CREDITS.
8 * Inspired by Dietmar Kuehl's prefix iostreams found on
9 * http://www.inf.uni-konstanz.de/~kuehl/
14 #include "TexStream.h"
22 ////////////////////////////////////////////////////////////////
26 ////////////////////////////////////////////////////////////////
29 class TexStreamBuffer : public TexStreamBase
32 TexStreamBuffer(TexStreamBase * sbuf, TexRow * texrow);
33 int line() const { return line_; }
34 int column() const { return column_; }
41 TexStreamBase * sbuf_;
48 TexStreamBuffer::TexStreamBuffer(TexStreamBase *sb, TexRow * texrow)
49 : sbuf_(sb), texrow_(texrow), line_(0)
55 int TexStreamBuffer::overflow(int c)
67 int TexStreamBuffer::sync()
74 ////////////////////////////////////////////////////////////////
78 ////////////////////////////////////////////////////////////////
80 TexStream::TexStream(TexStreamBase * sbuf, TexRow * texrow)
81 : std::basic_ostream<char_type>(sbuf_ = new TexStreamBuffer(sbuf, texrow))
85 TexStream::~TexStream()
91 int TexStream::line() const
97 ////////////////////////////////////////////////////////////////
101 ////////////////////////////////////////////////////////////////
105 int main(int argc, char *argv[])
107 TexStream out(cout.rdbuf());
113 cout << "line count: " << out.line() << endl;