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

TNotation.h

00001 /*
00002 
00003   MusicXML Library
00004   Copyright (C) 2003  Grame
00005 
00006   This library is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Lesser General Public
00008   License as published by the Free Software Foundation; either
00009   version 2.1 of the License, or (at your option) any later version.
00010 
00011   This library is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Lesser General Public License for more details.
00015 
00016   You should have received a copy of the GNU Lesser General Public
00017   License along with this library; if not, write to the Free Software
00018   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020   Grame Research Laboratory, 9 rue du Garet, 69001 Lyon - France
00021   grame@grame.fr
00022 
00023 */
00024 
00025 #ifndef __TNotation__
00026 #define __TNotation__
00027 
00028 #include "exports.h"
00029 #include "common.h"
00030 #include "smartpointer.h"
00031 #include "TScoreVisitor.h"
00032 
00033 namespace MusicXML 
00034 {
00035 
00051 class EXP TNotation : public visitable, public smartable {
00052 
00053     public:
00054         EXP friend SMARTP<TNotation> newNotation();
00055         
00056         virtual void accept(TScoreVisitor& visitor);
00057 
00058         long add (const SNotationElement& elt);
00059         vvector<SNotationElement>& list()           { return fList; }
00060 
00061     protected:
00062         TNotation() {}
00063         virtual ~TNotation() {}
00064     private:
00065         vvector<SNotationElement>   fList;
00066 };
00067 typedef SMARTP<TNotation> SNotation;
00068 
00076 class TTieSlur : public TNotationElement, public Positionable, public Placementable, public Orientable {
00077 
00078     public:
00079         enum { undefined=-1 };
00080         
00081         virtual void accept(TScoreVisitor& visitor) = 0;
00082 
00083         StartStop::type getType() const         { return fType; }
00084         int             getNumber() const       { return fNumber; }
00085         LineType::type  getLineType() const     { return fLine; }
00086 
00087         void    setType(StartStop::type type);
00088         void    setNumber(int num);
00089         void    setLineType(LineType::type type);
00090 
00091         const string& getElement() const            { return fElement; }
00092 
00093     protected:
00094         TTieSlur(string elt, StartStop::type type) 
00095             : fElement(elt), fType(type), fNumber(undefined), fLine(LineType::undefined) {}
00096         virtual ~TTieSlur() {}
00097     private:
00098         string          fElement;
00099         StartStop::type fType;
00100         int             fNumber;
00101         LineType::type  fLine;
00102  };
00103  typedef SMARTP<TTieSlur> STieSlur;
00104  
00110 class EXP TTie : public TTieSlur {
00111     public:
00112         EXP friend SMARTP<TTie> newTie(StartStop::type type);
00113         virtual void accept(TScoreVisitor& visitor);
00114     protected:
00115         TTie(StartStop::type type) : TTieSlur("tied", type) {} 
00116         virtual ~TTie() {}
00117  };
00118  typedef SMARTP<TTie> STie;
00119 
00125 class EXP TSlur : public TTieSlur {
00126     public:
00127         EXP friend SMARTP<TSlur> newSlur(StartStop::type type);
00128         virtual void accept(TScoreVisitor& visitor);
00129     protected:
00130         TSlur(StartStop::type type) : TTieSlur("slur", type) {} 
00131         virtual ~TSlur() {}
00132  };
00133  typedef SMARTP<TSlur> SSlur;
00134 
00141 class EXP TTupletDesc : public visitable, public smartable {
00142 
00143     public:
00144         enum { undefined=-1 };
00145 
00146         virtual void accept(TScoreVisitor& visitor);
00147 
00148         void    setNumber (int num);
00149         void    setType(int type);
00150         void    setDots(int dots);
00151 
00152         int     getNumber() const       { return fNumber; }
00153         int     getType() const         { return fType; }
00154         int     getDots() const         { return fDots; }
00155 
00156         const string getName() const    { return fName; }
00157 
00158     protected:
00159         TTupletDesc(string suffix) 
00160             : fName(suffix), fNumber(undefined), fType(undefined), fDots(0) {}
00161         virtual ~TTupletDesc() {}
00162 
00163     private:
00165         string  fName;
00166         int     fNumber;
00167         int     fType;
00168         int     fDots;
00169 };
00170 typedef SMARTP<TTupletDesc> STupletDesc;
00171 
00177 class EXP TTupletActual: public TTupletDesc {
00178     public:
00179         EXP friend STupletDesc newTupletActual();
00180     protected:
00181         TTupletActual() : TTupletDesc("actual") {}
00182         virtual ~TTupletActual() {}
00183 };
00184 
00190 class EXP TTupletNormal: public TTupletDesc {
00191     public:
00192         EXP friend STupletDesc newTupletNormal();
00193     protected:
00194         TTupletNormal() : TTupletDesc("normal") {}
00195         virtual ~TTupletNormal() {}
00196 };
00197 
00222 class EXP TTuplet : public TNotationElement, public Placementable, public Positionable {
00223 
00224     public:
00225         enum { undefined=-1, actual=1, both, none, last=none };
00226         
00227         EXP friend SMARTP<TTuplet> newTuplet(StartStop::type type);
00228         virtual void accept(TScoreVisitor& visitor);
00229         
00231         void    setType(StartStop::type type);
00233         void    setNumber(int num);
00235         void    setBracket(YesNo::type bracket);
00237         void    setShowNum(int sn);
00239         void    setShowType(int st);
00240 
00241         StartStop::type getType() const { return fType; }
00242         int     getNumber() const       { return fNumber; }
00243         YesNo::type getBracket() const      { return fBracket; }
00244         int     getShowNum() const      { return fShowNum; }
00245         int     getShowType() const     { return fShowType; }
00246 
00247         STupletDesc&    actualDesc()    { return fActual; }
00248         STupletDesc&    normalDesc()    { return fNormal; }
00249 
00251     static const string xmlshow (int d);
00253     static int          xmlshow (const string str);
00254 
00255     protected:
00256         TTuplet(StartStop::type type) 
00257             : fType(type), fNumber(undefined), fBracket(YesNo::undefined),
00258               fShowNum(undefined), fShowType(undefined) {}
00259         virtual ~TTuplet() {}
00260 
00261     private:
00262         StartStop::type fType;
00263         int     fNumber;
00264         YesNo::type     fBracket;
00265         int     fShowNum;
00266         int     fShowType;
00267 
00268         STupletDesc fActual;
00269         STupletDesc fNormal;
00270 
00271     static bimap<string, int> fShow2String;
00272     static int      fShowTbl[];
00273     static string   fShowStrings[];
00274 };
00275 typedef SMARTP<TTuplet> STuplet;
00276 
00289 class EXP TArticulationElement : public visitable, public Positionable, public Placementable, public smartable {
00290 
00291     public:
00292         enum articulation { first=1, accent=first, strong_accent, staccato, tenuto, detached_legato,
00293              staccatissimo, spiccato, scoop, plop, doit, falloff, breath_mark, caesura, last=caesura };
00294 
00295         EXP friend SMARTP<TArticulationElement> newArticulationElement(articulation type);
00296         virtual void accept(TScoreVisitor& visitor);
00297 
00298         articulation    getArtType() const          { return fArticulationType; }
00299         void            setArtType(articulation a);
00300         
00302     static const string xmlname (articulation d);
00304     static articulation xmlname (const string str);
00305     
00306     static const string* getArticulationStrings()   { return fArticulationStrings; }
00307         
00308     protected:
00309         TArticulationElement(articulation type) : fArticulationType(type) {}
00310         virtual ~TArticulationElement() {}
00311 
00312     private:
00313         articulation    fArticulationType;
00314 
00315     static bimap<string, articulation> fArticulation2String;
00316     static articulation         fArticulationTbl[];
00317     static string               fArticulationStrings[];
00318 };
00319 typedef SMARTP<TArticulationElement> SArticulationElement;
00320 
00326 class EXP TArticulations : public TNotationElement {
00327 
00328       public:
00329         EXP friend SMARTP<TArticulations> newArticulations();
00330         virtual void accept(TScoreVisitor& visitor);
00331 
00332         long add (const SArticulationElement& art);
00333         vvector<SArticulationElement>& articulations()  { return fList; }
00334 
00335     protected:
00336         TArticulations() {}
00337         virtual ~TArticulations() {}
00338     private:
00339         vvector<SArticulationElement>   fList;
00340 };
00341 typedef SMARTP<TArticulations> SArticulations;
00342 
00348 class EXP TStrongAccent : public TArticulationElement {
00349 
00350     public:
00351         enum { undefined, up=1, down, last=down };
00352         EXP friend SMARTP<TStrongAccent> newStrongAccent();
00353         virtual void accept(TScoreVisitor& visitor);
00354 
00355         int     getType() const     { return fType; }
00356         void    setType(int type);
00357         
00359     static const string xmltype (int d);
00361     static int          xmltype (const string str);
00362 
00363     protected:
00364         TStrongAccent() : TArticulationElement(strong_accent), fType(undefined) {}
00365         virtual ~TStrongAccent() {}
00366     private:
00367         int     fType;
00368 
00369     static bimap<string, int> fType2String;
00370     static int      fTypeTbl[];
00371     static string   fTypeStrings[];
00372 };
00373 typedef SMARTP<TStrongAccent> SStrongAccent;
00374 
00375 } // namespace MusicXML
00376 
00377 
00378 #endif

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