29 #ifndef JUCE_LINKEDLISTPOINTER_H_INCLUDED
30 #define JUCE_LINKEDLISTPOINTER_H_INCLUDED
60 template <
class ObjectType>
84 #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
125 while (l->item !=
nullptr)
126 l = &(l->item->nextListItem);
139 for (ObjectType* i = item; i !=
nullptr; i = i->nextListItem)
153 while (--index >= 0 && l->item !=
nullptr)
154 l = &(l->item->nextListItem);
167 while (--index >= 0 && l->item !=
nullptr)
168 l = &(l->item->nextListItem);
176 for (ObjectType* i = item; i !=
nullptr; i = i->nextListItem)
177 if (itemToLookFor == i)
190 jassert (newItem->nextListItem ==
nullptr);
191 newItem->nextListItem = item;
204 while (index != 0 && l->item !=
nullptr)
206 l = &(l->item->nextListItem);
219 jassert (newItem->nextListItem ==
nullptr);
221 ObjectType*
const oldItem = item;
223 item->nextListItem = oldItem->nextListItem.item;
224 oldItem->nextListItem.item =
nullptr;
247 for (ObjectType* i = other.item; i !=
nullptr; i = i->nextListItem)
249 insertPoint->
insertNext (
new ObjectType (*i));
250 insertPoint = &(insertPoint->item->nextListItem);
260 ObjectType*
const oldItem = item;
262 if (oldItem !=
nullptr)
264 item = oldItem->nextListItem;
265 oldItem->nextListItem.item =
nullptr;
274 void remove (ObjectType*
const itemToRemove)
285 while (item !=
nullptr)
287 ObjectType*
const oldItem = item;
288 item = oldItem->nextListItem;
301 while (l->item !=
nullptr)
303 if (l->item == itemToLookFor)
306 l = &(l->item->nextListItem);
318 jassert (destArray !=
nullptr);
320 for (ObjectType* i = item; i !=
nullptr; i = i->nextListItem)
327 std::swap (item, other.item);
344 : endOfList (&endOfListPointer)
347 jassert (endOfListPointer.item ==
nullptr);
353 *endOfList = newItem;
354 endOfList = &(newItem->nextListItem);
371 #endif // JUCE_LINKEDLISTPOINTER_H_INCLUDED
LinkedListPointer(ObjectType *const headItem) noexcept
Definition: juce_LinkedListPointer.h:72
LinkedListPointer & operator[](int index) noexcept
Definition: juce_LinkedListPointer.h:149
bool contains(const ObjectType *const itemToLookFor) const noexcept
Definition: juce_LinkedListPointer.h:174
#define noexcept
Definition: juce_CompilerSupport.h:141
void insertNext(ObjectType *const newItem)
Definition: juce_LinkedListPointer.h:187
LinkedListPointer * findPointerTo(ObjectType *const itemToLookFor) noexcept
Definition: juce_LinkedListPointer.h:297
void copyToArray(ObjectType **destArray) const noexcept
Definition: juce_LinkedListPointer.h:316
int size() const noexcept
Definition: juce_LinkedListPointer.h:135
Definition: juce_LinkedListPointer.h:61
ObjectType * replaceNext(ObjectType *const newItem) noexcept
Definition: juce_LinkedListPointer.h:216
void append(ObjectType *const newItem)
Definition: juce_LinkedListPointer.h:234
void insertAtIndex(int index, ObjectType *newItem)
Definition: juce_LinkedListPointer.h:199
Definition: juce_LinkedListPointer.h:338
LinkedListPointer & operator=(ObjectType *const newItem) noexcept
Definition: juce_LinkedListPointer.h:78
ObjectType * removeNext() noexcept
Definition: juce_LinkedListPointer.h:258
Appender(LinkedListPointer &endOfListPointer) noexcept
Definition: juce_LinkedListPointer.h:343
LinkedListPointer & getLast() noexcept
Definition: juce_LinkedListPointer.h:121
void append(ObjectType *const newItem) noexcept
Definition: juce_LinkedListPointer.h:351
void deleteAll()
Definition: juce_LinkedListPointer.h:283
LinkedListPointer() noexcept
Definition: juce_LinkedListPointer.h:66
void addCopyOfList(const LinkedListPointer &other)
Definition: juce_LinkedListPointer.h:243
void swapWith(LinkedListPointer &other) noexcept
Definition: juce_LinkedListPointer.h:325