1 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html 2 3 #ifndef SPECTMORPH_INDEX_HH 4 #define SPECTMORPH_INDEX_HH 5 6 #include <string> 7 #include <vector> 8 9 namespace SpectMorph 10 { 11 12 enum IndexType 13 { 14 INDEX_INSTRUMENTS_DIR, 15 INDEX_FILENAME, 16 INDEX_NOT_DEFINED 17 }; 18 19 class Index 20 { 21 public: 22 struct Instrument 23 { 24 std::string smset; 25 std::string label; 26 }; 27 28 struct Group 29 { 30 std::string group; 31 std::vector<Instrument> instruments; 32 }; 33 34 private: 35 std::vector<std::string> m_smsets; 36 std::string m_smset_dir; 37 std::vector<Group> m_groups; 38 39 std::string m_expanded_filename; 40 std::string m_filename; 41 std::string m_dir; 42 bool m_load_ok; 43 44 public: 45 Index(); 46 47 void clear(); 48 bool load_file (const std::string& filename); 49 50 IndexType type() const; 51 std::string filename() const; 52 std::string expanded_filename() const; 53 std::string dir() const; 54 bool load_ok() const; 55 std::string label_to_smset (const std::string& label) const; 56 std::string smset_to_label (const std::string& smset) const; 57 58 const std::vector<Group>& groups() const; 59 60 const std::vector<std::string>& smsets() const; 61 std::string smset_dir() const; 62 }; 63 64 } 65 66 #endif 67