X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FTexStream.cpp;h=dc1c43c2a9846c318147e0d24ce9d4092ebc288c;hb=3d4076b598deb18660e50ec9c327efc3b15f15d0;hp=557833dabe8fdb6db5983c36b73f9a9c1013b18b;hpb=31d782b82088ffedd60057fd3061d7258512d81a;p=lyx.git diff --git a/src/TexStream.cpp b/src/TexStream.cpp index 557833dabe..dc1c43c2a9 100644 --- a/src/TexStream.cpp +++ b/src/TexStream.cpp @@ -1,3 +1,16 @@ +/** + * \file TexStream.cpp + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * Full author contact details are available in file CREDITS. + * + * Inspired by Dietmar Kuehl's prefix iostreams found on + * http://www.inf.uni-konstanz.de/~kuehl/ + */ + +#include + #include "TexStream.h" #include "TexRow.h" @@ -16,16 +29,16 @@ namespace lyx { class TexStreamBuffer : public TexStreamBase { public: - TexStreamBuffer(TexStreamBase * sbuf, TexRow * texrow); + TexStreamBuffer(TexStreamBase * sbuf, TexRow * texrow); int line() const { return line_; } int column() const { return column_; } protected: - int overflow(int); - int sync(); + int_type overflow(int_type); + int sync(); private: - TexStreamBase * sbuf_; + TexStreamBase * sbuf_; TexRow * texrow_; int column_; int line_; @@ -35,11 +48,11 @@ private: TexStreamBuffer::TexStreamBuffer(TexStreamBase *sb, TexRow * texrow) : sbuf_(sb), texrow_(texrow), line_(0) { - setp(0, 0); - setg(0, 0, 0); + setp(0, 0); + setg(0, 0, 0); } -int TexStreamBuffer::overflow(int c) +TexStreamBuffer::int_type TexStreamBuffer::overflow(TexStreamBuffer::int_type c) { if (c == '\n') { ++line_; @@ -53,8 +66,8 @@ int TexStreamBuffer::overflow(int c) int TexStreamBuffer::sync() { - sbuf_->pubsync(); - return 0; + sbuf_->pubsync(); + return 0; } @@ -91,17 +104,18 @@ int TexStream::line() const int main(int argc, char *argv[]) { - TexStream out(std::cout.rdbuf()); + TexStream out(cout.rdbuf()); char c; - while (std::cin) { - if (std::cin.get(c)) + while (cin) { + if (cin.get(c)) out.put(c); } - std::cout << "line count: " << out.line() << std::endl; + cout << "line count: " << out.line() << endl; - return 0; + return 0; } #endif } +