LibMusicXML  3.18
lpsrVarValAssocs.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 ___lpsrVarValAssocs___
14 #define ___lpsrVarValAssocs___
15 
16 #include <string>
17 #include <list>
18 
19 #include "lpsrElements.h"
20 
21 #include "msrBasicTypes.h"
22 
23 
24 using namespace std;
25 
26 namespace MusicXML2
27 
28 {
29 
30 //______________________________________________________________________________
32 {
33  public:
34 
35  // data types
36  // ------------------------------------------------------
37 
38  // data types
39  // ------------------------------------------------------
40 
41  enum lpsrVarValAssocKind {
42  // library
43 
44  kLibraryVersion,
45 
46  // MusicXML informations
47 
48  kMusicXMLWorkNumber, kMusicXMLWorkTitle,
49  kMusicXMLMovementNumber, kMusicXMLMovementTitle,
50  kMusicXMLEncodingDate,
51  kMusicXMLScoreInstrument,
52  kMusicXMLMiscellaneousField,
53 
54  // LilyPond informations
55 
56  kLilypondDedication,
57  kLilypondPiece, kLilypondOpus,
58  kLilypondTitle, kLilypondSubTitle, kLilypondSubSubTitle,
59  kLilypondInstrument, kLilypondMeter,
60  kLilypondTagline, kLilypondCopyright,
61 
62  kLilypondMyBreak, kLilypondMyPageBreak,
63  kLilypondGlobal };
64 
65  static string lilyPondVarValAssocKindAsString (
66  lpsrVarValAssocKind lilyPondVarValAssocKind);
67 
68  enum lpsrCommentedKind {
69  kCommentedYes, kCommentedNo };
70 
71  static string commentedKindAsString (
72  lpsrCommentedKind commentedKind);
73 
74  enum lpsrBackSlashKind {
75  kWithBackSlashYes, kWithBackSlashNo };
76 
77  static string backSlashKindAsString (
78  lpsrBackSlashKind backSlashKind);
79 
80  enum lpsrVarValSeparatorKind {
81  kVarValSeparatorSpace, kVarValSeparatorEqualSign };
82 
83  static string varValSeparatorKindAsString (
84  lpsrVarValSeparatorKind varValSeparatorKind);
85 
86  enum lpsrQuotesKind {
87  kQuotesAroundValueYes, kQuotesAroundValueNo };
88 
89  static string quotesKindAsString (
90  lpsrQuotesKind quotesKind);
91 
92  enum lpsrEndlKind {
93  kEndlNone, kEndlOnce, kEndlTwice };
94 
95  static string endlKindAsString (
96  lpsrEndlKind endlKind);
97 
98  static string const g_LilyPondVarValAssocNoUnit;
99  static string const g_LilyPondVarValAssocNoComment;
100 
101  // creation from MusicXML
102  // ------------------------------------------------------
103 
104  static SMARTP<lpsrVarValAssoc> create (
105  int inputLineNumber,
106  lpsrCommentedKind commentedKind,
107  lpsrBackSlashKind backSlashKind,
108  lpsrVarValAssocKind
109  lilyPondVarValAssocKind,
110  lpsrVarValSeparatorKind varValSeparatorKind,
111  lpsrQuotesKind quotesKind,
112  string value,
113  string unit,
114  msrFontStyleKind varValFontStyleKind,
115  msrFontWeightKind varValFontWeightKind,
116  string comment,
117  lpsrEndlKind endlKind);
118 
119  protected:
120 
121  // constructors/destructor
122  // ------------------------------------------------------
123 
125  int inputLineNumber,
126  lpsrCommentedKind commentedKind,
127  lpsrBackSlashKind backSlashKind,
128  lpsrVarValAssocKind
129  lilyPondVarValAssocKind,
130  lpsrVarValSeparatorKind varValSeparatorKind,
131  lpsrQuotesKind quotesKind,
132  string value,
133  string unit,
134  msrFontStyleKind varValFontStyleKind,
135  msrFontWeightKind varValFontWeightKind,
136  string comment,
137  lpsrEndlKind endlKind);
138 
139  virtual ~lpsrVarValAssoc ();
140 
141  public:
142 
143  // set and get
144  // ------------------------------------------------------
145 
146  lpsrCommentedKind getCommentedKind () const
147  { return fCommentedKind; }
148 
149  lpsrBackSlashKind getBackSlashKind () const
150  { return fBackSlashKind; }
151 
152  lpsrVarValAssocKind
153  getLilyPondVarValAssocKind () const
154  { return fLilyPondVarValAssocKind; }
155 
156  lpsrVarValSeparatorKind
157  getVarValSeparatorKind () const
158  { return fVarValSeparatorKind; }
159 
160  lpsrQuotesKind getQuotesKind () const
161  { return fQuotesKind; }
162 
163  void setVariableValue (string value)
164  { fVariableValue = value; }
165 
166  string getVariableValue () const
167  { return fVariableValue; }
168 
169  string getUnit () const
170  { return fUnit; }
171 
172  msrFontStyleKind getVarValFontStyleKind () const
173  { return fVarValFontStyleKind; }
174 
175  msrFontWeightKind getVarValFontWeightKind () const
176  { return fVarValFontWeightKind; }
177 
178  string getComment () const
179  { return fComment; }
180 
181  lpsrEndlKind getEndlKind () const
182  { return fEndlKind; }
183 
184  public:
185 
186  // services
187  // ------------------------------------------------------
188 
189  public:
190 
191  // visitors
192  // ------------------------------------------------------
193 
194  virtual void acceptIn (basevisitor* v);
195  virtual void acceptOut (basevisitor* v);
196 
197  virtual void browseData (basevisitor* v);
198 
199  public:
200 
201  // print
202  // ------------------------------------------------------
203 
204  string lilyPondVarValAssocKindAsString () const
205  {
206  return
207  lilyPondVarValAssocKindAsString (
208  fLilyPondVarValAssocKind);
209  }
210 
211  virtual void print (ostream& os) const;
212 
213  private:
214 
215  // fields
216  // ------------------------------------------------------
217 
218  lpsrCommentedKind fCommentedKind;
219  lpsrBackSlashKind fBackSlashKind;
220  lpsrVarValAssocKind
221  fLilyPondVarValAssocKind;
222  lpsrVarValSeparatorKind
223  fVarValSeparatorKind;
224  lpsrQuotesKind fQuotesKind;
225 
226  string fVariableValue;
227  string fUnit;
228 
229  msrFontStyleKind fVarValFontStyleKind;
230  msrFontWeightKind fVarValFontWeightKind;
231 
232  string fComment;
233 
234  lpsrEndlKind fEndlKind;
235 };
237 EXP ostream& operator<< (ostream& os, const S_lpsrVarValAssoc& elt);
238 
239 //______________________________________________________________________________
241 {
242  public:
243 
244  // data types
245  // ------------------------------------------------------
246 
247  enum lpsrVarValsListAssocKind {
248  // MusicXML informations
249  kMusicXMLRights,
250  kMusicXMLComposer, kMusicXMLArranger,
251  kMusicXMLPoet, kMusicXMLLyricist, kMusicXMLTranslator,
252  kMusicXMLArtist,
253  kMusicXMLSoftware };
254 
255 /*
256  % The following fields are centered
257  dedication = "Dedication"
258  title = "Title"
259  subtitle = "Subtitle"
260  subsubtitle = "Subsubtitle"
261  % The following fields are evenly spread on one line
262  % the field "instrument" also appears on following pages
263  instrument = \markup \with-color #green "Instrument"
264  poet = "Poet"
265  composer = "Composer"
266  % The following fields are placed at opposite ends of the same line
267  meter = "Meter"
268  arranger = "Arranger"
269  % The following fields are centered at the bottom
270  tagline = "tagline goes at the bottom of the last page"
271  copyright = "copyright goes at the bottom of the first page"
272 */
273 
274  static string lilyPondVarValsListAssocValuesAsString (
275  lpsrVarValsListAssocKind varValsListAssocKind);
276 
277  // creation from MusicXML
278  // ------------------------------------------------------
279 
280  static SMARTP<lpsrVarValsListAssoc> create (
281  int inputLineNumber,
282  lpsrVarValsListAssocKind varValsListAssocKind);
283 
284  protected:
285 
286  // constructors/destructor
287  // ------------------------------------------------------
288 
290  int inputLineNumber,
291  lpsrVarValsListAssocKind varValsListAssocKind);
292 
293  virtual ~lpsrVarValsListAssoc ();
294 
295  public:
296 
297  // set and get
298  // ------------------------------------------------------
299 
300  lpsrVarValsListAssocKind
301  getVarValsListAssocKind () const
302  { return fVarValsListAssocKind; }
303 
304  const list<string>& getVariableValuesList ()
305  { return fVariableValuesList; }
306 
307  // services
308  // ------------------------------------------------------
309 
310  void addAssocVariableValue (string value)
311  {
312  fVariableValuesList.push_back (value);
313  }
314 
315  public:
316 
317  // visitors
318  // ------------------------------------------------------
319 
320  virtual void acceptIn (basevisitor* v);
321  virtual void acceptOut (basevisitor* v);
322 
323  virtual void browseData (basevisitor* v);
324 
325  public:
326 
327  // print
328  // ------------------------------------------------------
329 
330  string lilyPondVarValsListAssocKindAsString () const
331  {
332  return
333  lilyPondVarValsListAssocValuesAsString (
334  fVarValsListAssocKind);
335  }
336 
337  string lilyPondVarValsListAssocValuesAsString () const;
338 
339  virtual void print (ostream& os) const;
340 
341  private:
342 
343  // fields
344  // ------------------------------------------------------
345 
346  lpsrVarValsListAssocKind
347  fVarValsListAssocKind;
348 
349  list<string> fVariableValuesList;
350 };
352 EXP ostream& operator<< (ostream& os, const S_lpsrVarValsListAssoc& elt);
353 
354 
355 } // namespace MusicXML2
356 
357 
358 #endif
MusicXML2::lpsrElement
Definition: lpsrElements.h:24
MusicXML2::lpsrVarValsListAssoc
Definition: lpsrVarValAssocs.h:241
MusicXML2::SMARTP< lpsrVarValAssoc >
MusicXML2::basevisitor
Definition: basevisitor.h:25
MusicXML2::lpsrVarValAssoc
Definition: lpsrVarValAssocs.h:32