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 __TUnrolledVisitor__ 00024 #define __TUnrolledVisitor__ 00025 00026 #include "exports.h" 00027 #include "TRolledVisitor.h" 00028 #include "LibMusicXML.h" 00029 #include <list> 00030 00031 using namespace std; 00032 00033 namespace MusicXML 00034 { 00035 00040 typedef pair<long,long> TSection; 00041 00047 class TUnrolledVisitor : public TRolledVisitor { 00048 00049 private: 00050 00051 vvector<SPWMeasure>::const_iterator fCodaIt; 00052 vvector<SPWMeasure>::const_iterator fSegnoIt; 00053 vvector<SPWMeasure>::const_iterator fBeginMeasureIt; // Beginning of the section before the repeated section 00054 vvector<SPWMeasure>::const_iterator fCurMeasureIt; // End of the section before the repeated section 00055 00056 list<TSection> fSectionList; 00057 00058 bool IsRepeatType (SPWMeasure& elt, int type); 00059 bool IsEndingType (SPWMeasure& elt, int type); 00060 long GetEndingNum (SPWMeasure& elt); 00061 bool IsRepeatType (SMusicData& musicData, int type); 00062 bool IsEndingType (SMusicData& musicData, int type); 00063 long GetRepeatTimes (SPWMeasure& elt); 00064 00065 void RepeatSection (vvector<SPWMeasure>::const_iterator begin, vvector<SPWMeasure>::const_iterator end); 00066 void AddSection (vvector<SPWMeasure>::const_iterator begin, vvector<SPWMeasure>::const_iterator end); 00067 00068 public: 00069 00070 TUnrolledVisitor(TNodeVisitor* visitor):TRolledVisitor(visitor){} 00071 virtual ~TUnrolledVisitor() {} 00072 00073 virtual void visite ( SPWMeasure& elt ); 00074 virtual void visite ( SPWPart& elt ); 00075 virtual void visite ( SSound& elt ); 00076 00077 const list<TSection>& GetSectionList() {return fSectionList;} 00078 }; 00079 00080 typedef SMARTP<TUnrolledVisitor> SUnrolledVisitor; 00081 00082 } // namespace MusicXML 00083 00084 00085 #endif