12 #include <type_traits>
32 template <
class... Args>
33 iterator
emplace (const_iterator pos, Args &&...args) =
delete;
34 template <
class... Args>
36 iterator
insert (const_iterator pos, std::initializer_list<MusicThingie *>) =
delete;
40 iterator
erase (const_iterator target);
41 iterator
erase (const_iterator first, const_iterator last);
44 template <
class InputIterator>
45 iterator
insert (const_iterator where, InputIterator first, InputIterator last) {
46 difference_type offset = where - cbegin();
47 for (const_iterator insloc = where; first != last; insloc++, first++) {
50 return begin() + offset;
54 template <
typename InsertionType>
60 template <
typename InsertionType>
79 template <typename ActualType, class ValueType = typename std::remove_pointer<ActualType>::type>
87 using ThingieList::size_type;
88 using ThingieList::empty;
89 using ThingieList::size;
90 using ThingieList::reserve;
115 template <
typename FromPointerType,
116 class FromValueType =
typename std::remove_pointer<FromPointerType>::type,
123 template <
typename FromPointerType,
124 class FromValueType =
typename std::remove_pointer<FromPointerType>::type,
130 template <
typename FromPointerType,
131 class FromValueType =
typename std::remove_pointer<FromPointerType>::type,
139 template <
typename FromPointerType,
140 class FromValueType =
typename std::remove_pointer<FromPointerType>::type,
151 return static_cast<ActualType
> (ThingieList::iterator::operator*());
156 using ThingieList::const_iterator::const_iterator;
161 return static_cast<const ActualType
> (ThingieList::const_iterator::operator*());
167 return static_cast<ActualType
> (ThingieList::reverse_iterator::operator*());
173 return static_cast<const ActualType
> (ThingieList::const_reverse_iterator::operator*());
179 ThingieList::iterator temp = ThingieList::begin();
180 return *
static_cast<iterator *
> (&temp);
183 ThingieList::const_iterator temp = ThingieList::begin();
187 ThingieList::const_iterator temp = ThingieList::cbegin();
191 ThingieList::iterator temp = ThingieList::end();
192 return *
static_cast<iterator *
> (&temp);
195 ThingieList::const_iterator temp = ThingieList::end();
199 ThingieList::const_iterator temp = ThingieList::cend();
204 ThingieList::reverse_iterator temp = ThingieList::rbegin();
208 ThingieList::const_reverse_iterator temp = ThingieList::rbegin();
212 ThingieList::const_reverse_iterator temp = ThingieList::crbegin();
216 ThingieList::reverse_iterator temp = ThingieList::rend();
220 ThingieList::const_reverse_iterator temp = ThingieList::rend();
224 ThingieList::const_reverse_iterator temp = ThingieList::crend();
230 return static_cast<ActualType
> (ThingieList::operator[] (item));
233 MusicThingie *
const *temp = &ThingieList::operator[] (item);
234 return *
reinterpret_cast<ActualType
const *
> (temp);
238 return *
reinterpret_cast<ActualType *
> (temp);
240 inline const ActualType &
front()
const {
242 return *
reinterpret_cast<ActualType
const *
> (temp);
246 return *
reinterpret_cast<ActualType *
> (temp);
248 inline const ActualType &
back()
const {
250 return *
reinterpret_cast<ActualType
const *
> (temp);
256 return *
static_cast<iterator *
> (&temp);
260 return *
static_cast<iterator *
> (&temp);
267 template <
typename InsertionType>
274 template <
typename InsertionType>
281 return *
static_cast<iterator *
> (&temp);
284 template <
class InputIterator>
286 for (
const_iterator insloc = where; first != last; insloc++, first++) {
304 template <
typename ToValueType,
typename FromListType>
307 std::is_base_of<
typename FromListType::music_type,
typename std::remove_pointer<ToValueType>::type>::
value,
308 "List element types are not related.");
315 template <
typename ToValueType,
typename FromListType>
318 std::is_base_of<
typename FromListType::music_type,
typename std::remove_pointer<ToValueType>::type>::
value,
319 "List element types are not related.");
Base class for songs, albums, artists, playlists, genres, etc.
Definition: musictypes.h:77
Type
Definition: musictypes.h:86
A container for lists of playlists.
Definition: retainedlist.h:324
Definition: retainedlist.h:154
const_iterator(const iterator &from)
Definition: retainedlist.h:157
ActualType operator*() const noexcept
Definition: retainedlist.h:160
Definition: retainedlist.h:170
ActualType operator*() const noexcept
Definition: retainedlist.h:172
Iterators: bastardize ThingieList's iterator's dereference operators to return known type.
Definition: retainedlist.h:148
ActualType operator*() const noexcept
Definition: retainedlist.h:150
Definition: retainedlist.h:164
ActualType operator*() const noexcept
Definition: retainedlist.h:166
Container class for storing reference-counted music thingies.
Definition: retainedlist.h:80
const_reverse_iterator crbegin() const noexcept
Definition: retainedlist.h:211
ActualType & back()
Definition: retainedlist.h:244
ActualType & front()
Definition: retainedlist.h:236
iterator insert(const_iterator where, const ActualType add)
Definition: retainedlist.h:279
void push_front(const Retainer< InsertionType > &add)
Definition: retainedlist.h:275
RetainedList(const this_type &list)
Copy construct from list of same type.
Definition: retainedlist.h:96
const_iterator cbegin() const noexcept
Definition: retainedlist.h:186
iterator insert(const_iterator where, InputIterator first, InputIterator last)
Definition: retainedlist.h:285
const_reverse_iterator rend() const noexcept
Definition: retainedlist.h:219
iterator erase(const_iterator first, const_iterator last)
Definition: retainedlist.h:258
RetainedList(this_type &&list)
Move construct from a list of the same type.
Definition: retainedlist.h:100
this_type & operator=(const this_type &list)
Copy assign from a list of the same type.
Definition: retainedlist.h:103
iterator erase(const_iterator target)
Definition: retainedlist.h:254
const_reverse_iterator crend() const noexcept
Definition: retainedlist.h:223
ActualType operator[](size_type item)
Member accessors: return data as known type, instead of ThingieList.
Definition: retainedlist.h:229
const_iterator begin() const noexcept
Definition: retainedlist.h:182
RetainedList(RetainedList< FromPointerType > &&list)
Move construct from another RetainedList whose value type is a subclass of our value type.
Definition: retainedlist.h:126
RetainedList(const RetainedList< FromPointerType > &list)
Copy construct from another RetainedList whose value type is a subclass of our value type.
Definition: retainedlist.h:118
reverse_iterator rbegin() noexcept
Definition: retainedlist.h:203
void push_back(const Retainer< InsertionType > &add)
Definition: retainedlist.h:268
const ActualType & front() const
Definition: retainedlist.h:240
const_iterator cend() const noexcept
Definition: retainedlist.h:198
reverse_iterator rend() noexcept
Definition: retainedlist.h:215
ValueType music_type
Definition: retainedlist.h:86
iterator end() noexcept
Definition: retainedlist.h:190
void join(const this_type &from)
Definition: retainedlist.h:292
void push_front(ActualType add)
Definition: retainedlist.h:271
void join(this_type &&from)
Definition: retainedlist.h:295
const ActualType & back() const
Definition: retainedlist.h:248
const_iterator end() const noexcept
Definition: retainedlist.h:194
RetainedList()=default
Default constructor.
iterator begin() noexcept
Iterators: Return our iterators with correct dereference operator instead of the ThingieList ones.
Definition: retainedlist.h:178
void push_back(ActualType add)
Definition: retainedlist.h:264
const_reverse_iterator rbegin() const noexcept
Definition: retainedlist.h:207
Smart containers to help manage reference counting the MusicThingies.
Definition: retainer.h:13
value_type * get() const
Get the pointer itself.
Definition: retainer.h:128
A container for holding songs.
Definition: retainedlist.h:328
void mixedMerge(const SongList &adds)
Randomly merge a songlist into another.
Definition: retainedlist.cpp:154
Base class for storing lists of thingies, which need to be reference counted accurately.
Definition: retainedlist.h:20
void push_back(const Retainer< InsertionType > &add)
Definition: retainedlist.h:55
iterator insert(const_iterator where, MusicThingie *&&add)
void push_back(MusicThingie *add)
Definition: retainedlist.cpp:89
void push_front(const Retainer< InsertionType > &add)
Definition: retainedlist.h:61
void clear(void)
Replace all the usual methods with ones that manage object retention.
Definition: retainedlist.cpp:58
iterator insert(const_iterator where, InputIterator first, InputIterator last)
Definition: retainedlist.h:45
std::vector< MusicThingie * > list_type
Definition: retainedlist.h:21
~ThingieList()
Release items when being destroyed.
Definition: retainedlist.cpp:17
bool purge(const Media::Source *const source)
Purge any items from a particular source from the list.
Definition: retainedlist.cpp:126
void limitTo(MusicThingie::Type type)
Purge anything that isn't a certain type.
Definition: retainedlist.cpp:140
void pop_back(void)
Definition: retainedlist.cpp:98
void resize(size_type)=delete
void join(const ThingieList &from)
Append another thingielist to this one.
Definition: retainedlist.cpp:111
void push_front(MusicThingie *add)
Definition: retainedlist.cpp:94
void emplace_back(Args &&...args)=delete
ThingieList & operator=(const ThingieList &list)
Copy assign into the list.
Definition: retainedlist.cpp:40
iterator insert(const_iterator pos, std::initializer_list< MusicThingie * >)=delete
iterator emplace(const_iterator pos, Args &&...args)=delete
void pop_front(void)
Definition: retainedlist.cpp:104
iterator erase(const_iterator target)
Definition: retainedlist.cpp:64
Playlist / Artist / Album / Song data types.
uint32_t value
Definition: audiooutput.cpp:68
constexpr const RetainedList< ToValueType > & retained_list_cast(FromListType &from)
static typecast for thingie lists: Typecasts a list of a given type to a list of a derived type.
Definition: retainedlist.h:305
Smart pointers for music thingie types.