Sayonara Player
MetaDataList.h
1/* MetaDataList.h */
2
3/* Copyright (C) 2011-2020 Michael Lugmair (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/Library/Sortorder.h"
26
27#include <QList>
28
29#include <deque>
30#include <functional>
31
38 public std::deque<MetaData>
39{
40 using Parent = std::deque<MetaData>;
41
42 public:
44 explicit MetaDataList(const MetaData& md);
45
47 MetaDataList(MetaDataList&& other) noexcept;
48
49 MetaDataList& operator=(const MetaDataList& other);
50 MetaDataList& operator=(MetaDataList&& other) noexcept;
51
53
54 bool contains(const MetaData& md) const;
55 MetaDataList& removeTrack(int idx);
56 MetaDataList& removeTracks(const IndexSet& rows);
57 MetaDataList& removeTracks(int first, int last);
58 MetaDataList& removeTracks(std::function<bool(const MetaData&)> attr);
59
60 MetaDataList& moveTracks(const IndexSet& indexes, int tgt_idx) noexcept;
61 MetaDataList& copyTracks(const IndexSet& indexes, int tgt_idx);
62 MetaDataList& insertTrack(const MetaData& md, int tgt_idx);
63 MetaDataList& insertTracks(const MetaDataList& v_md, int tgt_idx);
64
65 IdxList findTracks(Id id) const;
66 IdxList findTracks(const QString& filepath) const;
67
68 QStringList toStringList() const;
69
70 MetaDataList& operator<<(const MetaDataList& v_md);
71 MetaDataList& operator<<(const MetaData& md);
72 MetaDataList& operator<<(MetaDataList&& v_md) noexcept;
73 MetaDataList& operator<<(MetaData&& md) noexcept;
74
75 const MetaData& operator[](int i) const;
76 MetaData& operator[](int i);
77
78 MetaDataList& append(const MetaDataList& v_md);
79 MetaDataList& append(MetaDataList&& v_md) noexcept;
80 MetaDataList& append(const MetaData& md);
81 MetaDataList& append(MetaData&& md) noexcept;
82
83 QList<UniqueId> unique_ids() const;
84
85 bool contains(TrackID id) const;
86 QList<TrackID> trackIds() const;
87 void removeDuplicates();
88 MetaData takeAt(int idx);
89 bool isEmpty() const;
90 MetaDataList& appendUnique(const MetaDataList& other);
91
92 const MetaData& first() const;
93 const MetaData& last() const;
94
95 int count() const;
96
97 void reserve(size_t items);
98 size_t capacity() const;
99};
100
101#endif // METADATALIST_H
The MetaDataList class.
Definition: MetaDataList.h:39
The MetaData class.
Definition: MetaData.h:47
Definition: EngineUtils.h:33
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition: Set.h:37