Sayonara Player
Artists.h
1/* DatabaseArtists.h */
2
3/* Copyright (C) 2011-2020 Michael Lugmair (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 "Query.h"
25
26namespace Library
27{
28 class Filter;
29}
30
31class Artist;
32class ArtistList;
33
34namespace DB
35{
36 class Artists
37 {
38 public:
39 Artists();
40 virtual ~Artists();
41
42 virtual bool dbFetchArtists(Query& q, ArtistList& result) const;
43
44 [[nodiscard]] virtual ArtistId getArtistID(const QString& artist) const;
45 virtual bool getArtistByID(ArtistId id, Artist& artist) const;
46 virtual bool getArtistByID(ArtistId id, Artist& artist, bool alsoEmpty) const;
47
48 virtual bool getAllArtists(ArtistList& result, bool alsoEmpty) const;
49 virtual bool getAllArtistsBySearchString(const ::Library::Filter& filter, ArtistList& result) const;
50
51 virtual bool deleteArtist(ArtistId id);
52
53 virtual ArtistId insertArtistIntoDatabase(const QString& artist);
54 [[maybe_unused]] virtual ArtistId insertArtistIntoDatabase(const Artist& artist);
55
56 protected:
57 [[nodiscard]] virtual QString artistIdField() const = 0;
58 [[nodiscard]] virtual QString artistNameField() const = 0;
59 [[nodiscard]] virtual QString trackView() const = 0;
60 [[nodiscard]] virtual QString trackSearchView() const = 0;
61
62 virtual Module* module() = 0;
63 [[nodiscard]] virtual const Module* module() const = 0;
64
65 virtual void updateArtistCissearch();
66 virtual void deleteAllArtists();
67
68 private:
69 [[nodiscard]] virtual QString fetchQueryArtists(bool also_empty) const;
70 };
71}
72
73#endif // DATABASEARTISTS_H
Definition: Artist.h:61
Definition: Artist.h:34
Definition: Artists.h:37
Definition: Module.h:33
Definition: Query.h:37
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:31