1 #ifndef MATH_MATHMLSTREAM_H
2 #define MATH_MATHMLSTREAM_H
5 // Please keep all four streams in one file until the interface has
9 #include "math_metricsinfo.h"
24 WriteStream(std::ostream & os, bool fragile, bool latex);
26 explicit WriteStream(std::ostream & os_);
30 int line() const { return line_; }
32 bool fragile() const { return fragile_; }
34 bool latex() const { return latex_; }
36 std::ostream & os() { return os_; }
38 bool & firstitem() { return firstitem_; }
40 void addlines(unsigned int);
41 /// writes space if next thing is isalpha()
42 void pendingSpace(bool how);
43 /// writes space if next thing is isalpha()
44 bool pendingSpace() const { return pendingspace_; }
48 /// do we have to write \\protect sometimes
50 /// are we at the beginning of an MathArray?
52 /// are we writing to .tex?
54 /// do we have a space pending?
61 WriteStream & operator<<(WriteStream &, MathAtom const &);
63 WriteStream & operator<<(WriteStream &, MathArray const &);
65 WriteStream & operator<<(WriteStream &, char const *);
67 WriteStream & operator<<(WriteStream &, char);
69 WriteStream & operator<<(WriteStream &, int);
71 WriteStream & operator<<(WriteStream &, unsigned int);
81 MTag(char const * const tag) : tag_(tag) {}
83 char const * const tag_;
88 ETag(char const * const tag) : tag_(tag) {}
90 char const * const tag_;
96 explicit MathMLStream(std::ostream & os);
100 std::ostream & os() { return os_; }
102 int line() const { return line_; }
104 int & tab() { return tab_; }
106 friend MathMLStream & operator<<(MathMLStream &, char const *);
119 MathMLStream & operator<<(MathMLStream &, MathAtom const &);
121 MathMLStream & operator<<(MathMLStream &, MathArray const &);
123 MathMLStream & operator<<(MathMLStream &, char const *);
125 MathMLStream & operator<<(MathMLStream &, char);
127 MathMLStream & operator<<(MathMLStream &, MTag const &);
129 MathMLStream & operator<<(MathMLStream &, ETag const &);
140 explicit NormalStream(std::ostream & os) : os_(os) {}
142 std::ostream & os() { return os_; }
149 NormalStream & operator<<(NormalStream &, MathAtom const &);
151 NormalStream & operator<<(NormalStream &, MathArray const &);
153 NormalStream & operator<<(NormalStream &, char const *);
155 NormalStream & operator<<(NormalStream &, char);
157 NormalStream & operator<<(NormalStream &, int);
168 explicit MapleStream(std::ostream & os) : os_(os) {}
170 std::ostream & os() { return os_; }
178 MapleStream & operator<<(MapleStream &, MathAtom const &);
180 MapleStream & operator<<(MapleStream &, MathArray const &);
182 MapleStream & operator<<(MapleStream &, char const *);
184 MapleStream & operator<<(MapleStream &, char);
186 MapleStream & operator<<(MapleStream &, int);
197 explicit MaximaStream(std::ostream & os) : os_(os) {}
199 std::ostream & os() { return os_; }
207 MaximaStream & operator<<(MaximaStream &, MathAtom const &);
209 MaximaStream & operator<<(MaximaStream &, MathArray const &);
211 MaximaStream & operator<<(MaximaStream &, char const *);
213 MaximaStream & operator<<(MaximaStream &, char);
215 MaximaStream & operator<<(MaximaStream &, int);
223 class MathematicaStream {
226 explicit MathematicaStream(std::ostream & os) : os_(os) {}
228 std::ostream & os() { return os_; }
236 MathematicaStream & operator<<(MathematicaStream &, MathAtom const &);
238 MathematicaStream & operator<<(MathematicaStream &, MathArray const &);
240 MathematicaStream & operator<<(MathematicaStream &, char const *);
242 MathematicaStream & operator<<(MathematicaStream &, char);
244 MathematicaStream & operator<<(MathematicaStream &, int);
255 explicit OctaveStream(std::ostream & os) : os_(os) {}
257 std::ostream & os() { return os_; }
264 OctaveStream & operator<<(OctaveStream &, MathAtom const &);
266 OctaveStream & operator<<(OctaveStream &, MathArray const &);
268 OctaveStream & operator<<(OctaveStream &, char const *);
270 OctaveStream & operator<<(OctaveStream &, char);
272 OctaveStream & operator<<(OctaveStream &, int);