]> git.lyx.org Git - lyx.git/blobdiff - src/TexStream.cpp
compil fix.
[lyx.git] / src / TexStream.cpp
index b3d9f50362b28bda4ffdc185973fcdfa83c5c103..9f2fa6d1d107b264db07e4512d07cb948484c65d 100644 (file)
@@ -1,4 +1,15 @@
-#include "LaTeXStream.h"
+/**\r
+ * \file TexStream.cpp\r
+ * This file is part of LyX, the document processor.\r
+ * Licence details can be found in the file COPYING.\r
+ *\r
+ * Full author contact details are available in file CREDITS.\r
+ */\r
+\r
+#include <config.h>\r
+
+#include "TexStream.h"
+#include "TexRow.h"
 
 #include <iostream>
 #include <streambuf>
@@ -7,43 +18,50 @@ namespace lyx {
 
 ////////////////////////////////////////////////////////////////
 //
-// LaTeXStreamBuffer
+// TexStreamBuffer
 //
 ////////////////////////////////////////////////////////////////
 
 
-class LaTeXStreamBuffer : public std::streambuf
+class TexStreamBuffer : public TexStreamBase
 {
 public:
-  explicit LaTeXStreamBuffer(std::streambuf * sbuf);
+  TexStreamBuffer(TexStreamBase * sbuf, TexRow * texrow);
        int line() const { return line_; }
+       int column() const { return column_; }
 
 protected:
   int overflow(int);
   int sync();
 
 private:
-  std::streambuf * sbuf_; 
+  TexStreamBase * sbuf_; 
+       TexRow * texrow_;
+       int column_;
        int line_;
 };
 
 
-LaTeXStreamBuffer::LaTeXStreamBuffer(std::streambuf *sb)
-  : sbuf_(sb), line_(0)
+TexStreamBuffer::TexStreamBuffer(TexStreamBase *sb, TexRow * texrow)
+  : sbuf_(sb), texrow_(texrow), line_(0)
 {
   setp(0, 0);
   setg(0, 0, 0);
 }
 
-int LaTeXStreamBuffer::overflow(int c)
+int TexStreamBuffer::overflow(int c)
 {
-       if (c == '\n')
+       if (c == '\n') {
                ++line_;
+               column_ = 0;
+       } else {
+               ++column_;
+       }
        return c;
 }
 
 
-int LaTeXStreamBuffer::sync()
+int TexStreamBuffer::sync()
 {
   sbuf_->pubsync();
   return 0;
@@ -52,22 +70,22 @@ int LaTeXStreamBuffer::sync()
   
 ////////////////////////////////////////////////////////////////
 //
-// LaTeXStream
+// TexStream
 //
 ////////////////////////////////////////////////////////////////
 
-LaTeXStream::LaTeXStream(std::streambuf * sbuf)
-               : std::ostream(sbuf_ = new LaTeXStreamBuffer(sbuf))
+TexStream::TexStream(TexStreamBase * sbuf, TexRow * texrow)
+               : std::basic_ostream<char_type>(sbuf_ = new TexStreamBuffer(sbuf, texrow))
 {}
 
 
-LaTeXStream::~LaTeXStream()
+TexStream::~TexStream()
 {
        delete sbuf_;
 }
 
 
-int LaTeXStream::line() const
+int TexStream::line() const
 {
        return sbuf_->line();
 }
@@ -83,7 +101,7 @@ int LaTeXStream::line() const
 
 int main(int argc, char *argv[])
 {
-       LaTeXStream out(std::cout.rdbuf());
+       TexStream out(std::cout.rdbuf());
        char c;
        while (std::cin) {
                if (std::cin.get(c))
@@ -97,3 +115,4 @@ int main(int argc, char *argv[])
 #endif
 
 }
+