Main Page | Modules | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | Related Pages

TTimeSign.h

00001 /*
00002   Copyright © Grame 2003
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Lesser General Public
00006     License as published by the Free Software Foundation; either
00007     version 2.1 of the License, or (at your option) any later version.
00008     
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Lesser General Public License for more details.
00013     
00014     You should have received a copy of the GNU Lesser General Public
00015     License along with this library; if not, write to the Free Software
00016     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018     Grame Research Laboratory, 9, rue du Garet 69001 Lyon - France
00019     grame@grame.fr
00020 
00021 */
00022 
00023 #ifndef __TTimeSign__
00024 #define __TTimeSign__
00025 
00026 #include "exports.h"
00027 #include "bimap.h"
00028 #include "TRational.h"
00029 #include "TScoreVisitor.h"
00030 #include <string>
00031 
00032 namespace MusicXML 
00033 {
00034 
00055 class EXP TTimeSign : public visitable, public smartable {
00056     
00057     public:
00058         enum { undefined = -1, groupbeats = -1, common=1, cut, single_number, normal, last=normal };
00059 
00060         EXP friend SMARTP<TTimeSign> newTimeSign();
00061 
00062         virtual void accept(TScoreVisitor& visitor);
00063 
00064         void    setSymbol(int symbol);
00065         int     getSymbol() const           { return fSymbol; }
00066 
00068         long    add (long beat, long type);
00070         bool    measured () const           { return fBeat.size() > 0; }
00072         TRational rational();
00073         
00074         vector<long>& getBeats()        { return fBeat; }
00075         vector<long>& getBeatTypes()    { return fBeatType; }
00076 
00078     static const string xmlsymbol (int d);
00080     static int          xmlsymbol (const string str);
00081 
00082     protected:
00084         TTimeSign() : fSymbol(undefined) {}
00085         virtual ~TTimeSign() {}
00086 
00087     private:
00088         vector<long> fBeat;
00089         vector<long> fBeatType;
00090         int         fSymbol;
00091 
00092     static bimap<string, int> fSymbol2String;
00093     static int      fSymbolTbl[];
00094     static string   fSymbolStrings[];
00095 };
00096 typedef SMARTP<TTimeSign> STimeSign;
00097 
00098 } // namespace MusicXML
00099 
00100 
00101 #endif

Generated on Tue Mar 23 09:49:44 2004 for LibMusicXML by doxygen 1.3.3