]> git.lyx.org Git - lyx.git/blob - src/mathed/math_mathmlstream.h
fix typo that put too many include paths for most people
[lyx.git] / src / mathed / math_mathmlstream.h
1 #ifndef MATH_MATHMLSTREAM_H
2 #define MATH_MATHMLSTREAM_H
3
4
5 // Please keep all four streams in one file until the interface has
6 // settled.
7
8
9 #include <iosfwd>
10
11 class MathArray;
12 class MathInset;
13
14
15 //
16 //  MathML
17 //
18
19 struct MTag {
20         ///
21         MTag(char const * const tag) : tag_(tag) {}
22         ///
23         char const * const tag_;
24 };
25
26 struct ETag {
27         ///
28         ETag(char const * const tag) : tag_(tag) {}
29         ///
30         char const * const tag_;
31 };
32
33 class MathMLStream {
34 public:
35         ///
36         explicit MathMLStream(std::ostream & os);
37         ///
38         void cr();
39         ///
40         std::ostream & os() { return os_; }
41         ///
42         int line() const { return line_; }
43         ///
44         int & tab() { return tab_; }
45         ///
46         friend MathMLStream & operator<<(MathMLStream &, char const *);
47 private:
48         ///
49         std::ostream & os_;
50         ///
51         int tab_;
52         ///
53         int line_;
54         ///
55         char lastchar_;
56 };
57
58 ///
59 MathMLStream & operator<<(MathMLStream &, MathInset const *);
60 ///
61 MathMLStream & operator<<(MathMLStream &, MathArray const &);
62 ///
63 MathMLStream & operator<<(MathMLStream &, char const *);
64 ///
65 MathMLStream & operator<<(MathMLStream &, char);
66 ///
67 MathMLStream & operator<<(MathMLStream &, MTag const &);
68 ///
69 MathMLStream & operator<<(MathMLStream &, ETag const &);
70
71
72
73 //
74 // Debugging
75 //
76
77 class NormalStream {
78 public:
79         ///
80         explicit NormalStream(std::ostream & os) : os_(os) {}
81         ///
82         std::ostream & os() { return os_; }
83 private:
84         ///
85         std::ostream & os_;
86 };
87
88 ///
89 NormalStream & operator<<(NormalStream &, MathInset const *);
90 ///
91 NormalStream & operator<<(NormalStream &, MathArray const &);
92 ///
93 NormalStream & operator<<(NormalStream &, char const *);
94 ///
95 NormalStream & operator<<(NormalStream &, char);
96
97
98
99
100 //
101 // Maple
102 //
103
104
105 class MapleStream {
106 public:
107         ///
108         explicit MapleStream(std::ostream & os) : os_(os) {}
109         ///
110         std::ostream & os() { return os_; }
111 private:
112         ///
113         std::ostream & os_;
114 };
115
116
117 ///
118 MapleStream & operator<<(MapleStream &, MathInset const *);
119 ///
120 MapleStream & operator<<(MapleStream &, MathArray const &);
121 ///
122 MapleStream & operator<<(MapleStream &, char const *);
123 ///
124 MapleStream & operator<<(MapleStream &, char);
125 ///
126 MapleStream & operator<<(MapleStream &, int);
127
128
129 //
130 // Octave
131 //
132
133
134 class OctaveStream {
135 public:
136         ///
137         explicit OctaveStream(std::ostream & os) : os_(os) {}
138         ///
139         std::ostream & os() { return os_; }
140 private:
141         ///
142         std::ostream & os_;
143 };
144
145 ///
146 OctaveStream & operator<<(OctaveStream &, MathInset const *);
147 ///
148 OctaveStream & operator<<(OctaveStream &, MathArray const &);
149 ///
150 OctaveStream & operator<<(OctaveStream &, char const *);
151 ///
152 OctaveStream & operator<<(OctaveStream &, char);
153
154
155
156 //
157 // LaTeX/LyX
158 //
159
160 class WriteStream {
161 public:
162         ///
163         WriteStream(std::ostream & os, bool fragile, bool latex);
164         ///
165         explicit WriteStream(std::ostream & os_);
166         ///
167         int line() const { return line_; }
168         ///
169         bool fragile() const { return fragile_; }
170         ///
171         bool latex() const { return latex_; }
172         ///
173         std::ostream & os() { return os_; }
174         ///
175         bool & firstitem() { return firstitem_; }
176         ///
177         void addlines(unsigned int);
178 private:
179         ///
180         std::ostream & os_;
181         ///
182         bool fragile_;
183         /// are we writing to .tex?
184         int latex_;
185         /// are we at the beginning of an MathArray?
186         bool firstitem_;
187         ///
188         int line_;
189 };
190
191 ///
192 WriteStream & operator<<(WriteStream &, MathInset const *);
193 ///
194 WriteStream & operator<<(WriteStream &, MathArray const &);
195 ///
196 WriteStream & operator<<(WriteStream &, char const *);
197 ///
198 WriteStream & operator<<(WriteStream &, char);
199 ///
200 WriteStream & operator<<(WriteStream &, int);
201 ///
202 WriteStream & operator<<(WriteStream &, unsigned int);
203
204 #endif