Sayonara Player
DatabaseArtists.h
1 /* DatabaseArtists.h */
2 
3 /* Copyright (C) 2011-2016 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 
23 #ifndef DATABASEARTISTS_H
24 #define DATABASEARTISTS_H
25 
26 #include "Database/DatabaseModule.h"
27 #include "Components/Library/Sorting.h"
28 
29 
30 class Artist;
31 class ArtistList;
33 {
34 
35 private:
36  QString _fetch_query;
37  QString _create_order_string(SortOrder sort);
38 
39 protected:
40  void set_artist_fetch_query(const QString& query);
41 
42 
43 public:
44  DatabaseArtists(QSqlDatabase db, quint8 db_id);
45 
46  virtual bool db_fetch_artists(SayonaraQuery& q, ArtistList& result);
47 
48  virtual int getArtistID (const QString& artist);
49  virtual bool getArtistByID(int id, Artist& artist);
50  virtual int getMaxArtistID();
51 
52  virtual bool getAllArtists(ArtistList& result, SortOrder sortorder = SortOrder::ArtistNameAsc, bool also_empty=false);
53 
54  virtual bool getAllArtistsByAlbum(int album, ArtistList& result, SortOrder sortorder = SortOrder::ArtistNameAsc);
55 
56  virtual bool getAllArtistsBySearchString(Filter filter, ArtistList& result, SortOrder sortorder = SortOrder::ArtistNameAsc);
57 
58  virtual int insertArtistIntoDatabase (const QString& artist);
59  virtual int insertArtistIntoDatabase (const Artist& artist);
60  virtual int updateArtist(const Artist& artist);
61 
62 };
63 
64 #endif // DATABASEARTISTS_H
Definition: Filter.h:31
Definition: DatabaseArtists.h:32
Definition: SayonaraQuery.h:32
Definition: DatabaseModule.h:54
ArtistList.
Definition: Artist.h:64
The Artist class.
Definition: Artist.h:36