Sayonara Player
ArtistMatch.h
1 /* ArtistMatch.h */
2 
3 /* Copyright (C) 2011-2016 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 
22 
23 #ifndef ARTISTMATCH_H
24 #define ARTISTMATCH_H
25 
26 #include <QMap>
27 #include <QString>
28 #include <QObject>
29 
30 
32 
33 
34 
35 public:
36 
37  struct ArtistDesc {
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 : quint8 {
54  Poor = 0,
55  Well = 1,
56  Very_Good = 2
57  };
58 
59 
60  ArtistMatch();
61  ArtistMatch(const QString& artist_name);
62  ArtistMatch(const ArtistMatch& other);
63 
68  bool is_valid() const;
69 
75  bool operator ==(const ArtistMatch& am) const;
76 
82  void add(const ArtistDesc& artist, double match);
83 
89  QMap<ArtistDesc, double> get(Quality q) const;
90 
95  QString get_artist_name() const;
96 
101  QString to_string() const;
102 
103 
104 private:
105  QMap<ArtistDesc, double> _very_good;
108 
109  QString _artist;
110 
111 };
112 
113 
114 
115 
116 #endif // ARTISTMATCH_H
Definition: ArtistMatch.h:37
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:53
Definition: ArtistMatch.h:31
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