2014-11-08 20:53:08 -05:00
|
|
|
/**
|
|
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
|
|
*/
|
|
|
|
#ifndef OCARINA_CORE_TAGS_ALBUM_H
|
|
|
|
#define OCARINA_CORE_TAGS_ALBUM_H
|
|
|
|
|
|
|
|
#include <core/tags/generic.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Album tag is used to store the name and year of albums
|
|
|
|
* added to the tag database.
|
|
|
|
*
|
|
|
|
* When writing an Album tag to disk, write out the _year field and
|
|
|
|
* then call GenericTag to write anything else.
|
|
|
|
*
|
|
|
|
* ... << year1 << GenericTag::write()
|
|
|
|
* ... << year2 << GenericTag::write()
|
|
|
|
* ... << year3 << GenericTag::write()
|
|
|
|
*/
|
2015-10-22 08:16:53 -04:00
|
|
|
struct album : public GenericTag {
|
2015-10-22 09:23:49 -04:00
|
|
|
unsigned int al_year; /* This album's year. */
|
2014-11-08 20:53:08 -05:00
|
|
|
|
2015-10-22 08:16:53 -04:00
|
|
|
album(); /**< Album tag constructor */
|
2014-11-08 20:53:08 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Album tag constructor
|
|
|
|
*
|
|
|
|
* @param name Album name
|
|
|
|
* @param year Album year
|
|
|
|
*/
|
2015-10-22 08:16:53 -04:00
|
|
|
album(const std::string &, unsigned int);
|
|
|
|
album(const std::string &);
|
2014-11-08 20:53:08 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The album's primary key is the concatenation of year
|
|
|
|
* and name, allowing for multiple albums with the same
|
|
|
|
* name but released at different times.
|
|
|
|
*
|
|
|
|
* @return Album::_year / GenericTag::primary_key() (Example: "1998/Hyrule Symphony")
|
|
|
|
*/
|
|
|
|
const std::string primary_key() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Read album information from file.
|
|
|
|
*
|
|
|
|
* @param file The file to read from.
|
|
|
|
*/
|
2015-09-10 08:00:42 -04:00
|
|
|
void read(file &);
|
2014-11-08 20:53:08 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Write album information to file.
|
|
|
|
*
|
|
|
|
* @param file The file to write to.
|
|
|
|
*/
|
2015-09-10 08:00:42 -04:00
|
|
|
void write(file &);
|
2014-11-08 20:53:08 -05:00
|
|
|
};
|
|
|
|
|
2014-11-16 14:47:51 -05:00
|
|
|
|
2015-09-24 11:18:48 -04:00
|
|
|
/* Called to initialize the album database. */
|
|
|
|
void album_db_init();
|
2014-11-16 14:47:51 -05:00
|
|
|
|
2015-09-24 11:18:48 -04:00
|
|
|
/* Called to clean up the album database. */
|
|
|
|
void album_db_deinit();
|
2015-09-24 11:09:59 -04:00
|
|
|
|
2015-09-24 11:13:12 -04:00
|
|
|
/* Called to find an album tag by name and year. */
|
|
|
|
struct album *album_find(const std::string &, unsigned int);
|
|
|
|
|
2015-09-24 11:09:59 -04:00
|
|
|
/* Called to get an album tag with a specific index. */
|
|
|
|
struct album *album_get(const unsigned int);
|
|
|
|
|
2014-11-08 20:53:08 -05:00
|
|
|
#endif /* OCARINA_CORE_TAGS_ALBUM_H */
|