00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef LFILEMNG_H
00026 #define LFILEMNG_H
00027
00028 #include <iostream>
00029 #include <fstream>
00030 #include <vector>
00031 using std::vector;
00032 #include <dirent.h>
00033 #include <string>
00034 using std::string;
00035
00036 #include "Song.h"
00037 #include "Object.h"
00038 #include "PreferencesMng.h"
00039
00040
00041
00042 class TiXmlNode;
00043 class Note;
00044 class Instrument;
00045 class InstrumentList;
00046 class Sequence;
00047 class Pattern;
00048 class Song;
00049 class DrumkitInfo;
00050
00051
00055 class LocalFileMng : public Object{
00056 public:
00057 virtual string getClassName() { return "LocalFileMng"; }
00058
00060 LocalFileMng();
00061
00063 ~LocalFileMng();
00064
00065 vector<string> listUserDrumkits();
00066 vector<string> listSystemDrumkits();
00067 string getDrumkitDirectory( string drumkitName );
00068
00069 DrumkitInfo* loadDrumkit( string directory );
00070 int saveDrumkit( DrumkitInfo *info );
00071 void installDrumkit( string filename );
00072 int uninstallDrumkit( string drumkitName );
00073
00074 void writeXmlText( TiXmlNode *parent, string name, string text );
00075 void writeXmlText( TiXmlNode *parent, string name, float value );
00076 void writeXmlText( TiXmlNode *parent, string name, int value );
00077
00078 string readXmlString(TiXmlNode* parent, string nodeName, string defaultValue );
00079 bool readXmlBool( TiXmlNode* parent, string nodeName, bool defaultValue );
00080
00082 Song* loadSong(string filename);
00083
00085 void saveSong(Song *song, string filename);
00086
00087 };
00088
00089
00090
00091
00092
00093
00097 class SongReader : public Object {
00098 private:
00100 Pattern* getPattern(TiXmlNode* pattern, InstrumentList* instrList);
00101
00103 Sequence* getSequence(TiXmlNode* sequence, InstrumentList* instrList);
00104
00106 Note* getNote(TiXmlNode* node, InstrumentList *instrList);
00107
00108 public:
00109 virtual string getClassName() { return "SongReader"; }
00110
00112 SongReader();
00113
00115 ~SongReader();
00116
00117 Song* readSong(string filename);
00118 };
00119
00120
00121
00122
00123
00127 class SongWriter : public Object {
00128 private:
00129
00130 public:
00131 virtual string getClassName() { return "SongWriter"; }
00132
00134 SongWriter();
00135
00137 ~SongWriter();
00138
00139 void writeSong(Song *song, string filename);
00140 };
00141
00142
00143
00144
00145
00146
00147 #endif //LFILEMNG_H
00148
00149
00150
00151