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);
171 explicit MapleStream(std::ostream & os) : os_(os) {}
173 std::ostream & os() { return os_; }
181 MapleStream & operator<<(MapleStream &, MathAtom const &);
183 MapleStream & operator<<(MapleStream &, MathArray const &);
185 MapleStream & operator<<(MapleStream &, char const *);
187 MapleStream & operator<<(MapleStream &, char);
189 MapleStream & operator<<(MapleStream &, int);
200 explicit MaximaStream(std::ostream & os) : os_(os) {}
202 std::ostream & os() { return os_; }
210 MaximaStream & operator<<(MaximaStream &, MathAtom const &);
212 MaximaStream & operator<<(MaximaStream &, MathArray const &);
214 MaximaStream & operator<<(MaximaStream &, char const *);
216 MaximaStream & operator<<(MaximaStream &, char);
218 MaximaStream & operator<<(MaximaStream &, int);
226 class MathematicaStream {
229 explicit MathematicaStream(std::ostream & os) : os_(os) {}
231 std::ostream & os() { return os_; }
239 MathematicaStream & operator<<(MathematicaStream &, MathAtom const &);
241 MathematicaStream & operator<<(MathematicaStream &, MathArray const &);
243 MathematicaStream & operator<<(MathematicaStream &, char const *);
245 MathematicaStream & operator<<(MathematicaStream &, char);
247 MathematicaStream & operator<<(MathematicaStream &, int);
258 explicit OctaveStream(std::ostream & os) : os_(os) {}
260 std::ostream & os() { return os_; }
267 OctaveStream & operator<<(OctaveStream &, MathAtom const &);
269 OctaveStream & operator<<(OctaveStream &, MathArray const &);
271 OctaveStream & operator<<(OctaveStream &, char const *);
273 OctaveStream & operator<<(OctaveStream &, char);
275 OctaveStream & operator<<(OctaveStream &, int);