00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
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,
00148 Type_Unknown,
00149 Type_TSE3MDL,
00150 Type_TSE2MDL,
00151 Type_Midi
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