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 #include <QMap>
27 
28 namespace LastFM
29 {
31  {
32  PIMPL(ArtistMatch)
33 
34  public:
35 
36  struct ArtistDesc
37  {
38  QString artist_name;
39  QString mbid;
40 
41  ArtistDesc(const QString& artist_name, const QString& mbid);
42 
43  bool operator ==(const ArtistDesc& other) const;
44  bool operator <(const ArtistDesc& other) const;
45  bool operator <=(const ArtistDesc& other) const;
46 
47  QString to_string() const;
48  };
49 
53  enum class Quality : uint8_t
54  {
55  Poor = 0,
56  Well = 1,
57  Very_Good = 2
58  };
59 
60 
61  ArtistMatch();
62  explicit ArtistMatch(const QString& artist_name);
63  ArtistMatch(const ArtistMatch& other);
64 
65  virtual ~ArtistMatch();
66 
71  bool is_valid() const;
72 
78  bool operator ==(const ArtistMatch& am) const;
79  ArtistMatch& operator =(const ArtistMatch& other);
80 
86  void add(const ArtistDesc& artist, double match);
87 
94 
99  QString get_artist_name() const;
100 
105  QString to_string() const;
106  };
107 }
108 
109 #endif // ARTISTMATCH_H
QString to_string() const
converts the artist match to string
QMap< ArtistDesc, double > get(Quality q) const
get bin by quality
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:30
QString get_artist_name() const
get the corresponding artist name of the ArtistMatch structure
Definition: ArtistMatch.h:36
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:53