00001 /* 00002 * @(#)PhraseList.h 3.00 14 May 1999 00003 * 00004 * Copyright (c) 2000 Pete Goodliffe (pete@cthree.org) 00005 * 00006 * This file is part of TSE3 - the Trax Sequencer Engine version 3.00. 00007 * 00008 * This library is modifiable/redistributable under the terms of the GNU 00009 * General Public License. 00010 * 00011 * You should have received a copy of the GNU General Public License along 00012 * with this program; see the file COPYING. If not, write to the Free Software 00013 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00014 * 00015 */ 00016 00017 #ifndef TSE3_PHRASELIST_H 00018 #define TSE3_PHRASELIST_H 00019 00020 #include "tse3/listen/PhraseList.h" 00021 00022 #include "tse3/Notifier.h" 00023 #include "tse3/Serializable.h" 00024 #include "tse3/listen/Phrase.h" 00025 00026 #include <string> 00027 #include <vector> 00028 #include <cstddef> 00029 00030 namespace TSE3 00031 { 00049 class PhraseList : public Notifier<PhraseListListener>, 00050 public Listener<PhraseListener>, 00051 public Serializable 00052 { 00053 public: 00054 00060 static const std::string newPhraseString; 00061 00068 static const std::string importedString; 00069 00076 static const std::string mergedPhraseString; 00077 00084 static const std::string explodedPhraseString; 00085 00089 PhraseList(); 00090 00095 virtual ~PhraseList(); 00096 00102 size_t size() const { return list.size(); } 00103 00114 Phrase *operator[](size_t n) const { return list[n]; } 00115 00122 Phrase *phrase(const std::string &title) const; 00123 00131 size_t index(const Phrase *phrase) const; 00132 00143 void erase(Phrase *phrase); 00144 00167 void remove(Phrase *phrase); 00168 00184 void insert(Phrase *phrase); 00185 00200 std::string newPhraseTitle 00201 (const std::string &baseName = newPhraseString); 00202 00206 virtual void Phrase_TitleAltered(Phrase *); 00207 00211 virtual void Notifier_Deleted(Phrase *); 00212 00216 virtual void save(std::ostream &o, int i) const; 00217 00224 virtual void load(std::istream &i, SerializableLoadInfo &info); 00225 00226 friend class Phrase; 00227 00228 private: 00229 00230 PhraseList &operator=(const PhraseList &); 00231 PhraseList(const PhraseList &); 00232 00237 void insertInList(Phrase *phrase); 00238 00248 void phraseTitleChanged(Phrase *p); 00249 00254 void loadPhraseEvents(std::istream &i, int filePPQN, 00255 std::string &title); 00256 00257 std::vector<Phrase*> list; 00258 }; 00259 } 00260 00261 #endif