ocarina/lib/group.cpp
Anna Schumaker 7b7414c755 group: Implement basic groups support
I only handle the "All Music", "Library" and "Banned" groups at the
moment but I'll eventually add in more features (in future versions).

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:53 -04:00

32 lines
713 B
C++

/*
* Copyright 2013 (c) Anna Schumaker.
*/
#include <group.h>
#include <index.h>
Index group_index("");
void group :: add(const std::string &name, unsigned int track_id)
{
if ((name == "All Music") || (name == "Library") || (name == "Banned"))
group_index.insert(name, track_id);
}
void group :: del(const std::string &name, unsigned int track_id)
{
if ((name == "All Music") || (name == "Library") || (name == "Banned"))
group_index.remove(name, track_id);
}
void group :: list(std::list<std::string> &res)
{
res.push_back("All Music");
res.push_back("Library");
res.push_back("Banned");
}
const std::set<unsigned int> &group :: get_tracks(const std::string &name)
{
return group_index[name];
}