55 template <
class ObjectType>
87 jassert (
this != &other);
96 inline operator ObjectType*()
const noexcept
102 inline ObjectType*
get()
const noexcept
118 while (l->item !=
nullptr)
119 l = &(l->item->nextListItem);
132 for (
auto* i = item; i !=
nullptr; i = i->nextListItem)
146 while (--index >= 0 && l->item !=
nullptr)
147 l = &(l->item->nextListItem);
160 while (--index >= 0 && l->item !=
nullptr)
161 l = &(l->item->nextListItem);
167 bool contains (
const ObjectType*
const itemToLookFor)
const noexcept
169 for (
auto* i = item; i !=
nullptr; i = i->nextListItem)
170 if (itemToLookFor == i)
182 jassert (newItem !=
nullptr);
183 jassert (newItem->nextListItem ==
nullptr);
184 newItem->nextListItem = item;
194 jassert (newItem !=
nullptr);
197 while (index != 0 && l->item !=
nullptr)
199 l = &(l->item->nextListItem);
203 l->insertNext (newItem);
211 jassert (newItem !=
nullptr);
212 jassert (newItem->nextListItem ==
nullptr);
216 item->nextListItem = oldItem->nextListItem.item;
217 oldItem->nextListItem.item =
nullptr;
238 auto* insertPoint =
this;
240 for (
auto* i = other.item; i !=
nullptr; i = i->nextListItem)
242 insertPoint->insertNext (
new ObjectType (*i));
243 insertPoint = &(insertPoint->item->nextListItem);
255 if (oldItem !=
nullptr)
257 item = oldItem->nextListItem;
258 oldItem->nextListItem.item =
nullptr;
267 void remove (ObjectType*
const itemToRemove)
278 while (item !=
nullptr)
281 item = oldItem->nextListItem;
294 while (l->item !=
nullptr)
296 if (l->item == itemToLookFor)
299 l = &(l->item->nextListItem);
311 jassert (destArray !=
nullptr);
313 for (
auto* i = item; i !=
nullptr; i = i->nextListItem)
320 std::swap (item, other.item);
337 : endOfList (&endOfListPointer)
340 jassert (endOfListPointer.item ==
nullptr);
344 void append (ObjectType*
const newItem) noexcept
346 *endOfList = newItem;
347 endOfList = &(newItem->nextListItem);
353 JUCE_DECLARE_NON_COPYABLE (
Appender)
void insertNext(ObjectType *const newItem)
LinkedListPointer & operator[](int index) noexcept
void copyToArray(ObjectType **destArray) const noexcept
LinkedListPointer & operator=(ObjectType *const newItem) noexcept
void append(ObjectType *const newItem) noexcept
LinkedListPointer() noexcept
ObjectType * removeNext() noexcept
Appender(LinkedListPointer &endOfListPointer) noexcept
int size() const noexcept
void swapWith(LinkedListPointer &other) noexcept
void addCopyOfList(const LinkedListPointer &other)
void append(ObjectType *const newItem)
LinkedListPointer & getLast() noexcept
ObjectType * replaceNext(ObjectType *const newItem) noexcept
void insertAtIndex(int index, ObjectType *newItem)
LinkedListPointer * findPointerTo(ObjectType *const itemToLookFor) noexcept
bool contains(const ObjectType *const itemToLookFor) const noexcept
LinkedListPointer(ObjectType *const headItem) noexcept