ocarina/core/tags/genre.cpp
Anna Schumaker 8545837672 Genre: Add functions for looking up or creating Genre tags
The genre_db should really be controlled from within the Genre tag,
so this patch adds functions to find or create Genre tags to the tags
namespace.

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

36 lines
534 B
C++

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