Sayonara Player
ArtistMatch.h
1 /* ArtistMatch.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 ARTISTMATCH_H
22 #define ARTISTMATCH_H
23 
24 #include "Utils/Pimpl.h"
25 
26 #include <QList>
27 #include <QString>
28 
29 namespace DynamicPlayback
30 {
32  {
33  PIMPL(ArtistMatch)
34 
35  public:
36 
37  struct Entry
38  {
39  QString artist;
40  QString mbid;
41  double similarity{-1.0};
42 
43  Entry() = default;
44  Entry(const QString& artist, const QString& mbid, double similarity);
45 
46  bool isValid() const;
47 
48  bool operator==(const Entry& other) const;
49  };
50 
54  enum class Quality : uint8_t
55  {
56  Poor = 0,
57  Good,
58  VeryGood,
59  Excellent
60  };
61 
62  ArtistMatch();
63  explicit ArtistMatch(const QString& artist_name);
64  ArtistMatch(const ArtistMatch& other);
65 
66  virtual ~ArtistMatch();
67 
72  bool isValid() const;
73 
79  bool operator==(const ArtistMatch& am) const;
80  ArtistMatch& operator=(const ArtistMatch& other);
81 
87  void add(const Entry& entry);
88 
95 
100  QString artistName() const;
101 
106  QString toString() const;
107 
108  static ArtistMatch fromString(const QString& data);
109  };
110 }
111 
112 #endif // ARTISTMATCH_H
DynamicPlayback::ArtistMatch::get
QList< Entry > get(Quality q) const
get bin by quality
QList
Definition: EngineUtils.h:33
DynamicPlayback::ArtistMatch::operator==
bool operator==(const ArtistMatch &am) const
Compares two ArtistMatch structures.
DynamicPlayback::ArtistMatch::add
void add(const Entry &entry)
adds an artist string to the corresponding bin
DynamicPlayback::ArtistMatch::Entry
Definition: ArtistMatch.h:38
DynamicPlayback::ArtistMatch
Definition: ArtistMatch.h:32
DynamicPlayback::ArtistMatch::Quality
Quality
The Quality enum used to access the bin of interest. See ArtistMatch::get(Quality q)
Definition: ArtistMatch.h:55
DynamicPlayback::ArtistMatch::toString
QString toString() const
converts the artist match to string
DynamicPlayback::ArtistMatch::artistName
QString artistName() const
get the corresponding artist name of the ArtistMatch structure
DynamicPlayback::ArtistMatch::isValid
bool isValid() const
checks, if structure is valid.