ocarina/include/core/tags/album.h

73 lines
1.8 KiB
C
Raw Normal View History

/**
* Copyright 2014 (c) Anna Schumaker.
*/
#ifndef OCARINA_CORE_TAGS_ALBUM_H
#define OCARINA_CORE_TAGS_ALBUM_H
#include <core/database.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()
*/
struct album : public db_entry {
unsigned int al_year; /* This album's year. */
std::string al_name; /* This album's name. */
std::string al_lower; /* This album's name (lowercased). */
album(); /**< Album tag constructor */
/**
* Album tag constructor
*/
album(const std::string &);
/**
* 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.
*/
void read(file &);
/**
* Write album information to file.
*
* @param file The file to write to.
*/
void write(file &);
};
/* Called to initialize the album database. */
void album_db_init();
/* Called to clean up the album database. */
void album_db_deinit();
/* Called to find an album tag by name and year. */
struct album *album_find(const std::string &, unsigned int);
/* Called to get an album tag with a specific index. */
struct album *album_get(const unsigned int);
/* Called to compare two album tags. */
int album_compare(struct album *, struct album *);
#endif /* OCARINA_CORE_TAGS_ALBUM_H */