3 #include "math_mathmlstream.h"
4 #include "math_inset.h"
5 #include "math_extern.h"
7 #include "support/lyxalgo.h"
10 MathMLStream::MathMLStream(std::ostream & os)
11 : os_(os), tab_(0), line_(0), lastchar_(0)
15 MathMLStream & operator<<(MathMLStream & ms, MathInset const * p)
20 lyxerr << "operator<<(MathMLStream, NULL) called\n";
25 MathMLStream & operator<<(MathMLStream & ms, MathArray const & ar)
32 MathMLStream & operator<<(MathMLStream & ms, char const * s)
39 MathMLStream & operator<<(MathMLStream & ms, char c)
46 MathMLStream & operator<<(MathMLStream & ms, MTag const & t)
50 ms.os() << '<' << t.tag_ << '>';
55 MathMLStream & operator<<(MathMLStream & ms, ETag const & t)
60 ms.os() << "</" << t.tag_ << '>';
65 void MathMLStream::cr()
68 for (int i = 0; i < tab(); ++i)
74 //////////////////////////////////////////////////////////////////////
77 MapleStream & operator<<(MapleStream & ms, MathInset const * p)
82 lyxerr << "operator<<(MapleStream, NULL) called\n";
87 MapleStream & operator<<(MapleStream & ms, MathArray const & ar)
94 MapleStream & operator<<(MapleStream & ms, char const * s)
101 MapleStream & operator<<(MapleStream & ms, char c)
108 MapleStream & operator<<(MapleStream & ms, int i)
115 //////////////////////////////////////////////////////////////////////
118 OctaveStream & operator<<(OctaveStream & ns, MathInset const * p)
123 lyxerr << "operator<<(OctaveStream, NULL) called\n";
128 OctaveStream & operator<<(OctaveStream & ns, MathArray const & ar)
135 OctaveStream & operator<<(OctaveStream & ns, char const * s)
142 OctaveStream & operator<<(OctaveStream & ns, char c)
149 //////////////////////////////////////////////////////////////////////
152 NormalStream & operator<<(NormalStream & ns, MathInset const * p)
157 lyxerr << "operator<<(NormalStream, NULL) called\n";
162 NormalStream & operator<<(NormalStream & ns, MathArray const & ar)
169 NormalStream & operator<<(NormalStream & ns, char const * s)
176 NormalStream & operator<<(NormalStream & ns, char c)
184 //////////////////////////////////////////////////////////////////////
187 WriteStream::WriteStream(std::ostream & os, bool fragile)
188 : os_(os), fragile_(fragile), firstitem_(false), line_(0)
192 WriteStream::WriteStream(std::ostream & os)
193 : os_(os), fragile_(false), firstitem_(false), line_(0)
197 void WriteStream::addlines(unsigned int n)
203 WriteStream & operator<<(WriteStream & ws, MathInset const * p)
208 lyxerr << "operator<<(WriteStream, NULL) called\n";
213 WriteStream & operator<<(WriteStream & ws, MathArray const & ar)
220 WriteStream & operator<<(WriteStream & ws, char const * s)
223 ws.addlines(int(lyx::count(s, s+strlen(s), '\n')));
228 WriteStream & operator<<(WriteStream & ws, char c)
237 WriteStream & operator<<(WriteStream & ws, int i)
244 WriteStream & operator<<(WriteStream & ws, unsigned int i)