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 ___lpsrScheme___ 14 #define ___lpsrScheme___ 15 16 #include <string> 17 18 #include "lpsrElements.h" 19 20 #include "lpsrOah.h" 21 22 23 using namespace std; 24 25 namespace MusicXML2 26 { 27 28 //______________________________________________________________________________ 29 class lpsrSchemeVariable : public lpsrElement 30 { 31 public: 32 33 // data types 34 // ------------------------------------------------------ 35 36 enum lpsrCommentedKind { 37 kCommentedYes, kCommentedNo }; 38 39 static string commentedKindAsString ( 40 lpsrCommentedKind commentedKind); 41 42 enum lpsrEndlKind { 43 kEndlNone, kEndlOnce, kEndlTwice }; 44 45 static string endlKindAsString ( 46 lpsrEndlKind endlKind); 47 48 static string const g_SchemeVariableNoUnit; 49 static string const g_SchemeVariableNoComment; 50 51 // creation from MusicXML 52 // ------------------------------------------------------ 53 54 static SMARTP<lpsrSchemeVariable> create ( 55 int inputLineNumber, 56 lpsrCommentedKind commentedKind, 57 string variableName, 58 string value, 59 string comment, 60 lpsrEndlKind endlKind); 61 62 protected: 63 64 // constructors/destructor 65 // ------------------------------------------------------ 66 67 lpsrSchemeVariable ( 68 int inputLineNumber, 69 lpsrCommentedKind commentedKind, 70 string variableName, 71 string value, 72 string comment, 73 lpsrEndlKind endlKind); 74 75 virtual ~lpsrSchemeVariable (); 76 77 public: 78 79 // set and get 80 // ------------------------------------------------------ 81 getVariableName()82 string getVariableName () const { return fVariableName; } 83 setVariableValue(string value)84 void setVariableValue (string value) 85 { fVariableValue = value; } 86 getVariableValue()87 string getVariableValue () const { return fVariableValue; } 88 getCommentedKind()89 lpsrCommentedKind getCommentedKind () const { return fCommentedKind; } 90 getComment()91 string getComment () const 92 { return fComment; } 93 getEndlKind()94 lpsrEndlKind getEndlKind () const 95 { return fEndlKind; } 96 97 // services 98 // ------------------------------------------------------ 99 100 public: 101 102 // visitors 103 // ------------------------------------------------------ 104 105 virtual void acceptIn (basevisitor* v); 106 virtual void acceptOut (basevisitor* v); 107 108 virtual void browseData (basevisitor* v); 109 110 public: 111 112 // print 113 // ------------------------------------------------------ 114 115 virtual void print (ostream& os) const; 116 117 private: 118 119 // fields 120 // ------------------------------------------------------ 121 122 lpsrCommentedKind fCommentedKind; 123 124 string fVariableName; 125 string fVariableValue; 126 127 string fComment; 128 129 lpsrEndlKind fEndlKind; 130 131 }; 132 typedef SMARTP<lpsrSchemeVariable> S_lpsrSchemeVariable; 133 EXP ostream& operator<< (ostream& os, const S_lpsrSchemeVariable& elt); 134 135 //______________________________________________________________________________ 136 class lpsrSchemeFunction : public lpsrElement 137 { 138 public: 139 140 // creation from MusicXML 141 // ------------------------------------------------------ 142 143 static SMARTP<lpsrSchemeFunction> create ( 144 int inputLineNumber, 145 string functionName, 146 string functionDescription, 147 string functionCode); 148 149 protected: 150 151 // constructors/destructor 152 // ------------------------------------------------------ 153 154 lpsrSchemeFunction ( 155 int inputLineNumber, 156 string functionName, 157 string functionDescription, 158 string functionCode); 159 160 virtual ~lpsrSchemeFunction (); 161 162 public: 163 164 // set and get 165 // ------------------------------------------------------ 166 getFunctionName()167 string getFunctionName () const 168 { return fFunctionName; } 169 getFunctionDescription()170 string getFunctionDescription () const 171 { return fFunctionDescription; } 172 getFunctionCode()173 string getFunctionCode () const 174 { return fFunctionCode; } 175 176 // services 177 // ------------------------------------------------------ 178 179 public: 180 181 // visitors 182 // ------------------------------------------------------ 183 184 virtual void acceptIn (basevisitor* v); 185 virtual void acceptOut (basevisitor* v); 186 187 virtual void browseData (basevisitor* v); 188 189 public: 190 191 // print 192 // ------------------------------------------------------ 193 194 virtual void print (ostream& os) const; 195 196 private: 197 198 // fields 199 // ------------------------------------------------------ 200 201 string fFunctionName; 202 203 string fFunctionDescription; 204 205 string fFunctionCode; 206 }; 207 typedef SMARTP<lpsrSchemeFunction> S_lpsrSchemeFunction; 208 EXP ostream& operator<< (ostream& os, const S_lpsrSchemeFunction& elt); 209 210 211 } 212 213 214 #endif 215