Sayonara Player
LibraryItem.h
1 /* LibraryItem.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 _LIBRARY_ITEM_H_
22 #define _LIBRARY_ITEM_H_
23 
24 #include "Utils/Pimpl.h"
25 #include "Utils/typedefs.h"
26 #include <vector>
27 #include <QHash>
28 
29 using HashValue=uint32_t;
30 class QString;
31 
32 
41 {
42  PIMPL(CustomField)
43 
44 public:
45  CustomField(const QString& id, const QString& display_name, const QString& value);
46  CustomField(const CustomField& other);
47  CustomField(CustomField&& other);
48 
49  CustomField& operator=(const CustomField& other);
50  CustomField& operator=(CustomField&& other);
51 
52  ~CustomField();
53 
54  QString get_id() const;
55  QString get_display_name() const;
56  QString get_value() const;
57 };
58 
59 using CustomFieldList=std::vector<CustomField>;
60 
66 {
67  PIMPL(LibraryItem)
68 
69 public:
70  LibraryItem();
71  LibraryItem(const LibraryItem& other);
72  LibraryItem(LibraryItem&& other);
73 
74  LibraryItem& operator=(const LibraryItem& other);
75  LibraryItem& operator=(LibraryItem&& other);
76 
77  virtual ~LibraryItem();
78 
79  void add_custom_field(const CustomField& field);
80  void add_custom_field(const QString& id, const QString& display_name, const QString& value);
81 
82  const CustomFieldList& get_custom_fields() const;
83  QString get_custom_field(const QString& id) const;
84  QString get_custom_field(int idx) const;
85 
86  QString cover_download_url() const;
87  void set_cover_download_url(const QString& url);
88 
89  DbId db_id() const;
90  void set_db_id(DbId id);
91 
92  virtual void print() const;
93 
94 protected:
95  static QHash<HashValue, QString>& album_pool();
96  static QHash<HashValue, QString>& artist_pool();
97 };
98 
99 
100 
101 #endif
102 
The LibraryItem class.
Definition: LibraryItem.h:65
The CustomField class a CustomField is some additional entry than can be set for MetaData,...
Definition: LibraryItem.h:40