1 #ifndef MATH_MATHMLSTREAM_H
2 #define MATH_MATHMLSTREAM_H
8 // Please keep all four streams in one file until the interface has
12 #include "math_metricsinfo.h"
27 WriteStream(std::ostream & os, bool fragile, bool latex);
29 explicit WriteStream(std::ostream & os_);
33 int line() const { return line_; }
35 bool fragile() const { return fragile_; }
37 bool latex() const { return latex_; }
39 std::ostream & os() { return os_; }
41 bool & firstitem() { return firstitem_; }
43 void addlines(unsigned int);
44 /// writes space if next thing is isalpha()
45 void pendingSpace(bool how);
46 /// writes space if next thing is isalpha()
47 bool pendingSpace() const { return pendingspace_; }
51 /// do we have to write \\protect sometimes
53 /// are we at the beginning of an MathArray?
55 /// are we writing to .tex?
57 /// do we have a space pending?
64 WriteStream & operator<<(WriteStream &, MathAtom const &);
66 WriteStream & operator<<(WriteStream &, MathArray const &);
68 WriteStream & operator<<(WriteStream &, char const *);
70 WriteStream & operator<<(WriteStream &, char);
72 WriteStream & operator<<(WriteStream &, int);
74 WriteStream & operator<<(WriteStream &, unsigned int);
84 MTag(char const * const tag) : tag_(tag) {}
86 char const * const tag_;
91 ETag(char const * const tag) : tag_(tag) {}
93 char const * const tag_;
99 explicit MathMLStream(std::ostream & os);
103 std::ostream & os() { return os_; }
105 int line() const { return line_; }
107 int & tab() { return tab_; }
109 friend MathMLStream & operator<<(MathMLStream &, char const *);
122 MathMLStream & operator<<(MathMLStream &, MathAtom const &);
124 MathMLStream & operator<<(MathMLStream &, MathArray const &);
126 MathMLStream & operator<<(MathMLStream &, char const *);
128 MathMLStream & operator<<(MathMLStream &, char);
130 MathMLStream & operator<<(MathMLStream &, MTag const &);
132 MathMLStream & operator<<(MathMLStream &, ETag const &);
143 explicit NormalStream(std::ostream & os) : os_(os) {}
145 std::ostream & os() { return os_; }
152 NormalStream & operator<<(NormalStream &, MathAtom const &);
154 NormalStream & operator<<(NormalStream &, MathArray const &);
156 NormalStream & operator<<(NormalStream &, char const *);
158 NormalStream & operator<<(NormalStream &, char);
160 NormalStream & operator<<(NormalStream &, int);
173 explicit MapleStream(std::ostream & os) : os_(os) {}
175 std::ostream & os() { return os_; }
183 MapleStream & operator<<(MapleStream &, MathAtom const &);
185 MapleStream & operator<<(MapleStream &, MathArray const &);
187 MapleStream & operator<<(MapleStream &, char const *);
189 MapleStream & operator<<(MapleStream &, char);
191 MapleStream & operator<<(MapleStream &, int);
199 class MathematicaStream {
202 explicit MathematicaStream(std::ostream & os) : os_(os) {}
204 std::ostream & os() { return os_; }
212 MathematicaStream & operator<<(MathematicaStream &, MathAtom const &);
214 MathematicaStream & operator<<(MathematicaStream &, MathArray const &);
216 MathematicaStream & operator<<(MathematicaStream &, char const *);
218 MathematicaStream & operator<<(MathematicaStream &, char);
220 MathematicaStream & operator<<(MathematicaStream &, int);
231 explicit OctaveStream(std::ostream & os) : os_(os) {}
233 std::ostream & os() { return os_; }
240 OctaveStream & operator<<(OctaveStream &, MathAtom const &);
242 OctaveStream & operator<<(OctaveStream &, MathArray const &);
244 OctaveStream & operator<<(OctaveStream &, char const *);
246 OctaveStream & operator<<(OctaveStream &, char);
248 OctaveStream & operator<<(OctaveStream &, int);