Hydrogen - Linux Drum Machine
Main Page | Class Hierarchy | Compound List | File List | Compound Members

LocalFileMng.h

00001 /*
00002  * Hydrogen
00003  * Copyright(c) 2002-2003 by Alex >Comix< Cominu [comix@users.sourceforge.net]
00004  *
00005  * http://hydrogen.sourceforge.net
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY, without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  * $Id: LocalFileMng.h,v 1.17 2003/05/07 20:07:58 comix Exp $
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 // forward declaration
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 

 
 
Hydrogen (c) 2002..2003 Comix