2001-11-07 17:30:26 +00:00
|
|
|
|
|
|
|
#include "math_inset.h"
|
|
|
|
#include "math_mathmlstream.h"
|
2001-11-09 08:35:57 +00:00
|
|
|
#include "math_extern.h"
|
2001-11-09 16:27:44 +00:00
|
|
|
#include "debug.h"
|
2001-11-07 17:30:26 +00:00
|
|
|
|
|
|
|
|
2001-11-08 12:06:56 +00:00
|
|
|
MathMLStream::MathMLStream(std::ostream & os)
|
|
|
|
: os_(os), tab_(0), line_(0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2001-11-07 17:30:26 +00:00
|
|
|
MathMLStream & MathMLStream::operator<<(MathInset const * p)
|
|
|
|
{
|
2001-11-09 16:27:44 +00:00
|
|
|
if (p)
|
|
|
|
p->mathmlize(*this);
|
|
|
|
else
|
|
|
|
lyxerr << "MathMLStream::operator<<(NULL) called\n";
|
2001-11-07 17:30:26 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MathMLStream & MathMLStream::operator<<(MathArray const & ar)
|
|
|
|
{
|
2001-11-09 08:35:57 +00:00
|
|
|
mathmlize(ar, *this);
|
2001-11-07 17:30:26 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MathMLStream & MathMLStream::operator<<(char const * s)
|
|
|
|
{
|
|
|
|
os_ << s;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MathMLStream & MathMLStream::operator<<(char c)
|
|
|
|
{
|
|
|
|
os_ << c;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-08 12:06:56 +00:00
|
|
|
MathMLStream & MathMLStream::operator<<(MTag const & t)
|
|
|
|
{
|
|
|
|
++tab_;
|
|
|
|
cr();
|
|
|
|
os_ << '<' << t.tag_ << '>';
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MathMLStream & MathMLStream::operator<<(ETag const & t)
|
|
|
|
{
|
|
|
|
cr();
|
|
|
|
if (tab_ > 0)
|
|
|
|
--tab_;
|
|
|
|
os_ << "</" << t.tag_ << '>';
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathMLStream::cr()
|
|
|
|
{
|
|
|
|
os_ << '\n';
|
|
|
|
for (int i = 0; i < tab_; ++i)
|
|
|
|
os_ << ' ';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2001-11-07 17:30:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
MapleStream & MapleStream::operator<<(MathInset const * p)
|
|
|
|
{
|
2001-11-09 16:27:44 +00:00
|
|
|
if (p)
|
|
|
|
p->maplize(*this);
|
|
|
|
else
|
|
|
|
lyxerr << "MathMLStream::operator<<(NULL) called\n";
|
2001-11-07 17:30:26 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MapleStream & MapleStream::operator<<(MathArray const & ar)
|
|
|
|
{
|
2001-11-09 08:35:57 +00:00
|
|
|
maplize(ar, *this);
|
2001-11-07 17:30:26 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MapleStream & MapleStream::operator<<(char const * s)
|
|
|
|
{
|
|
|
|
os_ << s;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MapleStream & MapleStream::operator<<(char c)
|
|
|
|
{
|
|
|
|
os_ << c;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
MapleStream & MapleStream::operator<<(int i)
|
|
|
|
{
|
|
|
|
os_ << i;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2001-11-07 17:30:26 +00:00
|
|
|
|
2001-11-08 12:06:56 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-11-07 17:30:26 +00:00
|
|
|
|
|
|
|
OctaveStream & OctaveStream::operator<<(MathInset const * p)
|
|
|
|
{
|
2001-11-09 16:27:44 +00:00
|
|
|
if (p)
|
|
|
|
p->octavize(*this);
|
|
|
|
else
|
|
|
|
lyxerr << "MathMLStream::operator<<(NULL) called\n";
|
2001-11-07 17:30:26 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OctaveStream & OctaveStream::operator<<(MathArray const & ar)
|
|
|
|
{
|
2001-11-09 08:35:57 +00:00
|
|
|
octavize(ar, *this);
|
2001-11-07 17:30:26 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OctaveStream & OctaveStream::operator<<(char const * s)
|
|
|
|
{
|
|
|
|
os_ << s;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OctaveStream & OctaveStream::operator<<(char c)
|
|
|
|
{
|
|
|
|
os_ << c;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2001-11-08 12:06:56 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
NormalStream & NormalStream::operator<<(MathInset const * p)
|
|
|
|
{
|
2001-11-09 16:27:44 +00:00
|
|
|
if (p)
|
|
|
|
p->normalize(*this);
|
|
|
|
else
|
|
|
|
lyxerr << "MathMLStream::operator<<(NULL) called\n";
|
2001-11-08 12:06:56 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NormalStream & NormalStream::operator<<(MathArray const & ar)
|
|
|
|
{
|
2001-11-09 08:35:57 +00:00
|
|
|
normalize(ar, *this);
|
2001-11-08 12:06:56 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NormalStream & NormalStream::operator<<(char const * s)
|
|
|
|
{
|
|
|
|
os_ << s;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NormalStream & NormalStream::operator<<(char c)
|
|
|
|
{
|
|
|
|
os_ << c;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
WriteStream::WriteStream
|
2001-11-08 12:06:56 +00:00
|
|
|
(Buffer const * buffer_, std::ostream & os_, bool fragile_)
|
|
|
|
: buffer(buffer_), os(os_), fragile(fragile_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
WriteStream::WriteStream(std::ostream & os_)
|
2001-11-08 12:06:56 +00:00
|
|
|
: buffer(0), os(os_), fragile(false)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
WriteStream & WriteStream::operator<<(MathInset const * p)
|
2001-11-08 12:06:56 +00:00
|
|
|
{
|
2001-11-09 16:27:44 +00:00
|
|
|
if (p)
|
|
|
|
p->write(*this);
|
|
|
|
else
|
|
|
|
lyxerr << "MathMLStream::operator<<(NULL) called\n";
|
2001-11-08 12:06:56 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
WriteStream & WriteStream::operator<<(MathArray const & ar)
|
2001-11-08 12:06:56 +00:00
|
|
|
{
|
2001-11-09 08:35:57 +00:00
|
|
|
write(ar, *this);
|
2001-11-08 12:06:56 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
WriteStream & WriteStream::operator<<(char const * s)
|
2001-11-08 12:06:56 +00:00
|
|
|
{
|
|
|
|
os << s;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
WriteStream & WriteStream::operator<<(char c)
|
2001-11-08 12:06:56 +00:00
|
|
|
{
|
|
|
|
os << c;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|