X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FMathStream.cpp;h=8677358b55f9c653931781cd9dbb0abd87679c33;hb=4ad2d0e15c998c42110da4119379e5df049203c1;hp=31f69518de7d4a65e67ccc9b73f830e5d506d8f5;hpb=2caa98bee0f735a515f0cdbef6116fceed24a085;p=lyx.git diff --git a/src/mathed/MathStream.cpp b/src/mathed/MathStream.cpp index 31f69518de..8677358b55 100644 --- a/src/mathed/MathStream.cpp +++ b/src/mathed/MathStream.cpp @@ -10,18 +10,22 @@ #include +#include "MathStream.h" + #include "InsetMath.h" #include "MathData.h" #include "MathExtern.h" -#include "MathStream.h" #include "support/textutils.h" +#include "support/docstring.h" #include +#include +#include -namespace lyx { +using namespace std; -using std::strlen; +namespace lyx { ////////////////////////////////////////////////////////////////////// @@ -48,7 +52,7 @@ NormalStream & operator<<(NormalStream & ns, docstring const & s) } -NormalStream & operator<<(NormalStream & ns, const std::string & s) +NormalStream & operator<<(NormalStream & ns, const string & s) { ns.os() << from_utf8(s); return ns; @@ -99,15 +103,15 @@ WriteStream & operator<<(WriteStream & ws, docstring const & s) } -WriteStream::WriteStream(odocstream & os, bool fragile, bool latex) +WriteStream::WriteStream(odocstream & os, bool fragile, bool latex, bool dryrun) : os_(os), fragile_(fragile), firstitem_(false), latex_(latex), - pendingspace_(false), line_(0) + dryrun_(dryrun), pendingspace_(false), textmode_(false), line_(0) {} WriteStream::WriteStream(odocstream & os) : os_(os), fragile_(false), firstitem_(false), latex_(false), - pendingspace_(false), line_(0) + dryrun_(false), pendingspace_(false), textmode_(false), line_(0) {} @@ -130,6 +134,12 @@ void WriteStream::pendingSpace(bool how) } +void WriteStream::textMode(bool textmode) +{ + textmode_ = textmode; +} + + WriteStream & operator<<(WriteStream & ws, MathAtom const & at) { at->write(ws); @@ -152,7 +162,7 @@ WriteStream & operator<<(WriteStream & ws, char const * s) ws.pendingSpace(false); } ws.os() << s; - ws.addlines(int(std::count(s, s + strlen(s), '\n'))); + ws.addlines(int(count(s, s + strlen(s), '\n'))); return ws; } @@ -225,7 +235,7 @@ MathStream & operator<<(MathStream & ms, MTag const & t) { ++ms.tab(); ms.cr(); - ms.os() << '<' << t.tag_ << '>'; + ms.os() << '<' << from_ascii(t.tag_) << '>'; return ms; } @@ -235,7 +245,7 @@ MathStream & operator<<(MathStream & ms, ETag const & t) ms.cr(); if (ms.tab() > 0) --ms.tab(); - ms.os() << "'; + ms.os() << "'; return ms; } @@ -462,7 +472,7 @@ OctaveStream & operator<<(OctaveStream & ns, char_type c) } -OctaveStream & operator<<(OctaveStream & os, std::string const & s) +OctaveStream & operator<<(OctaveStream & os, string const & s) { os.os() << from_utf8(s); return os;