AlbumTrack.h 1.01 KB
Newer Older
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
1
2
3
4
5
6
7
#ifndef ALBUMTRACK_H
#define ALBUMTRACK_H

#include <sqlite3.h>
#include <string>

#include "IAlbumTrack.h"
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
8
#include "Cache.h"
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
9
10
11

class Album;

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

class AlbumTrack : public IAlbumTrack, public Cache<AlbumTrack, IAlbumTrack, policy::AlbumTrackTable>
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
22
23
{
    public:
24
        AlbumTrack( sqlite3* dbConnection, sqlite3_stmt* stmt );
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
25

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
26
27
        virtual const std::string& genre();
        virtual const std::string& title();
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
28
        virtual unsigned int trackNumber();
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
29
        virtual std::shared_ptr<IAlbum> album();
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
30

31
32
        static bool createTable( sqlite3* dbConnection );

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
33
34
35
36
37
38
39
40
    private:
        sqlite3* m_dbConnection;
        unsigned int m_id;
        std::string m_title;
        std::string m_genre;
        unsigned int m_trackNumber;
        unsigned int m_albumId;

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
41
42
43
        std::shared_ptr<Album> m_album;

        friend class Cache<AlbumTrack, IAlbumTrack, policy::AlbumTrackTable>;
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
44
45
46
};

#endif // ALBUMTRACK_H