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 <deque>
28#include <functional>
29
36 public std::deque<MetaData>
37{
38 using Parent=std::deque<MetaData>;
39
40public:
42 explicit MetaDataList(const MetaData& md);
43
45 MetaDataList(MetaDataList&& other) noexcept;
46
47 MetaDataList& operator=(const MetaDataList& other);
48 MetaDataList& operator=(MetaDataList&& other) noexcept;
49
51
52 bool contains(const MetaData& md) const;
53 MetaDataList& removeTrack(int idx);
54 MetaDataList& removeTracks(const IndexSet& rows);
55 MetaDataList& removeTracks(int first, int last);
56 MetaDataList& removeTracks(std::function<bool (const MetaData&)> attr);
57
58 MetaDataList& moveTracks(const IndexSet& indexes, int tgt_idx) noexcept;
59 MetaDataList& copyTracks(const IndexSet& indexes, int tgt_idx);
60 MetaDataList& insertTrack(const MetaData& md, int tgt_idx);
61 MetaDataList& insertTracks(const MetaDataList& v_md, int tgt_idx);
62
63 IdxList findTracks(Id id) const;
64 IdxList findTracks(const QString& filepath) const;
65
66 QStringList toStringList() const;
67
68 MetaDataList& operator <<(const MetaDataList& v_md);
69 MetaDataList& operator <<(const MetaData& md);
70 MetaDataList& operator <<(MetaDataList&& v_md) noexcept;
71 MetaDataList& operator <<(MetaData&& md) noexcept;
72
73 const MetaData& operator[](int i) const;
74 MetaData& operator[](int i);
75
76 MetaDataList& append(const MetaDataList& v_md);
77 MetaDataList& append(MetaDataList&& v_md) noexcept;
78 MetaDataList& append(const MetaData& md);
79 MetaDataList& append(MetaData&& md) noexcept;
80
81 QList<UniqueId> unique_ids() const;
82
83 bool contains(TrackID id) const;
84 void removeDuplicates();
85 MetaData takeAt(int idx);
86 bool isEmpty() const;
87 MetaDataList& appendUnique(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
The MetaDataList class.
Definition: MetaDataList.h:37
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
SortOrder
The SortOrder enum.
Definition: Sortorder.h:32