/** * This macro creates the member variables required by the SkTInternalLList class. It should be * placed in the private section of any class that will be stored in a double linked list.
*/ #define SK_DECLARE_INTERNAL_LLIST_INTERFACE(ClassName) \ friendclass SkTInternalLList<ClassName>; \ /* back pointer to the owning list - for debugging */ \
SkDEBUGCODE(SkTInternalLList<ClassName>* fList = nullptr;) \
ClassName* fPrev = nullptr; \
ClassName* fNext = nullptr
/** * This class implements a templated internal doubly linked list data structure.
*/ template <class T> class SkTInternalLList { public:
SkTInternalLList() {}
/** * Inserts a new list entry before an existing list entry. The new entry must not already be * a member of this or any other list. If existingEntry is NULL then the new entry is added * at the tail.
*/ void addBefore(T* newEntry, T* existingEntry) {
SkASSERT(newEntry);
if (nullptr == existingEntry) {
this->addToTail(newEntry); return;
}
/** * Inserts a new list entry after an existing list entry. The new entry must not already be * a member of this or any other list. If existingEntry is NULL then the new entry is added * at the head.
*/ void addAfter(T* newEntry, T* existingEntry) {
SkASSERT(newEntry);
if (nullptr == existingEntry) {
this->addToHead(newEntry); return;
}
/** * Debugging-only method that uses the list back pointer to check if 'entry' is indeed in 'this' * list.
*/ bool isInList(const T* entry) const { return entry->fList == this;
}
/** * Debugging-only method that laboriously counts the list entries.
*/ int countEntries() const { int count = 0; for (T* entry = fHead; entry; entry = entry->fNext) {
++count;
} return count;
} #endif// SK_DEBUG
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.