ocarina/core/tags/artist.cpp
Anna Schumaker bac54857fd Artist: Add functions for looking up or creating Artist tags
The artist_db should really be controlled from within the Artist tag, so
this patch creates a new tags namespace containing functions that will
find or create tags as they are requested.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00

36 lines
547 B
C++

/**
* @file
* Copyright 2014 (c) Anna Schumaker.
*/
#include <core/tags/artist.h>
static Database<Artist> artist_db("artist.db", true);
Artist :: Artist() : GenericTag() {}
Artist :: Artist(const std::string &name)
: GenericTag(name)
{
}
void tags :: init_artist_db()
{
artist_db.load();
}
Artist *tags :: get_artist(const std::string &name)
{
Artist *ret = artist_db.find(name);
if (ret)
return ret;
return artist_db.insert(Artist(name));
}
Artist *tags :: get_artist(const unsigned int index)
{
return artist_db.at(index);
}