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 <QMap>
25 #include <QObject>
26 
28 {
29 
30 public:
31 
32  struct ArtistDesc {
33  QString artist_name;
34  QString mbid;
35 
36  ArtistDesc(const QString& artist_name, const QString& mbid);
37 
38  bool operator ==(const ArtistDesc& other) const;
39  bool operator <(const ArtistDesc& other) const;
40  bool operator <=(const ArtistDesc& other) const;
41 
42  QString to_string() const;
43  };
44 
48  enum class Quality : quint8
49  {
50  Poor = 0,
51  Well = 1,
52  Very_Good = 2
53  };
54 
55 
56  ArtistMatch();
57  explicit ArtistMatch(const QString& artist_name);
58  ArtistMatch(const ArtistMatch& other);
59  virtual ~ArtistMatch();
60 
65  bool is_valid() const;
66 
72  bool operator ==(const ArtistMatch& am) const;
73 
79  void add(const ArtistDesc& artist, double match);
80 
86  QMap<ArtistDesc, double> get(Quality q) const;
87 
92  QString get_artist_name() const;
93 
98  QString to_string() const;
99 
100 
101 private:
102  QMap<ArtistDesc, double> _very_good;
105 
106  QString _artist;
107 };
108 
109 #endif // ARTISTMATCH_H
Definition: ArtistMatch.h:32
bool is_valid() const
checks, if structure is valid.
Quality
The Quality enum used to access the bin of interest. See ArtistMatch::get(Quality q) ...
Definition: ArtistMatch.h:48
Definition: ArtistMatch.h:27
void add(const ArtistDesc &artist, double match)
adds an artist string to the corresponding bin
QString get_artist_name() const
get the corresponding artist name of the ArtistMatch structure
Definition: org_mpris_media_player2_adaptor.h:21