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