// Music Library // // Douglas Thrift // // $Id$ #ifndef _Music_hpp_ #define _Music_hpp_ #include #include namespace Music { struct Artist; struct Album; struct Song; class Library { SQLite3::Connection connection; SQLite3::Statement artists, artistAlbums; SQLite3::Statement albumSongs; SQLite3::Statement songs; public: Library(); _L GetArtists() const; _L GetAlbums() const; _L GetSongs() const; friend struct Artist; friend struct Album; friend struct Song; }; class Artist { const Library *library; int id; std::string name; inline Artist(const Library *library, int id, const std::string &name) : library(library), id(id), name(name) {} public: inline int GetId() const { return id; } inline const std::string &GetName() const { return name; } _L GetAlbums() const; _L GetSongs() const; friend struct Library; friend struct Album; friend struct Song; }; class Album { const Library *library; int id; std::string name; int artist; int year; inline Album(const Library *library, int id, const std::string &name, int artist, int year) : library(library), id(id), name(name), artist(artist), year(year) {} public: inline int GetId() const { return id; } inline const std::string &GetName() const { return name; } Artist GetArtist() const; inline int GetYear() const { return year; } _L GetSongs() const; friend struct Library; friend struct Artist; friend struct Song; }; class Song { const Library *library; int id; std::string name, path; int album, track; inline Song(const Library* library, int id, const std::string &name, const std::string &path, int album, int track) : id(id), name(name), path(path), album(album), track(track) {} public: inline int GetId() const { return id; } inline const std::string &GetName() const { return name; } inline const std::string &GetPath() const { return path; } Artist GetArtist() const; Album GetAlbum() const; inline int GetTrack() const { return track; } friend struct Library; friend struct Artist; friend struct Album; }; } #endif//_Music_hpp_