]> git.lyx.org Git - lyx.git/blob - src/mathed/math_mathmlstream.C
add missing using's
[lyx.git] / src / mathed / math_mathmlstream.C
1 #include <config.h>
2
3 #include "math_mathmlstream.h"
4 #include "math_inset.h"
5 #include "math_extern.h"
6 #include "debug.h"
7 #include "support/lyxalgo.h"
8
9
10 using std::ostream;
11 using std::strlen;
12
13
14 MathMLStream::MathMLStream(ostream & os)
15         : os_(os), tab_(0), line_(0), lastchar_(0)
16 {}
17
18
19 MathMLStream & operator<<(MathMLStream & ms, MathInset const * p)
20 {
21         if (p)
22                 p->mathmlize(ms);
23         else
24                 lyxerr << "operator<<(MathMLStream, NULL) called\n";
25         return ms;
26 }
27
28
29 MathMLStream & operator<<(MathMLStream & ms, MathArray const & ar)
30 {
31         mathmlize(ar, ms);
32         return ms;
33 }
34
35
36 MathMLStream & operator<<(MathMLStream & ms, char const * s)
37 {
38         ms.os() << s;
39         return ms;
40 }
41
42
43 MathMLStream & operator<<(MathMLStream & ms, char c)
44 {
45         ms.os() << c;
46         return ms;
47 }
48
49
50 MathMLStream & operator<<(MathMLStream & ms, MTag const & t)
51 {
52         ++ms.tab();
53         ms.cr();
54         ms.os() << '<' << t.tag_ << '>';
55         return ms;
56 }
57
58
59 MathMLStream & operator<<(MathMLStream & ms, ETag const & t)
60 {
61         ms.cr();
62         if (ms.tab() > 0)
63                 --ms.tab();
64         ms.os() << "</" << t.tag_ << '>';
65         return ms;
66 }
67
68
69 void MathMLStream::cr()
70 {
71         os() << '\n';
72         for (int i = 0; i < tab(); ++i)
73                 os() << ' ';
74 }
75
76
77
78 //////////////////////////////////////////////////////////////////////
79
80
81 MapleStream & operator<<(MapleStream & ms, MathInset const * p)
82 {
83         if (p)
84                 p->maplize(ms);
85         else
86                 lyxerr << "operator<<(MapleStream, NULL) called\n";
87         return ms;
88 }
89
90
91 MapleStream & operator<<(MapleStream & ms, MathArray const & ar)
92 {
93         maplize(ar, ms);
94         return ms;
95 }
96
97
98 MapleStream & operator<<(MapleStream & ms, char const * s)
99 {
100         ms.os() << s;
101         return ms;
102 }
103
104
105 MapleStream & operator<<(MapleStream & ms, char c)
106 {
107         ms.os() << c;
108         return ms;
109 }
110
111
112 MapleStream & operator<<(MapleStream & ms, int i)
113 {
114         ms.os() << i;
115         return ms;
116 }
117
118
119 //////////////////////////////////////////////////////////////////////
120
121
122 OctaveStream & operator<<(OctaveStream & ns, MathInset const * p)
123 {
124         if (p)
125                 p->octavize(ns);
126         else
127                 lyxerr << "operator<<(OctaveStream, NULL) called\n";
128         return ns;
129 }
130
131
132 OctaveStream & operator<<(OctaveStream & ns, MathArray const & ar)
133 {
134         octavize(ar, ns);
135         return ns;
136 }
137
138
139 OctaveStream & operator<<(OctaveStream & ns, char const * s)
140 {
141         ns.os() << s;
142         return ns;
143 }
144
145
146 OctaveStream & operator<<(OctaveStream & ns, char c)
147 {
148         ns.os() << c;
149         return ns;
150 }
151
152
153 OctaveStream & operator<<(OctaveStream & ns, int i)
154 {
155         ns.os() << i;
156         return ns;
157 }
158
159
160 //////////////////////////////////////////////////////////////////////
161
162
163 NormalStream & operator<<(NormalStream & ns, MathInset const * p)
164 {
165         if (p)
166                 p->normalize(ns);
167         else
168                 lyxerr << "operator<<(NormalStream, NULL) called\n";
169         return ns;
170 }
171
172
173 NormalStream & operator<<(NormalStream & ns, MathArray const & ar)
174 {
175         normalize(ar, ns);
176         return ns;
177 }
178
179
180 NormalStream & operator<<(NormalStream & ns, char const * s)
181 {
182         ns.os() << s;
183         return ns;
184 }
185
186
187 NormalStream & operator<<(NormalStream & ns, char c)
188 {
189         ns.os() << c;
190         return ns;
191 }
192
193
194
195 //////////////////////////////////////////////////////////////////////
196
197
198 WriteStream::WriteStream(ostream & os, bool fragile, bool latex)
199         : os_(os), fragile_(fragile), latex_(latex), firstitem_(false), line_(0)
200 {}
201
202
203 WriteStream::WriteStream(ostream & os)
204         : os_(os), fragile_(false), latex_(false), firstitem_(false), line_(0)
205 {}
206
207
208 void WriteStream::addlines(unsigned int n)
209 {
210         line_ += n;
211 }
212
213
214 WriteStream & operator<<(WriteStream & ws, MathInset const * p)
215 {
216         if (p)
217                 p->write(ws);
218         else
219                 lyxerr << "operator<<(WriteStream, NULL) called\n";
220         return ws;
221 }
222
223
224 WriteStream & operator<<(WriteStream & ws, MathArray const & ar)
225 {
226         write(ar, ws);
227         return ws;
228 }
229
230
231 WriteStream & operator<<(WriteStream & ws, char const * s)
232 {
233         ws.os() << s;
234         ws.addlines(int(lyx::count(s, s+strlen(s), '\n')));
235         return ws;
236 }
237
238
239 WriteStream & operator<<(WriteStream & ws, char c)
240 {
241         ws.os() << c;
242         if (c == '\n')
243                 ws.addlines(1);
244         return ws;
245 }
246
247
248 WriteStream & operator<<(WriteStream & ws, int i)
249 {
250         ws.os() << i;
251         return ws;
252 }
253
254
255 WriteStream & operator<<(WriteStream & ws, unsigned int i)
256 {
257         ws.os() << i;
258         return ws;
259 }