1 #include "LaTeXStream.h"
8 ////////////////////////////////////////////////////////////////
12 ////////////////////////////////////////////////////////////////
15 class LaTeXStreamBuffer : public std::streambuf
18 explicit LaTeXStreamBuffer(std::streambuf * sbuf);
19 int line() const { return line_; }
26 std::streambuf * sbuf_;
31 LaTeXStreamBuffer::LaTeXStreamBuffer(std::streambuf *sb)
38 int LaTeXStreamBuffer::overflow(int c)
46 int LaTeXStreamBuffer::sync()
53 ////////////////////////////////////////////////////////////////
57 ////////////////////////////////////////////////////////////////
59 LaTeXStream::LaTeXStream(std::streambuf * sbuf)
60 : std::ostream(sbuf_ = new LaTeXStreamBuffer(sbuf))
64 LaTeXStream::~LaTeXStream()
70 int LaTeXStream::line() const
76 ////////////////////////////////////////////////////////////////
80 ////////////////////////////////////////////////////////////////
84 int main(int argc, char *argv[])
86 LaTeXStream out(std::cout.rdbuf());
92 std::cout << "line count: " << out.line() << std::endl;