LibMusicXML  3.18
conversions.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 __conversions__
14 #define __conversions__
15 
16 #include "exports.h"
17 #include "rational.h"
18 #include "bimap.h"
19 #include <string>
20 
21 #ifdef WIN32
22 #pragma warning (disable : 4251)
23 #endif
24 
25 using namespace std;
26 
27 namespace MusicXML2
28 {
29 
33 class EXP TrillStart {
34  public:
35  enum type { undefined, upper, main, below, last=below };
36 
38  static const string xml (type d);
40  static type xml (const string str);
41 
42  private:
43  static bimap<string, type> fSN2String;
44  static type fSNTbl[];
45  static string fSNStrings[];
46 };
47 
51 class EXP TrillStep {
52  public:
53  enum type { undefined, whole, half, unison, none, last=none };
54 
56  static const string xml (type d);
58  static type xml (const string str);
59 
60  private:
61  static bimap<string, type> fTS2String;
62  static type fTSTbl[];
63  static string fTSStrings[];
64 };
65 
69 class EXP FullCue {
70  public:
71  enum type { undefined, full, cue, last=cue };
72 
74  static const string xml (type d);
76  static type xml (const string str);
77 
78  private:
79  static bimap<string, type> fFC2String;
80  static type fFCTbl[];
81  static string fFCStrings[];
82 };
83 
87 class EXP YesNo {
88  public:
89  enum type { undefined, yes, no, last=no };
90 
92  static const string xml (type d);
94  static type xml (const string str);
95 
96  private:
97  static bimap<string, type> fYN2String;
98  static type fYNTbl[];
99  static string fYNStrings[];
100 };
101 
105 class EXP StartStop {
106  public:
107  enum type { undefined, start, stop, cont, last=cont };
108 
110  static const string xml (type d);
112  static type xml (const string str);
113 
114  private:
115  static bimap<string, type> fStartStop2String;
116  static type fStartStopTbl[];
117  static string fStartStopStrings[];
118 };
119 
123 class EXP LineType {
124  public:
125  enum type { undefined, solid, dashed, dotted, wavy, last=wavy };
126 
128  static const string xml (type d);
130  static type xml (const string str);
131 
132  private:
133  static bimap<string, type> fLineType2String;
134  static type fLineTypeTbl[];
135  static string fLineTypeStrings[];
136 };
137 
145 class EXP NoteType {
146  public:
147  enum type { undefined,
148  t256th=1, t128th=1<<1, t64th=1<<2, t32nd=1<<3,
149  t16th=1<<4, eighth=1<<5, quarter=1<<6,
150  half=1<<7, whole=1<<8, breve=1<<9, tlong=1<<10,
151  count=11 };
152 
154  static rational type2rational(type d);
156  static const string xml (type d);
158  static type xml (const string str);
159 
160  private:
161  static bimap<string, type> fType2String;
162  static type fTypeTbl[];
163  static string fTypeStrings[];
164 };
165 
166 } // namespace MusicXML2
167 
168 #endif
provides conversions between numeric note size types and strings
Definition: conversions.h:69
static const string xml(type d)
convert a numeric size value to a MusicXML string
static type xml(const string str)
convert a MusicXML string to a numeric size value
provides conversions between numeric line types and strings
Definition: conversions.h:123
static const string xml(type d)
convert a numeric start-stop value to a MusicXML string
static type xml(const string str)
convert a MusicXML string to a numeric start-stop value
provides conversions between numeric note types and strings
Definition: conversions.h:145
static const string xml(type d)
convert an integer note type to a MusicXML string
static rational type2rational(type d)
convert an integer note to a rational representation
static type xml(const string str)
convert an MusicXML string to an integer note type
provides conversions between numeric start-stop types and strings
Definition: conversions.h:105
static const string xml(type d)
convert a numeric start-stop value to a MusicXML string
static type xml(const string str)
convert a MusicXML string to a numeric start-stop value
provides conversions between numeric trill start notes and strings
Definition: conversions.h:33
static const string xml(type d)
convert a numeric start note value to a MusicXML string
static type xml(const string str)
convert a MusicXML string to a numeric start note value
provides conversions between numeric trill step, turn and strings
Definition: conversions.h:51
static const string xml(type d)
convert a numeric trill step or turn value to a MusicXML string
static type xml(const string str)
convert a MusicXML string to a numeric trill step or turn value
provides conversions between numeric yes-no types and strings
Definition: conversions.h:87
static const string xml(type d)
convert a numeric yes-no value to a MusicXML string
static type xml(const string str)
convert a MusicXML string to a numeric yes-no value
Rational number representation.
Definition: rational.h:25