Album.h 1.11 KB
Newer Older
1 2 3
#ifndef ALBUM_H
#define ALBUM_H

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
4
#include <memory>
5 6
#include <sqlite3.h>

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
7
#include "Cache.h"
8 9
#include "IAlbum.h"

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
10 11 12 13 14 15 16 17 18 19
namespace policy
{
struct AlbumTable
{
    static const std::string Name;
    static const std::string CacheColumn;
};
}

class Album : public IAlbum, public Cache<Album, IAlbum, policy::AlbumTable>
20 21 22 23 24 25 26 27 28
{
    public:
        Album( sqlite3* dbConnection, sqlite3_stmt* stmt );

        virtual const std::string& name();
        virtual unsigned int releaseYear();
        virtual const std::string& shortSummary();
        virtual const std::string& artworkUrl();
        virtual time_t lastSyncDate();
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
29
        virtual const std::vector<std::shared_ptr<IAlbumTrack>>& tracks();
30

31
        static bool createTable( sqlite3* dbConnection );
32 33 34 35 36 37 38 39 40 41

    protected:
        sqlite3* m_dbConnection;
        unsigned int m_id;
        std::string m_name;
        unsigned int m_releaseYear;
        std::string m_shortSummary;
        std::string m_artworkUrl;
        time_t m_lastSyncDate;

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
42 43 44
        std::vector<std::shared_ptr<IAlbumTrack>>* m_tracks;

        friend class Cache<Album, IAlbum, policy::AlbumTable>;
45 46 47
};

#endif // ALBUM_H