Sayonara Player
Artists.h
1 /* DatabaseArtists.h */
2 
3 /* Copyright (C) 2011-2017 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 #ifndef DATABASEARTISTS_H
22 #define DATABASEARTISTS_H
23 
24 #include "Database/SearchableModule.h"
25 #include "Utils/Library/Sortorder.h"
26 
27 namespace Library {class Filter;}
28 
29 class Artist;
30 class ArtistList;
31 
32 namespace DB
33 {
34  class Artists :
35  private SearchableModule
36  {
37  PIMPL(Artists)
38 
39  public:
40 
41  Artists(const QString& connection_name, DbId db_id, LibraryId library_id);
42  ~Artists();
43 
44  virtual bool db_fetch_artists(Query& q, ArtistList& result);
45 
46  virtual ArtistId getArtistID (const QString& artist);
47  virtual bool getArtistByID(int id, Artist& artist, bool also_empty=false);
48 
49  virtual bool getAllArtists(ArtistList& result, bool also_empty);
50  virtual bool getAllArtists(ArtistList& result, ::Library::SortOrder sortorder = ::Library::SortOrder::ArtistNameAsc, bool also_empty=false);
51  virtual bool getAllArtistsBySearchString(const ::Library::Filter& filter, ArtistList& result, ::Library::SortOrder sortorder = ::Library::SortOrder::ArtistNameAsc);
52 
53  virtual ArtistId insertArtistIntoDatabase(const QString& artist);
54  virtual ArtistId insertArtistIntoDatabase(const Artist& artist);
55 
56  virtual ArtistId updateArtist(const Artist& artist);
57 
58  virtual void updateArtistCissearch();
59 
60  protected:
61  virtual QString artistid_field() const=0;
62  virtual QString artistname_field() const=0;
63 
64  private:
65  QString _create_order_string(::Library::SortOrder sort);
66 
67  virtual QString fetch_query_artists(bool also_empty=false) const;
68  };
69 }
70 
71 #endif // DATABASEARTISTS_H
Definition: Query.h:36
Definition: SearchableModule.h:32
Definition: Artists.h:34
ArtistList.
Definition: Artist.h:69
An interface class needed when implementing a library plugin.
Definition: CachingThread.h:31
The Artist class.
Definition: Artist.h:35