2001-11-08 12:06:56 +00:00
|
|
|
#ifndef MATH_MATHMLSTREAM_H
|
|
|
|
#define MATH_MATHMLSTREAM_H
|
2001-11-07 17:30:26 +00:00
|
|
|
|
2001-12-02 17:03:46 +00:00
|
|
|
|
2001-12-03 16:24:50 +00:00
|
|
|
// Please keep all four streams in one file until the interface has
|
|
|
|
// settled.
|
|
|
|
|
2001-11-07 17:30:26 +00:00
|
|
|
|
2001-12-02 17:03:46 +00:00
|
|
|
#include <iosfwd>
|
|
|
|
|
2001-12-03 16:24:50 +00:00
|
|
|
class MathArray;
|
|
|
|
class MathInset;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// MathML
|
|
|
|
//
|
2001-11-07 17:30:26 +00:00
|
|
|
|
2001-11-08 12:06:56 +00:00
|
|
|
struct MTag {
|
2001-11-07 17:30:26 +00:00
|
|
|
///
|
2001-11-08 12:06:56 +00:00
|
|
|
MTag(char const * const tag) : tag_(tag) {}
|
2001-11-07 17:30:26 +00:00
|
|
|
///
|
2001-11-08 12:06:56 +00:00
|
|
|
char const * const tag_;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ETag {
|
|
|
|
///
|
|
|
|
ETag(char const * const tag) : tag_(tag) {}
|
|
|
|
///
|
|
|
|
char const * const tag_;
|
|
|
|
};
|
|
|
|
|
2001-12-03 16:24:50 +00:00
|
|
|
class MathMLStream {
|
|
|
|
public:
|
2001-11-08 12:06:56 +00:00
|
|
|
///
|
|
|
|
explicit MathMLStream(std::ostream & os);
|
2001-11-07 17:30:26 +00:00
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
void cr();
|
2001-11-07 17:30:26 +00:00
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
std::ostream & os() { return os_; }
|
2001-11-08 12:06:56 +00:00
|
|
|
///
|
2002-01-11 15:23:10 +00:00
|
|
|
int line() const { return line_; }
|
2001-11-08 12:06:56 +00:00
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
int & tab() { return tab_; }
|
2002-01-11 15:23:10 +00:00
|
|
|
///
|
|
|
|
friend MathMLStream & operator<<(MathMLStream &, char const *);
|
2001-12-03 16:24:50 +00:00
|
|
|
private:
|
2001-11-08 12:06:56 +00:00
|
|
|
///
|
|
|
|
std::ostream & os_;
|
|
|
|
///
|
|
|
|
int tab_;
|
|
|
|
///
|
|
|
|
int line_;
|
2001-11-09 18:02:20 +00:00
|
|
|
///
|
|
|
|
char lastchar_;
|
2001-11-08 12:06:56 +00:00
|
|
|
};
|
|
|
|
|
2001-12-03 16:24:50 +00:00
|
|
|
///
|
|
|
|
MathMLStream & operator<<(MathMLStream &, MathInset const *);
|
|
|
|
///
|
|
|
|
MathMLStream & operator<<(MathMLStream &, MathArray const &);
|
|
|
|
///
|
|
|
|
MathMLStream & operator<<(MathMLStream &, char const *);
|
|
|
|
///
|
|
|
|
MathMLStream & operator<<(MathMLStream &, char);
|
|
|
|
///
|
|
|
|
MathMLStream & operator<<(MathMLStream &, MTag const &);
|
|
|
|
///
|
|
|
|
MathMLStream & operator<<(MathMLStream &, ETag const &);
|
|
|
|
|
2001-11-08 12:06:56 +00:00
|
|
|
|
2001-12-03 16:24:50 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Debugging
|
|
|
|
//
|
|
|
|
|
|
|
|
class NormalStream {
|
|
|
|
public:
|
2001-11-08 12:06:56 +00:00
|
|
|
///
|
|
|
|
explicit NormalStream(std::ostream & os) : os_(os) {}
|
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
std::ostream & os() { return os_; }
|
|
|
|
private:
|
2001-11-08 12:06:56 +00:00
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
std::ostream & os_;
|
2001-11-07 17:30:26 +00:00
|
|
|
};
|
|
|
|
|
2001-12-03 16:24:50 +00:00
|
|
|
///
|
|
|
|
NormalStream & operator<<(NormalStream &, MathInset const *);
|
|
|
|
///
|
|
|
|
NormalStream & operator<<(NormalStream &, MathArray const &);
|
|
|
|
///
|
|
|
|
NormalStream & operator<<(NormalStream &, char const *);
|
|
|
|
///
|
|
|
|
NormalStream & operator<<(NormalStream &, char);
|
2002-07-11 09:34:58 +00:00
|
|
|
///
|
|
|
|
NormalStream & operator<<(NormalStream &, int);
|
2001-12-03 16:24:50 +00:00
|
|
|
|
|
|
|
|
2001-11-07 17:30:26 +00:00
|
|
|
|
2001-12-03 16:24:50 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Maple
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
class MapleStream {
|
|
|
|
public:
|
2001-11-07 17:30:26 +00:00
|
|
|
///
|
|
|
|
explicit MapleStream(std::ostream & os) : os_(os) {}
|
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
std::ostream & os() { return os_; }
|
|
|
|
private:
|
2001-11-07 17:30:26 +00:00
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
std::ostream & os_;
|
2001-11-07 17:30:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-12-03 16:24:50 +00:00
|
|
|
///
|
|
|
|
MapleStream & operator<<(MapleStream &, MathInset const *);
|
|
|
|
///
|
|
|
|
MapleStream & operator<<(MapleStream &, MathArray const &);
|
|
|
|
///
|
|
|
|
MapleStream & operator<<(MapleStream &, char const *);
|
|
|
|
///
|
|
|
|
MapleStream & operator<<(MapleStream &, char);
|
|
|
|
///
|
|
|
|
MapleStream & operator<<(MapleStream &, int);
|
|
|
|
|
|
|
|
|
2002-07-01 11:17:14 +00:00
|
|
|
//
|
|
|
|
// Mathematica
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
class MathematicaStream {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
explicit MathematicaStream(std::ostream & os) : os_(os) {}
|
|
|
|
///
|
|
|
|
std::ostream & os() { return os_; }
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
std::ostream & os_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
MathematicaStream & operator<<(MathematicaStream &, MathInset const *);
|
|
|
|
///
|
|
|
|
MathematicaStream & operator<<(MathematicaStream &, MathArray const &);
|
|
|
|
///
|
|
|
|
MathematicaStream & operator<<(MathematicaStream &, char const *);
|
|
|
|
///
|
|
|
|
MathematicaStream & operator<<(MathematicaStream &, char);
|
|
|
|
///
|
|
|
|
MathematicaStream & operator<<(MathematicaStream &, int);
|
|
|
|
|
|
|
|
|
2001-12-03 16:24:50 +00:00
|
|
|
//
|
|
|
|
// Octave
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
class OctaveStream {
|
|
|
|
public:
|
2001-11-07 17:30:26 +00:00
|
|
|
///
|
|
|
|
explicit OctaveStream(std::ostream & os) : os_(os) {}
|
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
std::ostream & os() { return os_; }
|
|
|
|
private:
|
2001-11-07 17:30:26 +00:00
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
std::ostream & os_;
|
2001-11-07 17:30:26 +00:00
|
|
|
};
|
|
|
|
|
2001-12-03 16:24:50 +00:00
|
|
|
///
|
|
|
|
OctaveStream & operator<<(OctaveStream &, MathInset const *);
|
|
|
|
///
|
|
|
|
OctaveStream & operator<<(OctaveStream &, MathArray const &);
|
|
|
|
///
|
|
|
|
OctaveStream & operator<<(OctaveStream &, char const *);
|
|
|
|
///
|
|
|
|
OctaveStream & operator<<(OctaveStream &, char);
|
2002-04-24 17:07:42 +00:00
|
|
|
///
|
|
|
|
OctaveStream & operator<<(OctaveStream &, int);
|
2001-11-08 12:06:56 +00:00
|
|
|
|
|
|
|
|
2001-12-03 16:24:50 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// LaTeX/LyX
|
|
|
|
//
|
|
|
|
|
|
|
|
class WriteStream {
|
|
|
|
public:
|
2001-11-08 12:06:56 +00:00
|
|
|
///
|
2002-03-25 12:11:25 +00:00
|
|
|
WriteStream(std::ostream & os, bool fragile, bool latex);
|
2001-11-08 12:06:56 +00:00
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
explicit WriteStream(std::ostream & os_);
|
2002-01-11 15:23:10 +00:00
|
|
|
///
|
|
|
|
int line() const { return line_; }
|
2001-11-20 07:04:00 +00:00
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
bool fragile() const { return fragile_; }
|
2001-11-20 07:04:00 +00:00
|
|
|
///
|
2002-03-25 12:11:25 +00:00
|
|
|
bool latex() const { return latex_; }
|
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
std::ostream & os() { return os_; }
|
2001-11-08 12:06:56 +00:00
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
bool & firstitem() { return firstitem_; }
|
2002-01-11 15:23:10 +00:00
|
|
|
///
|
|
|
|
void addlines(unsigned int);
|
2001-12-03 16:24:50 +00:00
|
|
|
private:
|
2001-11-08 12:06:56 +00:00
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
std::ostream & os_;
|
2001-11-08 12:06:56 +00:00
|
|
|
///
|
2001-12-03 16:24:50 +00:00
|
|
|
bool fragile_;
|
2002-03-25 12:11:25 +00:00
|
|
|
/// are we writing to .tex?
|
|
|
|
int latex_;
|
2001-11-13 14:45:08 +00:00
|
|
|
/// are we at the beginning of an MathArray?
|
2001-12-03 16:24:50 +00:00
|
|
|
bool firstitem_;
|
2001-11-19 19:06:05 +00:00
|
|
|
///
|
|
|
|
int line_;
|
2001-11-08 12:06:56 +00:00
|
|
|
};
|
|
|
|
|
2001-12-03 16:24:50 +00:00
|
|
|
///
|
|
|
|
WriteStream & operator<<(WriteStream &, MathInset const *);
|
|
|
|
///
|
|
|
|
WriteStream & operator<<(WriteStream &, MathArray const &);
|
|
|
|
///
|
|
|
|
WriteStream & operator<<(WriteStream &, char const *);
|
|
|
|
///
|
|
|
|
WriteStream & operator<<(WriteStream &, char);
|
|
|
|
///
|
|
|
|
WriteStream & operator<<(WriteStream &, int);
|
|
|
|
///
|
|
|
|
WriteStream & operator<<(WriteStream &, unsigned int);
|
|
|
|
|
2001-11-07 17:30:26 +00:00
|
|
|
#endif
|