121 void internal_clear (
129 bool singleton()
const {
135 last = from_list->last;
142 void assign_to_sublist(
150 const void *,
const void *));
162 ELIST_LINK *add_sorted_and_find(
int comparator(
const void*,
const void*),
167 bool add_sorted(
int comparator(
const void*,
const void*),
169 return (add_sorted_and_find(comparator, unique, new_link) == new_link);
189 bool ex_current_was_last;
190 bool ex_current_was_cycle_pt;
191 bool started_cycling;
204 ELIST *list_to_iterate);
206 void add_after_then_move(
209 void add_after_stay_put(
212 void add_before_then_move(
215 void add_before_stay_put(
221 void add_list_before(
245 void mark_cycle_pt();
252 return list->
empty ();
255 bool current_extracted() {
275 const void *,
const void *));
287 ELIST *list_to_iterate) {
289 if (!list_to_iterate)
291 "list_to_iterate is nullptr");
294 list = list_to_iterate;
296 current = list->First ();
297 next = current ? current->next :
nullptr;
299 started_cycling =
false;
300 ex_current_was_last =
false;
301 ex_current_was_cycle_pt =
false;
330 "new_element is nullptr");
331 if (new_element->next)
335 if (list->
empty ()) {
336 new_element->next = new_element;
337 list->last = new_element;
338 prev = next = new_element;
341 new_element->next = next;
344 current->next = new_element;
346 if (current == list->last)
347 list->last = new_element;
350 prev->next = new_element;
351 if (ex_current_was_last)
352 list->last = new_element;
353 if (ex_current_was_cycle_pt)
354 cycle_pt = new_element;
357 current = new_element;
375 "new_element is nullptr");
376 if (new_element->next)
380 if (list->
empty ()) {
381 new_element->next = new_element;
382 list->last = new_element;
383 prev = next = new_element;
384 ex_current_was_last =
false;
388 new_element->next = next;
391 current->next = new_element;
394 if (current == list->last)
395 list->last = new_element;
398 prev->next = new_element;
399 if (ex_current_was_last) {
400 list->last = new_element;
401 ex_current_was_last =
false;
423 "new_element is nullptr");
424 if (new_element->next)
428 if (list->
empty ()) {
429 new_element->next = new_element;
430 list->last = new_element;
431 prev = next = new_element;
434 prev->next = new_element;
436 new_element->next = current;
440 new_element->next = next;
441 if (ex_current_was_last)
442 list->last = new_element;
443 if (ex_current_was_cycle_pt)
444 cycle_pt = new_element;
447 current = new_element;
464 "new_element is nullptr");
465 if (new_element->next)
469 if (list->
empty ()) {
470 new_element->next = new_element;
471 list->last = new_element;
472 prev = next = new_element;
473 ex_current_was_last =
true;
477 prev->next = new_element;
479 new_element->next = current;
484 new_element->next = next;
485 if (ex_current_was_last)
486 list->last = new_element;
506 "list_to_add is nullptr");
509 if (!list_to_add->
empty ()) {
510 if (list->
empty ()) {
511 list->last = list_to_add->last;
513 next = list->First ();
514 ex_current_was_last =
true;
519 current->next = list_to_add->First ();
520 if (current == list->last)
521 list->last = list_to_add->last;
522 list_to_add->last->next = next;
523 next = current->next;
526 prev->next = list_to_add->First ();
527 if (ex_current_was_last) {
528 list->last = list_to_add->last;
529 ex_current_was_last =
false;
531 list_to_add->last->next = next;
535 list_to_add->last =
nullptr;
554 "list_to_add is nullptr");
557 if (!list_to_add->
empty ()) {
558 if (list->
empty ()) {
559 list->last = list_to_add->last;
561 current = list->First ();
562 next = current->next;
563 ex_current_was_last =
false;
566 prev->next = list_to_add->First ();
568 list_to_add->last->next = current;
571 list_to_add->last->next = next;
572 if (ex_current_was_last)
573 list->last = list_to_add->last;
574 if (ex_current_was_cycle_pt)
575 cycle_pt = prev->next;
577 current = prev->next;
578 next = current->next;
580 list_to_add->last =
nullptr;
608 prev = next = list->last =
nullptr;
612 ex_current_was_last = (current == list->last);
613 if (ex_current_was_last) list->last = prev;
616 ex_current_was_cycle_pt = (current == cycle_pt);
617 extracted_link = current;
618 extracted_link->next =
nullptr;
620 return extracted_link;
637 current = list->First ();
639 next = current ? current->next :
nullptr;
664 ex_current_was_cycle_pt =
true;
665 started_cycling =
false;
683 return ((list->
empty ()) || (current == list->First ()) || ((current ==
nullptr) &&
684 (prev == list->last) &&
685 !ex_current_was_last));
703 return ((list->
empty ()) || (current == list->last) || ((current ==
nullptr) &&
704 (prev == list->last) &&
705 ex_current_was_last));
722 return ((list->
empty ()) || ((current == cycle_pt) && started_cycling));
754 const void *,
const void *)) {
760 list->
sort (comparator);
782 "new_element is nullptr");
783 if (new_element->next)
793 list->last = new_element;
796 new_element->next = list->last->next;
797 list->last->next = new_element;
798 list->last = new_element;
814 #define QUOTE_IT(parm) #parm
846 #define ELISTIZEH_A(CLASSNAME) \
848 extern DLLSYM void CLASSNAME##_zapper(ELIST_LINK* link);
850 #define ELISTIZEH_B(CLASSNAME) \
859 class DLLSYM CLASSNAME##_LIST : public ELIST { \
861 CLASSNAME##_LIST():ELIST() {} \
864 ELIST::internal_clear(&CLASSNAME##_zapper); \
867 ~CLASSNAME##_LIST() { \
872 void deep_copy(const CLASSNAME##_LIST* src_list, \
873 CLASSNAME* (*copier)(const CLASSNAME*)); \
877 CLASSNAME##_LIST(const CLASSNAME##_LIST&) { \
878 DONT_CONSTRUCT_LIST_BY_COPY.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, nullptr);\
880 void operator=(const CLASSNAME##_LIST&) { \
881 DONT_ASSIGN_LISTS.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, nullptr); \
884 #define ELISTIZEH_C(CLASSNAME) \
900 class DLLSYM CLASSNAME##_IT : public ELIST_ITERATOR { \
902 CLASSNAME##_IT():ELIST_ITERATOR(){} \
906 CLASSNAME##_IT(CLASSNAME##_LIST* list) : ELIST_ITERATOR(list) {} \
908 CLASSNAME* data() { \
909 return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::data()); \
912 CLASSNAME* data_relative(int8_t offset) { \
913 return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::data_relative(offset));\
916 CLASSNAME* forward() { \
917 return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::forward()); \
920 CLASSNAME* extract() { \
921 return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::extract()); \
924 CLASSNAME* move_to_first() { \
925 return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::move_to_first()); \
928 CLASSNAME* move_to_last() { \
929 return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::move_to_last()); \
933 #define ELISTIZEH(CLASSNAME) \
935 ELISTIZEH_A(CLASSNAME) \
937 ELISTIZEH_B(CLASSNAME) \
939 ELISTIZEH_C(CLASSNAME)
946 #define ELISTIZE(CLASSNAME) \
957 DLLSYM void CLASSNAME##_zapper(ELIST_LINK *link) { \
958 delete reinterpret_cast<CLASSNAME *>(link); \
962 void CLASSNAME##_LIST::deep_copy(const CLASSNAME##_LIST *src_list, \
963 CLASSNAME *(*copier)(const CLASSNAME *)) { \
964 CLASSNAME##_IT from_it(const_cast<CLASSNAME##_LIST *>(src_list)); \
965 CLASSNAME##_IT to_it(this); \
967 for (from_it.mark_cycle_pt(); !from_it.cycled_list(); from_it.forward()) \
968 to_it.add_after_then_move((*copier)(from_it.data())); \