21#include "smartpointer.h"
29typedef SMARTP<guidoelement> Sguidoelement;
30typedef SMARTP<guidoparam> Sguidoparam;
33EXP std::ostream& operator<< (std::ostream& os,
const Sguidoelement& elt);
51 void set (std::string value,
bool quote=
true);
52 void set (
long value,
bool quote=
true);
53 std::string get ()
const {
return fValue; }
54 bool quote ()
const {
return fQuote; }
57 guidoparam(std::string value,
bool quote);
58 guidoparam(
long value,
bool quote);
59 virtual ~guidoparam ();
79 virtual void print (std::ostream& os)
const;
82 void setName (std::string name) { fName = name; }
83 std::string getName ()
const {
return fName; }
84 std::string getStart ()
const {
return fStartList; }
85 std::string getEnd ()
const {
return fEndList; }
86 std::string getSep ()
const {
return fSep; }
87 void setEnd (std::string end) { fEndList=end; }
88 std::vector<Sguidoelement>& elements() {
return fElements; }
89 const std::vector<Sguidoelement>& elements()
const {
return fElements; }
90 const std::vector<Sguidoparam>& parameters()
const {
return fParams; }
92 bool empty ()
const {
return fElements.empty(); }
93 virtual bool isSeq ()
const {
return false; }
94 virtual bool isChord ()
const {
return false; }
95 virtual bool isTag ()
const {
return false; }
96 virtual bool isNote ()
const {
return false; }
98 int countNotes ()
const;
101 guidoelement(std::string name, std::string sep=
" ");
102 virtual ~guidoelement();
104 void printparams (std::ostream& os)
const;
131 { set (num, denom, dots); }
134 void set (
long num,
long denom,
long dots=0)
135 { fNum=num; fDenom=denom; fDots=dots; }
137 { fNum=dur.fNum; fDenom=dur.fDenom; fDots=dur.fDots;
return *
this; }
139 {
return (fNum!=dur.fNum) || (fDenom!=dur.fDenom) || (fDots!=dur.fDots); }
155 static SMARTP<guidonote> create(
unsigned short voice, std::string name,
char octave,
158 void set (
unsigned short voice, std::string name,
char octave,
guidonoteduration& dur, std::string acc);
159 void setName (
const std::string name) { fNote = name; }
160 void setOctave (
char octave) { fOctave = octave; }
162 void setAccidental (
const std::string acc) { fAccidental = acc; }
164 const char * name()
const {
return fNote.c_str(); }
165 const char * accidental()
const {
return fAccidental.c_str(); }
166 char octave()
const {
return fOctave; }
169 virtual bool isNote ()
const {
return true; }
173 guidonote(
unsigned short voice, std::string name,
char octave,
178 std::string fAccidental;
201 enum { kMaxInstances=128 };
204 static void resetall();
205 static void freeall();
207 enum { defoctave=1, defnum=1, defdenom=4 };
209 void reset() { fOctave=defoctave; fDur.set(defnum, defdenom, 0); }
229 virtual bool isSeq ()
const {
return true; }
243 virtual bool isChord ()
const {
return true; }
249 virtual void print (std::ostream& os)
const;
263 virtual bool isTag ()
const {
return true; }
267 guidotag(std::string name, std::string sep);
the smart pointer implementation
Definition: smartpointer.h:58
The guido chord element.
Definition: guido.h:240
A generic guido element representation.
Definition: guido.h:72
std::string fSep
the element separator (default to space)
Definition: guido.h:112
std::string fStartList
the contained element start marker (default to empty)
Definition: guido.h:108
std::string fEndList
the contained element end marker (default to empty)
Definition: guido.h:110
std::vector< Sguidoparam > fParams
list of optional parameters
Definition: guido.h:116
std::vector< Sguidoelement > fElements
list of the enclosed elements
Definition: guido.h:114
void setName(std::string name)
the element name
Definition: guido.h:82
A guido note representation.
Definition: guido.h:152
A guido note duration representation.
Definition: guido.h:128
Represents the current status of notes duration and octave.
Definition: guido.h:199
A guidotag parameter representation.
Definition: guido.h:45
void set(std::string value, bool quote=true)
the parameter value
The guido sequence element.
Definition: guido.h:226
A guido tag representation.
Definition: guido.h:259
the base class for smart pointers implementation
Definition: smartpointer.h:29