Sayonara Player
MetaDataList.h
1  /* MetaDataList.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 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 
57  void set_current_track(int idx);
58  int current_track() const;
59 
60  bool contains(const MetaData& md) const;
61  MetaDataList& remove_track(int idx);
62  MetaDataList& remove_tracks(const IndexSet& rows);
63  MetaDataList& remove_tracks(int first, int last);
64  MetaDataList& remove_tracks(std::function<bool (const MetaData&)> attr);
65 
66  MetaDataList& move_tracks(const IndexSet& indexes, int tgt_idx);
67  MetaDataList& copy_tracks(const IndexSet& indexes, int tgt_idx);
68  MetaDataList& insert_track(const MetaData& md, int tgt_idx);
69  MetaDataList& insert_tracks(const MetaDataList& v_md, int tgt_idx);
70 
71  IdxList findTracks(Id id) const;
72  IdxList findTracks(const QString& filepath) const;
73 
74  QStringList toStringList() const;
75 
76  MetaDataList& operator <<(const MetaDataList& v_md);
77  MetaDataList& operator <<(const MetaData& md);
78 
79  MetaDataList& append(const MetaDataList& v_md);
80  MetaDataList& append(const MetaData& md);
81 
82  bool contains(TrackID id) const;
83  void remove_duplicates();
84  MetaData take_at(int idx);
85  bool isEmpty() const;
86  MetaDataList& append_unique(const MetaDataList& other);
87 
88  const MetaData& first() const;
89  const MetaData& last() const;
90 
91  int count() const;
92 
93  void sort(Library::SortOrder so);
94 
95  void reserve(size_t items);
96  size_t capacity() const;
97 };
98 
99 
100 #endif // METADATALIST_H
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