Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

/home/pete/Work/TSE3.svn/tse3/src/tse3/TSE3MDL.h

Go to the documentation of this file.
00001 /*
00002  * @(#)TSE3MDL.h 3.00 20 August 2000
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_TSE3MDL_H
00018 #define TSE3_TSE3MDL_H
00019 
00020 #include "tse3/Serializable.h"
00021 
00022 #include <string>
00023 #include <cstddef>
00024 #include <iostream>
00025 
00026 namespace TSE3
00027 {
00028     class Song;
00029 
00043     class TSE3MDL
00044     {
00045         public:
00055             TSE3MDL(const std::string &appname = "",
00056                     int                verbose = 0,
00057                     std::ostream      &diag    = std::cout);
00058 
00070             void save(const std::string &filename, const Song *song);
00071 
00075             void save(std::ostream &out, const Song *song);
00076 
00088             Song *load(const std::string &filename, Progress *progress = 0);
00089 
00090             static const int MajorVersion = 100;
00091             static const int MinorVersion = 100;
00092 
00093         private:
00094 
00103             class Header : public Serializable
00104             {
00105                 public:
00106                     Header(const std::string &originator);
00107                     virtual ~Header();
00108                     virtual void save(std::ostream &out, int indentLevel);
00109                     virtual void load(std::istream &in,
00110                                       SerializableLoadInfo &info);
00111                 private:
00112                     std::string originator;
00113                     Header &operator=(const Header &);
00114                     Header(const Header &);
00115             } header;
00116 
00117             int           verbose;
00118             std::ostream &diag;
00119     };
00120 
00134     class FileRecogniser
00135     {
00136         public:
00137 
00143             FileRecogniser(const std::string &filename);
00144 
00145             enum
00146             {
00147                 Type_Error,   // file could not be read (does it exist?)
00148                 Type_Unknown, // file type not recognised
00149                 Type_TSE3MDL, // TSE3MDL file
00150                 Type_TSE2MDL, // TSEMDL (TSE2) file
00151                 Type_Midi     // MIDI file
00152             };
00153 
00164             int type() const { return _type; }
00165 
00171             size_t size() const { return _size; }
00172 
00191             Song *load(Progress *progress);
00192 
00193         private:
00194 
00195             std::string filename;
00196             int         _type;
00197             size_t      _size;
00198     };
00199 }
00200 
00201 #endif

Generated on Wed May 25 14:45:09 2005 for TSE3 by doxygen 1.3.2