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