8#ifndef SkTInternalLList_DEFINED
9#define SkTInternalLList_DEFINED
19#define SK_DECLARE_INTERNAL_LLIST_INTERFACE(ClassName) \
20 friend class SkTInternalLList<ClassName>; \
22 SkDEBUGCODE(SkTInternalLList<ClassName>* fList = nullptr;) \
23 ClassName* fPrev = nullptr; \
24 ClassName* fNext = nullptr
42 T*
prev = entry->fPrev;
43 T*
next = entry->fNext;
56 entry->fPrev =
nullptr;
57 entry->fNext =
nullptr;
60 entry->fList =
nullptr;
65 SkASSERT(
nullptr == entry->fPrev &&
nullptr == entry->fNext);
68 entry->fPrev =
nullptr;
74 if (
nullptr == fTail) {
84 SkASSERT(
nullptr == entry->fPrev &&
nullptr == entry->fNext);
88 entry->fNext =
nullptr;
93 if (
nullptr == fHead) {
110 if (
nullptr == existingEntry) {
115 SkASSERT(this->isInList(existingEntry));
116 newEntry->fNext = existingEntry;
117 T*
prev = existingEntry->fPrev;
118 existingEntry->fPrev = newEntry;
119 newEntry->fPrev =
prev;
120 if (
nullptr ==
prev) {
124 prev->fNext = newEntry;
127 newEntry->fList =
this;
139 if (
nullptr == existingEntry) {
144 SkASSERT(this->isInList(existingEntry));
145 newEntry->fPrev = existingEntry;
146 T*
next = existingEntry->fNext;
147 existingEntry->fNext = newEntry;
148 newEntry->fNext =
next;
149 if (
nullptr ==
next) {
153 next->fPrev = newEntry;
156 newEntry->fList =
this;
161 if (list.isEmpty()) {
165 list.fHead->fPrev = fTail;
171 fTail->fNext = list.fHead;
176 for (
T* node = list.fHead; node; node = node->fNext) {
182 list.fHead = list.fTail =
nullptr;
221 if (
nullptr == fCurr) {
225 fCurr = fCurr->fNext;
230 if (
nullptr == fCurr) {
234 fCurr = fCurr->fPrev;
258 void validate()
const {
263 if (
nullptr == item->fPrev) {
266 SkASSERT(item->fPrev->fNext == item);
268 if (
nullptr == item->fNext) {
271 SkASSERT(item->fNext->fPrev == item);
280 bool isInList(
const T* entry)
const {
281 return entry->fList ==
this;
287 int countEntries()
const {
289 for (
T* entry = fHead; entry; entry = entry->fNext) {
static float next(float f)
static float prev(float f)
static constexpr bool SkToBool(const T &x)
Iter & operator=(const Iter &iter)
bool operator!=(const Iter &that)
T * init(const SkTInternalLList &list, IterStart startLoc)
void addAfter(T *newEntry, T *existingEntry)
void addBefore(T *newEntry, T *existingEntry)
void concat(SkTInternalLList &&list)