2013-10-27 17:25:26 -04:00
|
|
|
/*
|
|
|
|
* Copyright 2013 (c) Anna Schumaker.
|
|
|
|
*/
|
|
|
|
#ifndef OCARINA_LIBRARY_H
|
|
|
|
#define OCARINA_LIBRARY_H
|
|
|
|
|
|
|
|
#include <database.h>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace library
|
|
|
|
{
|
|
|
|
|
|
|
|
enum DB_Type {
|
|
|
|
DB_ALBUM,
|
|
|
|
DB_ARTIST,
|
|
|
|
DB_GENRE,
|
|
|
|
DB_LIBRARY,
|
|
|
|
DB_TRACK,
|
|
|
|
};
|
|
|
|
|
2013-11-10 16:09:31 -05:00
|
|
|
|
|
|
|
class Artist : public DatabaseEntry {
|
|
|
|
public:
|
|
|
|
std:: string name;
|
|
|
|
|
|
|
|
Artist();
|
|
|
|
Artist(const std :: string &);
|
|
|
|
void read(File &);
|
|
|
|
void write(File &);
|
|
|
|
#ifdef CONFIG_DEBUG
|
|
|
|
void print();
|
|
|
|
#endif /* CONFIG_DEBUG */
|
|
|
|
bool operator==(const Artist &);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-11-10 16:45:52 -05:00
|
|
|
class Album : public DatabaseEntry {
|
|
|
|
public:
|
|
|
|
std:: string name;
|
|
|
|
unsigned int year;
|
|
|
|
unsigned int artist_id;
|
|
|
|
|
|
|
|
Album();
|
|
|
|
Album(const std :: string &, unsigned int, unsigned int);
|
|
|
|
void read(File &);
|
|
|
|
void write(File &);
|
|
|
|
#ifdef CONFIG_DEBUG
|
|
|
|
void print();
|
|
|
|
#endif /* CONFIG_DEBUG */
|
|
|
|
bool operator==(const Album &);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Genre : public DatabaseEntry {
|
|
|
|
public:
|
|
|
|
std:: string name;
|
|
|
|
|
|
|
|
Genre();
|
|
|
|
Genre(const std :: string &);
|
|
|
|
void read(File &);
|
|
|
|
void write(File &);
|
|
|
|
#ifdef CONFIG_DEBUG
|
|
|
|
void print();
|
|
|
|
#endif /* CONFIG_DEBUG */
|
|
|
|
bool operator==(const Genre &);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-10-27 17:25:26 -04:00
|
|
|
class Library : public DatabaseEntry {
|
|
|
|
public:
|
|
|
|
std::string root_path;
|
|
|
|
bool enabled;
|
|
|
|
|
2013-11-03 16:03:01 -05:00
|
|
|
Library();
|
2013-10-27 17:25:26 -04:00
|
|
|
Library(const std::string &, bool);
|
|
|
|
void read(File &);
|
|
|
|
void write(File &);
|
|
|
|
#ifdef CONFIG_DEBUG
|
|
|
|
void print();
|
|
|
|
#endif /* CONFIG_DEBUG */
|
|
|
|
bool operator==(Library &);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-11-03 16:03:01 -05:00
|
|
|
void init();
|
2013-10-27 17:25:26 -04:00
|
|
|
bool add_path(const std::string &);
|
|
|
|
void del_path(unsigned int);
|
2013-11-10 16:09:31 -05:00
|
|
|
void update_path(unsigned int);
|
2013-10-27 17:25:26 -04:00
|
|
|
#ifdef CONFIG_DEBUG
|
|
|
|
void print_db(DB_Type);
|
|
|
|
void reset();
|
|
|
|
#endif /* CONFIG_DEBUG */
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* OCARINA_LIBRARY_H */
|