LibMusicXML 3.18
bsrBrailleCodeGenerators.h
1/*
2 MusicXML Library
3 Copyright (C) Grame 2006-2013
4
5 This Source Code Form is subject to the terms of the Mozilla Public
6 License, v. 2.0. If a copy of the MPL was not distributed with this
7 file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9 Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
10 research@grame.fr
11*/
12
13#ifndef ___bsrBrailleGenerators___
14#define ___bsrBrailleGenerators___
15
16#include "bsrCellsLists.h"
17
18
19namespace MusicXML2
20{
21
22//______________________________________________________________________________
23enum bsrUTFKind {
24 kUTF8, kUTF16 };
25
26string bsrUTFKindAsString (
27 bsrUTFKind UTFKind);
28
29enum bsrByteOrderingKind {
30 kByteOrderingNone,
31 kByteOrderingBigEndian, kByteOrderingSmallEndian };
32
33string bsrByteOrderingKindAsString (
34 bsrByteOrderingKind byteOrderingKind);
35
36//______________________________________________________________________________
37// Bytes Encoding Marks (BOM)
38const string
39 kBOM_UTF_32_BigEndian =
40 "\x00\x00\xFE\xFF", // UTF-32, big-endian
41 kBOM_UTF_32_LittleEndian =
42 "\xFF\xFE\x00\x00", // UTF-32, little-endian
43 kBOM_UTF_16_BigEndian =
44 "\xFE\xFF", // UTF-16, big-endian
45 kBOM_UTF_16_LittleEndian =
46 "\xFF\xFE", // UTF-16, little-endian
47 kBOM_UTF_8 =
48 "\xEF\xBB\xBF"; // UTF-8
49
50//______________________________________________________________________________
52{
53 public:
54
55 // creation
56 // ------------------------------------------------------
57
58/* JMI
59 static SMARTP<bsrBrailleGenerator> create (
60 byteOrderingKind,
61 ostream& brailleOutputStream);
62*/
63
64 protected:
65
66 // constructors/destructor
67 // ------------------------------------------------------
68
70 ostream& brailleOutputStream);
71
72 virtual ~bsrBrailleGenerator ();
73
74 public:
75
76 // set and get
77 // ------------------------------------------------------
78
79 public:
80
81 // services
82 // ------------------------------------------------------
83
84 virtual void generateCodeForBrailleCell (
85 bsrCellKind cellKind) = 0;
86
87 void generateCodeForCellsList (
88 S_bsrCellsList cellsList);
89
90 public:
91
92 // print
93 // ------------------------------------------------------
94
95 string asString () const;
96
97 virtual void print (ostream& os) const;
98
99 protected:
100
101 // fields
102 // ------------------------------------------------------
103
104 ostream& fBrailleOutputStream;
105};
107EXP ostream& operator<< (ostream& os, const S_bsrBrailleGenerator& elt);
108
109//______________________________________________________________________________
111{
112 public:
113
114 // creation
115 // ------------------------------------------------------
116
118 ostream& brailleOutputStream);
119
120 protected:
121
122 // constructors/destructor
123 // ------------------------------------------------------
124
126 ostream& brailleOutputStream);
127
128 virtual ~bsrAsciiBrailleGenerator ();
129
130 public:
131
132 // set and get
133 // ------------------------------------------------------
134
135 public:
136
137 // services
138 // ------------------------------------------------------
139
140 virtual void generateCodeForBrailleCell (
141 bsrCellKind cellKind);
142
143 static void writeTestData (ostream& os);
144
145 public:
146
147 // print
148 // ------------------------------------------------------
149
150 string asString () const;
151
152 virtual void print (ostream& os) const;
153
154 private:
155
156 // fields
157 // ------------------------------------------------------
158};
160EXP ostream& operator<< (ostream& os, const S_bsrAsciiBrailleGenerator& elt);
161
162//______________________________________________________________________________
164{
165 public:
166
167 // creation
168 // ------------------------------------------------------
169
170 static SMARTP<bsrUTF8BrailleGenerator> create (
171 bsrByteOrderingKind byteOrderingKind,
172 ostream& brailleOutputStream);
173
174 protected:
175
176 // constructors/destructor
177 // ------------------------------------------------------
178
180 bsrByteOrderingKind byteOrderingKind,
181 ostream& brailleOutputStream);
182
183 virtual ~bsrUTF8BrailleGenerator ();
184
185 public:
186
187 // set and get
188 // ------------------------------------------------------
189
190 bsrByteOrderingKind getByteOrderingKind () const
191 { return fByteOrderingKind; }
192
193 public:
194
195 // services
196 // ------------------------------------------------------
197
198 virtual void generateCodeForBrailleCell (
199 bsrCellKind cellKind);
200
201 static void writeTestData (ostream& os);
202
203 public:
204
205 // print
206 // ------------------------------------------------------
207
208 string asString () const;
209
210 virtual void print (ostream& os) const;
211
212 private:
213
214 // fields
215 // ------------------------------------------------------
216
217 bsrByteOrderingKind fByteOrderingKind;
218};
220EXP ostream& operator<< (ostream& os, const S_bsrUTF8BrailleGenerator& elt);
221
222//______________________________________________________________________________
224{
225 public:
226
227 // creation
228 // ------------------------------------------------------
229
231 bsrByteOrderingKind byteOrderingKind,
232 ostream& brailleOutputStream);
233
234 protected:
235
236 // constructors/destructor
237 // ------------------------------------------------------
238
240 bsrByteOrderingKind byteOrderingKind,
241 ostream& brailleOutputStream);
242
244
245 public:
246
247 // set and get
248 // ------------------------------------------------------
249
250 bsrByteOrderingKind getByteOrderingKind () const
251 { return fByteOrderingKind; }
252
253 public:
254
255 // services
256 // ------------------------------------------------------
257
258 virtual void generateCodeForBrailleCell (
259 bsrCellKind cellKind);
260
261 static void writeTestData (ostream& os);
262
263 public:
264
265 // print
266 // ------------------------------------------------------
267
268 string asString () const;
269
270 virtual void print (ostream& os) const;
271
272 private:
273
274 // fields
275 // ------------------------------------------------------
276
277 bsrByteOrderingKind fByteOrderingKind;
278};
280EXP ostream& operator<< (ostream& os, const S_bsrUTF16BigEndianBrailleGenerator& elt);
281
282//______________________________________________________________________________
284{
285 public:
286
287 // creation
288 // ------------------------------------------------------
289
291 bsrByteOrderingKind byteOrderingKind,
292 ostream& brailleOutputStream);
293
294 protected:
295
296 // constructors/destructor
297 // ------------------------------------------------------
298
300 bsrByteOrderingKind byteOrderingKind,
301 ostream& brailleOutputStream);
302
304
305 public:
306
307 // set and get
308 // ------------------------------------------------------
309
310 bsrByteOrderingKind getByteOrderingKind () const
311 { return fByteOrderingKind; }
312
313 public:
314
315 // services
316 // ------------------------------------------------------
317
318 virtual void generateCodeForBrailleCell (
319 bsrCellKind cellKind);
320
321 static void writeTestData (ostream& os);
322
323 public:
324
325 // print
326 // ------------------------------------------------------
327
328 string asString () const;
329
330 virtual void print (ostream& os) const;
331
332 private:
333
334 // fields
335 // ------------------------------------------------------
336
337 bsrByteOrderingKind fByteOrderingKind;
338};
340EXP ostream& operator<< (ostream& os, const S_bsrUTF16SmallEndianBrailleGenerator& elt);
341
342
343} // namespace MusicXML2
344
345
346#endif
the smart pointer implementation
Definition: smartpointer.h:58
Definition: bsrBrailleCodeGenerators.h:111
Definition: bsrBrailleCodeGenerators.h:52
Definition: bsrBrailleCodeGenerators.h:224
Definition: bsrBrailleCodeGenerators.h:284
Definition: bsrBrailleCodeGenerators.h:164
the base class for smart pointers implementation
Definition: smartpointer.h:29