ocarina/include/core/tags/album.h

94 lines
2.1 KiB
C++

/**
* 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()
*/
class Album : public GenericTag {
private:
unsigned int _year; /**< The year associated with this Album. */
public:
Album(); /**< Album tag constructor */
/**
* Album tag constructor
*
* @param name Album name
* @param year Album year
*/
Album(const std::string &, unsigned int);
/**
* 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 access the year associated with this album.
*
* @return Album::_year.
*/
unsigned int year();
};
namespace tags
{
/** Called to read the album_db from disk. */
void init_album_db();
/**
* Called to look up an Album tag by name and year. If no
* existing tag is found a new one will be created and
* returned to the caller.
*
* @param name The name of the album.
* @param year The year of the album.
* @return A matching Album tag.
*/
Album *get_album(const std::string &, unsigned int);
/**
* Called to look up an Album tag by tag index.
*
* @param index The index of the Album tag.
* @return A matching Album tag or NULL.
*/
Album *get_album(const unsigned int);
} /* Namespace: tags */
#endif /* OCARINA_CORE_TAGS_ALBUM_H */