Sayonara Player
ArtistMatch.h
1 /* ArtistMatch.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 ARTISTMATCH_H
22 #define ARTISTMATCH_H
23 
24 #include "Utils/Pimpl.h"
25 #include <QString>
26 
27 namespace LastFM
28 {
30  {
31  PIMPL(ArtistMatch)
32 
33  public:
34 
35  struct ArtistDesc
36  {
37  QString artist_name;
38  QString mbid;
39 
40  ArtistDesc(const QString& artist_name, const QString& mbid);
41 
42  bool operator ==(const ArtistDesc& other) const;
43  bool operator <(const ArtistDesc& other) const;
44  bool operator <=(const ArtistDesc& other) const;
45 
46  QString to_string() const;
47  };
48 
52  enum class Quality : uint8_t
53  {
54  Poor = 0,
55  Well = 1,
56  Very_Good = 2
57  };
58 
59 
60  ArtistMatch();
61  explicit ArtistMatch(const QString& artist_name);
62  ArtistMatch(const ArtistMatch& other);
63 
64  virtual ~ArtistMatch();
65 
70  bool is_valid() const;
71 
77  bool operator ==(const ArtistMatch& am) const;
78  ArtistMatch& operator =(const ArtistMatch& other);
79 
85  void add(const ArtistDesc& artist, double match);
86 
92  QMap<ArtistDesc, double> get(Quality q) const;
93 
98  QString get_artist_name() const;
99 
104  QString to_string() const;
105  };
106 }
107 
108 #endif // ARTISTMATCH_H
QString to_string() const
converts the artist match to string
void add(const ArtistDesc &artist, double match)
adds an artist string to the corresponding bin
bool is_valid() const
checks, if structure is valid.
bool operator==(const ArtistMatch &am) const
Compares two ArtistMatch structures.
Definition: ArtistMatch.h:29
QString get_artist_name() const
get the corresponding artist name of the ArtistMatch structure
Definition: ArtistMatch.h:35
Definition: ArtistMatch.h:27
Definition: org_mpris_media_player2_adaptor.h:21
Quality
The Quality enum used to access the bin of interest. See ArtistMatch::get(Quality q) ...
Definition: ArtistMatch.h:52