/*
* Copyright (C) 2013 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see .
*/
#ifndef _AUDIO_TYPES_HPP_
#define _AUDIO_TYPES_HPP_
#include
#include
#include
#include
#include
#include
namespace Database {
class Artist;
class Release;
class Track;
class PlaylistEntry;
class Genre
{
public:
typedef Wt::Dbo::ptr pointer;
typedef Wt::Dbo::dbo_traits::IdType id_type;
Genre();
Genre(const std::string& name);
// Find utility
static pointer getByName(Wt::Dbo::Session& session, const std::string& name);
static pointer getNone(Wt::Dbo::Session& session);
static std::vector getByFilter(Wt::Dbo::Session& session, SearchFilter filter, int offset = -1, int size = -1);
static std::vector getAll(Wt::Dbo::Session& session, int offset = -1, int size = -1);
// MVC models for the user interface
// Genre ID, name, track count
typedef boost::tuple UIQueryResult;
static Wt::Dbo::Query getUIQuery(Wt::Dbo::Session& session, SearchFilter filter);
static void updateUIQueryModel(Wt::Dbo::Session& session, Wt::Dbo::QueryModel& model, SearchFilter filter, const std::vector& columnNames = std::vector());
// Create utility
static pointer create(Wt::Dbo::Session& session, const std::string& name);
// Accessors
const std::string& getName(void) const { return _name; }
bool isNone(void) const;
const Wt::Dbo::collection< Wt::Dbo::ptr