]> git.lyx.org Git - lyx.git/blob - src/mathed/math_mathmlstream.h
enable direct input of #1...#9; some whitespace changes
[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() { return line_; }
43         ///
44         int & tab() { return tab_; }
45 private:
46         ///
47         std::ostream & os_;
48         ///
49         int tab_;
50         ///
51         int line_;
52         ///
53         char lastchar_;
54 };
55
56 ///
57 MathMLStream & operator<<(MathMLStream &, MathInset const *);
58 ///
59 MathMLStream & operator<<(MathMLStream &, MathArray const &);
60 ///
61 MathMLStream & operator<<(MathMLStream &, char const *);
62 ///
63 MathMLStream & operator<<(MathMLStream &, char);
64 ///
65 MathMLStream & operator<<(MathMLStream &, MTag const &);
66 ///
67 MathMLStream & operator<<(MathMLStream &, ETag const &);
68
69
70
71 //
72 // Debugging
73 //
74
75 class NormalStream {
76 public:
77         ///
78         explicit NormalStream(std::ostream & os) : os_(os) {}
79         ///
80         std::ostream & os() { return os_; }
81 private:
82         ///
83         std::ostream & os_;
84 };
85
86 ///
87 NormalStream & operator<<(NormalStream &, MathInset const *);
88 ///
89 NormalStream & operator<<(NormalStream &, MathArray const &);
90 ///
91 NormalStream & operator<<(NormalStream &, char const *);
92 ///
93 NormalStream & operator<<(NormalStream &, char);
94
95
96
97
98 //
99 // Maple
100 //
101
102
103 class MapleStream {
104 public:
105         ///
106         explicit MapleStream(std::ostream & os) : os_(os) {}
107         ///
108         std::ostream & os() { return os_; }
109 private:
110         ///
111         std::ostream & os_;
112 };
113
114
115 ///
116 MapleStream & operator<<(MapleStream &, MathInset const *);
117 ///
118 MapleStream & operator<<(MapleStream &, MathArray const &);
119 ///
120 MapleStream & operator<<(MapleStream &, char const *);
121 ///
122 MapleStream & operator<<(MapleStream &, char);
123 ///
124 MapleStream & operator<<(MapleStream &, int);
125
126
127 //
128 // Octave
129 //
130
131
132 class OctaveStream {
133 public:
134         ///
135         explicit OctaveStream(std::ostream & os) : os_(os) {}
136         ///
137         std::ostream & os() { return os_; }
138 private:
139         ///
140         std::ostream & os_;
141 };
142
143 ///
144 OctaveStream & operator<<(OctaveStream &, MathInset const *);
145 ///
146 OctaveStream & operator<<(OctaveStream &, MathArray const &);
147 ///
148 OctaveStream & operator<<(OctaveStream &, char const *);
149 ///
150 OctaveStream & operator<<(OctaveStream &, char);
151
152
153
154 //
155 // LaTeX/LyX
156 //
157
158 class WriteStream {
159 public:
160         ///
161         WriteStream(std::ostream & os, bool fragile);
162         ///
163         explicit WriteStream(std::ostream & os_);
164         /// yes... the references will be removed some day...
165         int & line() { return line_; }
166         ///
167         bool fragile() const { return fragile_; }
168         ///
169         std::ostream & os() { return os_; }
170         ///
171         bool & firstitem() { return firstitem_; }
172 private:
173         ///
174         std::ostream & os_;
175         ///
176         bool fragile_;
177         /// are we at the beginning of an MathArray?
178         bool firstitem_;
179         ///
180         int line_;
181 };
182
183 ///
184 WriteStream & operator<<(WriteStream &, MathInset const *);
185 ///
186 WriteStream & operator<<(WriteStream &, MathArray const &);
187 ///
188 WriteStream & operator<<(WriteStream &, char const *);
189 ///
190 WriteStream & operator<<(WriteStream &, char);
191 ///
192 WriteStream & operator<<(WriteStream &, int);
193 ///
194 WriteStream & operator<<(WriteStream &, unsigned int);
195
196 #endif