OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkTLList_DEFINED | 8 #ifndef SkTLList_DEFINED |
9 #define SkTLList_DEFINED | 9 #define SkTLList_DEFINED |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 T* addToHead(const T& t) { | 69 T* addToHead(const T& t) { |
70 this->validate(); | 70 this->validate(); |
71 Node* node = this->createNode(); | 71 Node* node = this->createNode(); |
72 fList.addToHead(node); | 72 fList.addToHead(node); |
73 SkNEW_PLACEMENT_ARGS(node->fObj, T, (t)); | 73 SkNEW_PLACEMENT_ARGS(node->fObj, T, (t)); |
74 this->validate(); | 74 this->validate(); |
75 return reinterpret_cast<T*>(node->fObj); | 75 return reinterpret_cast<T*>(node->fObj); |
76 } | 76 } |
77 | 77 |
| 78 T* addToHead() { |
| 79 this->validate(); |
| 80 Node* node = this->createNode(); |
| 81 fList.addToHead(node); |
| 82 SkNEW_PLACEMENT(node->fObj, T); |
| 83 this->validate(); |
| 84 return reinterpret_cast<T*>(node->fObj); |
| 85 } |
| 86 |
78 T* addToTail(const T& t) { | 87 T* addToTail(const T& t) { |
79 this->validate(); | 88 this->validate(); |
80 Node* node = this->createNode(); | 89 Node* node = this->createNode(); |
81 fList.addToTail(node); | 90 fList.addToTail(node); |
82 SkNEW_PLACEMENT_ARGS(node->fObj, T, (t)); | 91 SkNEW_PLACEMENT_ARGS(node->fObj, T, (t)); |
83 this->validate(); | 92 this->validate(); |
84 return reinterpret_cast<T*>(node->fObj); | 93 return reinterpret_cast<T*>(node->fObj); |
85 } | 94 } |
86 | 95 |
| 96 T* addToTail() { |
| 97 this->validate(); |
| 98 Node* node = this->createNode(); |
| 99 fList.addToTail(node); |
| 100 SkNEW_PLACEMENT(node->fObj, T); |
| 101 this->validate(); |
| 102 return reinterpret_cast<T*>(node->fObj); |
| 103 } |
| 104 |
87 /** Adds a new element to the list before the location indicated by the iter
ator. If the | 105 /** Adds a new element to the list before the location indicated by the iter
ator. If the |
88 iterator refers to a NULL location then the new element is added at the
tail */ | 106 iterator refers to a NULL location then the new element is added at the
tail */ |
89 T* addBefore(const T& t, const Iter& location) { | 107 T* addBefore(const T& t, const Iter& location) { |
90 return SkNEW_PLACEMENT_ARGS(this->internalAddBefore(location), T, (t)); | 108 return SkNEW_PLACEMENT_ARGS(this->internalAddBefore(location), T, (t)); |
91 } | 109 } |
92 | 110 |
93 /** Adds a new element to the list after the location indicated by the itera
tor. If the | 111 /** Adds a new element to the list after the location indicated by the itera
tor. If the |
94 iterator refers to a NULL location then the new element is added at the
head */ | 112 iterator refers to a NULL location then the new element is added at the
head */ |
95 T* addAfter(const T& t, const Iter& location) { | 113 T* addAfter(const T& t, const Iter& location) { |
96 return SkNEW_PLACEMENT_ARGS(this->internalAddAfter(location), T, (t)); | 114 return SkNEW_PLACEMENT_ARGS(this->internalAddAfter(location), T, (t)); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 #define SkNEW_INSERT_IN_LLIST_AFTER(list, location, type_name, args) \ | 394 #define SkNEW_INSERT_IN_LLIST_AFTER(list, location, type_name, args) \ |
377 (new ((list), SkTLList< type_name >::kAfter_Placement, (location)) type_name
args) | 395 (new ((list), SkTLList< type_name >::kAfter_Placement, (location)) type_name
args) |
378 | 396 |
379 #define SkNEW_INSERT_AT_LLIST_HEAD(list, type_name, args) \ | 397 #define SkNEW_INSERT_AT_LLIST_HEAD(list, type_name, args) \ |
380 SkNEW_INSERT_IN_LLIST_BEFORE((list), (list)->headIter(), type_name, args) | 398 SkNEW_INSERT_IN_LLIST_BEFORE((list), (list)->headIter(), type_name, args) |
381 | 399 |
382 #define SkNEW_INSERT_AT_LLIST_TAIL(list, type_name, args) \ | 400 #define SkNEW_INSERT_AT_LLIST_TAIL(list, type_name, args) \ |
383 SkNEW_INSERT_IN_LLIST_AFTER((list), (list)->tailIter(), type_name, args) | 401 SkNEW_INSERT_IN_LLIST_AFTER((list), (list)->tailIter(), type_name, args) |
384 | 402 |
385 #endif | 403 #endif |
OLD | NEW |