#ifndef _PROTO_NOTE_HPP_ #define _PROTO_NOTE_HPP_ #ifndef _COMMON_STRING_HPP_ #include #endif class Note { public: typedef enum NoteType{A,ASh,B,C,CSh,D,DSh,E,F,FSh,G,GSh}; typedef enum Step{HalfStep=1,FullStep=2}; Note(); Note(const Note &pureNote); Note(NoteType note); virtual ~Note(); Note &operator=(const Note ¬e); bool operator==(const Note ¬e)const; bool operator<(const Note ¬e)const; bool operator>(const Note ¬e)const; const Note &operator++(); // increment by half step const Note &operator--(); // decrement by half step Note operator++(int postFixDummy); // postfix increment by half step Note operator--(int postFixDummy); // postfix decrement by half step const Note &operator+=(Step step); // increment by step const Note &operator-=(Step step); // decrement by step NoteType getNote(void)const; void setNote(NoteType noteType); int getOctave(void)const; void setOctave(int octave); String toString(void)const; String toStringWithOctave(void)const; private: int mNote; int mOctave; }; inline Note::Note() : mNote(A), mOctave(0) { } inline Note::Note(NoteType note) : mNote(note), mOctave(0) { } inline Note::Note(const Note &pureNote) { *this=pureNote; } inline Note::~Note() { } inline Note &Note::operator=(const Note ¬e) { setNote(note.getNote()); return *this; } inline bool Note::operator==(const Note ¬e)const { return mNote==note.mNote; } inline bool Note::operator<(const Note ¬e)const { return mNote(const Note ¬e)const { return mNote>note.mNote; } inline const Note &Note::operator++() // add half step { mNote++; if(mNote>GSh) { mNote=A; mOctave++; } return *this; } inline const Note &Note::operator--() // add half step { mNote--; if(mNoteGSh) { mNote=A+(mNote-GSh)-1; mOctave++; } return *this; } inline const Note &Note::operator-=(Step step) { if(HalfStep==step)return --(*this); mNote-=step; if(mNote