1 #ifndef DATABASE_HPP_INCLUDED
2 #define DATABASE_HPP_INCLUDED
4 #include "Utilities.hpp"
10 #include "boost/filesystem.hpp"
11 #include <boost/filesystem/fstream.hpp>
14 extern int verbose_flag;
40 Data(std::string name,std::string fileMelody , std::string fileChords);
47 std::string
getName()
const __attribute__((pure));
118 Style(
const boost::filesystem::path& p,
const std::string& name);
129 std::ifstream& file() __attribute__((pure));
132 std::unique_ptr<std::fstream> m_inFile;
133 boost::filesystem::path m_path;
158 void addEntry(std::string style, std::string fileMelody , std::string fileChords , std::string name);
167 std::vector<std::string>
listEntries(
const std::string& style);
175 Data getEntry(
const std::string& name,
const std::string& style)
const;
196 void deleteEntry(std::string style,std::string name);
203 std::map<std::string,Style> m_styles;
void setName(std::string d)
Sets the name of the data.
Definition: Database.hpp:23
std::string getName() const __attribute__((pure))
void addEntry(const std::string &style, const Data &e)
Add given entry to the given style.
std::vector< Data > readAllEntries(const std::string &style)
This file defines all the data structures related to music objects.
std::vector< std::string > listEntries(const std::string &style)
get the name of the entries stored under the given style
ChordProgression getChords() const __attribute__((pure))
void setChords(ChordProgression c)
Sets the chords.
void deleteEntry(std::string style, std::string name)
delete an entry in the given style
Describes a melody.
Definition: Music.hpp:629
Melody getMelody() const __attribute__((pure))
Data(std::string name, ChordProgression c, Melody m)
constructor for Data
Data getEntry(const std::string &name, const std::string &style) const
void setContent(const std::string &str)
std::vector< Chord > ChordProgression
ChordProgression is the class used to give the set of chords used.
Definition: Music.hpp:592
void setMelody(Melody m)
Sets the melody.
Definition: Database.hpp:105
input operator for NoteName The format is capital or small letters for the NoteName ...
Definition: Database.hpp:101
std::ostream & operator<<(std::ostream &o, NoteName n)
output operator for NoteName The format is capital letters for the NoteName
std::vector< std::string > getAvailableStyles() const
returns the name of the known styles
Database()
Constructor of a db It scans the directory looking for available styles.