Sayonara Player
MetaDataList.h
1  /* MetaDataList.h */
2 
3 /* Copyright (C) 2011-2019 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 METADATALIST_H
22 #define METADATALIST_H
23 
24 #include "MetaData.h"
25 #include "Utils/Pimpl.h"
26 #include "Utils/Library/Sortorder.h"
27 
28 #include <deque>
29 #include <functional>
30 
37 class MetaDataList :
38  public std::deque<MetaData>
39 {
40  using Parent=std::deque<MetaData>;
41 
42  PIMPL(MetaDataList)
43 
44 public:
45  MetaDataList();
46  explicit MetaDataList(const MetaData& md);
47 
48  MetaDataList(const MetaDataList&);
49  MetaDataList(MetaDataList&& other);
50 
51  MetaDataList& operator=(const MetaDataList& other);
52  MetaDataList& operator=(MetaDataList&& other);
53 
54  ~MetaDataList();
55 
56  void set_current_track(int idx);
57  int current_track() const;
58 
59  bool contains(const MetaData& md) const;
60  MetaDataList& remove_track(int idx);
61  MetaDataList& remove_tracks(const IndexSet& rows);
62  MetaDataList& remove_tracks(int first, int last);
63  MetaDataList& remove_tracks(std::function<bool (const MetaData&)> attr);
64 
65  MetaDataList& move_tracks(const IndexSet& indexes, int tgt_idx);
66  MetaDataList& copy_tracks(const IndexSet& indexes, int tgt_idx);
67  MetaDataList& insert_track(const MetaData& md, int tgt_idx);
68  MetaDataList& insert_tracks(const MetaDataList& v_md, int tgt_idx);
69 
70  IdxList findTracks(Id id) const;
71  IdxList findTracks(const QString& filepath) const;
72 
73  QStringList toStringList() const;
74 
75  MetaDataList& operator <<(const MetaDataList& v_md);
76  MetaDataList& operator <<(const MetaData& md);
77  const MetaData& operator[](int i) const;
78  MetaData& operator[](int i);
79 
80  MetaDataList& append(const MetaDataList& v_md);
81  MetaDataList& append(const MetaData& md);
82 
83  bool contains(TrackID id) const;
84  void remove_duplicates();
85  MetaData take_at(int idx);
86  bool isEmpty() const;
87  MetaDataList& append_unique(const MetaDataList& other);
88 
89  const MetaData& first() const;
90  const MetaData& last() const;
91 
92  int count() const;
93 
94  void sort(Library::SortOrder so);
95 
96  void reserve(size_t items);
97  size_t capacity() const;
98 };
99 
100 
101 #endif // METADATALIST_H
SortOrder
The SortOrder enum.
Definition: Sortorder.h:31
The MetaData class.
Definition: MetaData.h:44
The MetaDataList class.
Definition: MetaDataList.h:37
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition: Set.h:35
Definition: org_mpris_media_player2_adaptor.h:20