]> git.lyx.org Git - lyx.git/blob - src/mathed/math_mathmlstream.C
don't #include too much stuff in .h
[lyx.git] / src / mathed / math_mathmlstream.C
1
2 #include "math_inset.h"
3 #include "math_mathmlstream.h"
4
5
6 MathMLStream::MathMLStream(std::ostream & os)
7         : os_(os), tab_(0), line_(0)
8 {}
9
10
11 MathMLStream & MathMLStream::operator<<(MathInset const * p)
12 {
13         p->mathmlize(*this);
14         return *this;           
15 }
16
17
18 MathMLStream & MathMLStream::operator<<(MathArray const & ar)
19 {
20         ar.mathmlize(*this);
21         return *this;           
22 }
23
24
25 MathMLStream & MathMLStream::operator<<(char const * s)
26 {
27         os_ << s;
28         return *this;           
29 }
30
31
32 MathMLStream & MathMLStream::operator<<(char c)
33 {
34         os_ << c;
35         return *this;           
36 }
37
38
39 MathMLStream & MathMLStream::operator<<(MTag const & t)
40 {
41         ++tab_;
42         cr();
43         os_ << '<' << t.tag_ << '>';
44         return *this;           
45 }
46
47
48 MathMLStream & MathMLStream::operator<<(ETag const & t)
49 {
50         cr();
51         if (tab_ > 0)
52                 --tab_;
53         os_ << "</" << t.tag_ << '>';
54         return *this;           
55 }
56
57
58 void MathMLStream::cr()
59 {
60         os_ << '\n';
61         for (int i = 0; i < tab_; ++i)
62                 os_ << ' ';
63 }
64
65
66
67 //////////////////////////////////////////////////////////////////////
68
69
70 MapleStream & MapleStream::operator<<(MathInset const * p)
71 {
72         p->maplize(*this);
73         return *this;           
74 }
75
76
77 MapleStream & MapleStream::operator<<(MathArray const & ar)
78 {
79         ar.maplize(*this);
80         return *this;           
81 }
82
83
84 MapleStream & MapleStream::operator<<(char const * s)
85 {
86         os_ << s;
87         return *this;           
88 }
89
90
91 MapleStream & MapleStream::operator<<(char c)
92 {
93         os_ << c;
94         return *this;           
95 }
96
97
98
99 //////////////////////////////////////////////////////////////////////
100
101
102 OctaveStream & OctaveStream::operator<<(MathInset const * p)
103 {
104         p->octavize(*this);
105         return *this;           
106 }
107
108
109 OctaveStream & OctaveStream::operator<<(MathArray const & ar)
110 {
111         ar.octavize(*this);
112         return *this;           
113 }
114
115
116 OctaveStream & OctaveStream::operator<<(char const * s)
117 {
118         os_ << s;
119         return *this;           
120 }
121
122
123 OctaveStream & OctaveStream::operator<<(char c)
124 {
125         os_ << c;
126         return *this;           
127 }
128
129
130 //////////////////////////////////////////////////////////////////////
131
132
133 NormalStream & NormalStream::operator<<(MathInset const * p)
134 {
135         p->writeNormal(*this);
136         return *this;           
137 }
138
139
140 NormalStream & NormalStream::operator<<(MathArray const & ar)
141 {
142         ar.writeNormal(*this);
143         return *this;           
144 }
145
146
147 NormalStream & NormalStream::operator<<(char const * s)
148 {
149         os_ << s;
150         return *this;           
151 }
152
153
154 NormalStream & NormalStream::operator<<(char c)
155 {
156         os_ << c;
157         return *this;           
158 }
159
160
161
162 //////////////////////////////////////////////////////////////////////
163
164
165 MathWriteInfo::MathWriteInfo
166                 (Buffer const * buffer_, std::ostream & os_, bool fragile_)
167         : buffer(buffer_), os(os_), fragile(fragile_)
168 {}
169
170
171 MathWriteInfo::MathWriteInfo(std::ostream & os_)
172         : buffer(0), os(os_), fragile(false)
173 {}
174
175
176 MathWriteInfo & MathWriteInfo::operator<<(MathInset const * p)
177 {
178         p->write(*this);
179         return *this;           
180 }
181
182
183 MathWriteInfo & MathWriteInfo::operator<<(MathArray const & ar)
184 {
185         ar.write(*this);
186         return *this;           
187 }
188
189
190 MathWriteInfo & MathWriteInfo::operator<<(char const * s)
191 {
192         os << s;
193         return *this;           
194 }
195
196
197 MathWriteInfo & MathWriteInfo::operator<<(char c)
198 {
199         os << c;
200         return *this;           
201 }
202
203