68 prev = next =
nullptr;
73 prev = next =
nullptr;
78 prev = next =
nullptr;
103 void internal_clear (
117 last = from_list->last;
124 void assign_to_sublist(
132 const void *,
const void *));
139 void add_sorted(
int comparator(
const void*,
const void*),
159 bool ex_current_was_last;
161 bool ex_current_was_cycle_pt;
165 bool started_cycling;
178 void add_after_then_move(
181 void add_after_stay_put(
184 void add_before_then_move(
187 void add_before_stay_put(
193 void add_list_before(
220 void mark_cycle_pt();
227 return list->
empty ();
250 const void *,
const void *));
265 ELIST2 *list_to_iterate) {
267 if (!list_to_iterate)
269 "list_to_iterate is nullptr");
272 list = list_to_iterate;
274 current = list->First ();
275 next = current ? current->next :
nullptr;
277 started_cycling =
false;
278 ex_current_was_last =
false;
279 ex_current_was_cycle_pt =
false;
306 "new_element is nullptr");
307 if (new_element->next)
311 if (list->
empty ()) {
312 new_element->next = new_element;
313 new_element->prev = new_element;
314 list->last = new_element;
315 prev = next = new_element;
318 new_element->next = next;
319 next->prev = new_element;
322 new_element->prev = current;
323 current->next = new_element;
325 if (current == list->last)
326 list->last = new_element;
329 new_element->prev = prev;
330 prev->next = new_element;
331 if (ex_current_was_last)
332 list->last = new_element;
333 if (ex_current_was_cycle_pt)
334 cycle_pt = new_element;
337 current = new_element;
354 "new_element is nullptr");
355 if (new_element->next)
359 if (list->
empty ()) {
360 new_element->next = new_element;
361 new_element->prev = new_element;
362 list->last = new_element;
363 prev = next = new_element;
364 ex_current_was_last =
false;
368 new_element->next = next;
369 next->prev = new_element;
372 new_element->prev = current;
373 current->next = new_element;
376 if (current == list->last)
377 list->last = new_element;
380 new_element->prev = prev;
381 prev->next = new_element;
382 if (ex_current_was_last) {
383 list->last = new_element;
384 ex_current_was_last =
false;
405 "new_element is nullptr");
406 if (new_element->next)
410 if (list->
empty ()) {
411 new_element->next = new_element;
412 new_element->prev = new_element;
413 list->last = new_element;
414 prev = next = new_element;
417 prev->next = new_element;
418 new_element->prev = prev;
421 new_element->next = current;
422 current->prev = new_element;
426 new_element->next = next;
427 next->prev = new_element;
428 if (ex_current_was_last)
429 list->last = new_element;
430 if (ex_current_was_cycle_pt)
431 cycle_pt = new_element;
434 current = new_element;
451 "new_element is nullptr");
452 if (new_element->next)
456 if (list->
empty ()) {
457 new_element->next = new_element;
458 new_element->prev = new_element;
459 list->last = new_element;
460 prev = next = new_element;
461 ex_current_was_last =
true;
465 prev->next = new_element;
466 new_element->prev = prev;
469 new_element->next = current;
470 current->prev = new_element;
475 new_element->next = next;
476 next->prev = new_element;
477 if (ex_current_was_last)
478 list->last = new_element;
498 "list_to_add is nullptr");
501 if (!list_to_add->
empty ()) {
502 if (list->
empty ()) {
503 list->last = list_to_add->last;
505 next = list->First ();
506 ex_current_was_last =
true;
511 current->next = list_to_add->First ();
512 current->next->prev = current;
513 if (current == list->last)
514 list->last = list_to_add->last;
515 list_to_add->last->next = next;
516 next->prev = list_to_add->last;
517 next = current->next;
520 prev->next = list_to_add->First ();
521 prev->next->prev = prev;
522 if (ex_current_was_last) {
523 list->last = list_to_add->last;
524 ex_current_was_last =
false;
526 list_to_add->last->next = next;
527 next->prev = list_to_add->last;
531 list_to_add->last =
nullptr;
549 "list_to_add is nullptr");
552 if (!list_to_add->
empty ()) {
553 if (list->
empty ()) {
554 list->last = list_to_add->last;
556 current = list->First ();
557 next = current->next;
558 ex_current_was_last =
false;
561 prev->next = list_to_add->First ();
562 prev->next->prev = prev;
565 list_to_add->last->next = current;
566 current->prev = list_to_add->last;
569 list_to_add->last->next = next;
570 next->prev = list_to_add->last;
571 if (ex_current_was_last)
572 list->last = list_to_add->last;
573 if (ex_current_was_cycle_pt)
574 cycle_pt = prev->next;
576 current = prev->next;
577 next = current->next;
579 list_to_add->last =
nullptr;
606 prev = next = list->last =
nullptr;
611 if (current == list->last) {
613 ex_current_was_last =
true;
615 ex_current_was_last =
false;
619 ex_current_was_cycle_pt = (current == cycle_pt);
620 extracted_link = current;
621 extracted_link->next =
nullptr;
622 extracted_link->prev =
nullptr;
624 return extracted_link;
640 current = list->First ();
642 next = current ? current->next :
nullptr;
659 current = list->last;
660 prev = current ? current->prev :
nullptr;
661 next = current ? current->next :
nullptr;
685 ex_current_was_cycle_pt =
TRUE;
686 started_cycling =
FALSE;
703 return ((list->
empty ()) || (current == list->First ()) || ((current ==
nullptr) &&
704 (prev == list->last) &&
705 !ex_current_was_last));
722 return ((list->
empty ()) || (current == list->last) || ((current ==
nullptr) &&
723 (prev == list->last) &&
724 ex_current_was_last));
740 return ((list->
empty ()) || ((current == cycle_pt) && started_cycling));
770 const void *,
const void *)) {
776 list->
sort (comparator);
797 "new_element is nullptr");
798 if (new_element->next)
808 list->last = new_element;
811 new_element->next = list->last->next;
812 new_element->prev = list->last;
813 list->last->next->prev = new_element;
814 list->last->next = new_element;
815 list->last = new_element;
827 #define QUOTE_IT(parm) #parm 860 #define ELIST2IZEH_A(CLASSNAME) \ 862 extern DLLSYM void CLASSNAME##_zapper( \ 865 #define ELIST2IZEH_B(CLASSNAME) \ 876 class DLLSYM CLASSNAME##_LIST : public ELIST2 { \ 878 CLASSNAME##_LIST() : ELIST2() {} \ 882 const CLASSNAME##_LIST &) \ 884 DONT_CONSTRUCT_LIST_BY_COPY.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, \ 890 ELIST2::internal_clear(&CLASSNAME##_zapper); \ 893 ~CLASSNAME##_LIST() \ 899 void deep_copy(const CLASSNAME##_LIST *src_list, \ 900 CLASSNAME *(*copier)(const CLASSNAME *)); \ 903 const CLASSNAME##_LIST &) { \ 904 DONT_ASSIGN_LISTS.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, nullptr); \ 907 #define ELIST2IZEH_C(CLASSNAME) \ 922 class DLLSYM CLASSNAME##_IT : public ELIST2_ITERATOR { \ 924 CLASSNAME##_IT(CLASSNAME##_LIST *list) : ELIST2_ITERATOR(list) {} \ 926 CLASSNAME *data() { return (CLASSNAME *)ELIST2_ITERATOR::data(); } \ 928 CLASSNAME *data_relative(int8_t offset) { \ 929 return (CLASSNAME *)ELIST2_ITERATOR::data_relative(offset); \ 932 CLASSNAME *forward() { return (CLASSNAME *)ELIST2_ITERATOR::forward(); } \ 934 CLASSNAME *backward() { return (CLASSNAME *)ELIST2_ITERATOR::backward(); } \ 936 CLASSNAME *extract() { return (CLASSNAME *)ELIST2_ITERATOR::extract(); } \ 938 CLASSNAME *move_to_first() { \ 939 return (CLASSNAME *)ELIST2_ITERATOR::move_to_first(); \ 942 CLASSNAME *move_to_last() { \ 943 return (CLASSNAME *)ELIST2_ITERATOR::move_to_last(); \ 949 #define ELIST2IZEH(CLASSNAME) \ 951 ELIST2IZEH_A(CLASSNAME) \ 953 ELIST2IZEH_B(CLASSNAME) \ 955 ELIST2IZEH_C(CLASSNAME) 961 #define ELIST2IZE(CLASSNAME) \ 972 DLLSYM void CLASSNAME##_zapper( \ 975 delete (CLASSNAME *)link; \ 979 void CLASSNAME##_LIST::deep_copy(const CLASSNAME##_LIST *src_list, \ 980 CLASSNAME *(*copier)(const CLASSNAME *)) { \ 981 CLASSNAME##_IT from_it(const_cast<CLASSNAME##_LIST *>(src_list)); \ 982 CLASSNAME##_IT to_it(this); \ 984 for (from_it.mark_cycle_pt(); !from_it.cycled_list(); from_it.forward()) \ 985 to_it.add_after_then_move((*copier)(from_it.data())); \
void sort(int comparator(const void *, const void *))
ELIST2_LINK * move_to_last()
void add_before_stay_put(ELIST2_LINK *new_link)
void add_after_stay_put(ELIST2_LINK *new_link)
void add_list_before(ELIST2 *list_to_add)
void assign_to_sublist(ELIST2_ITERATOR *start_it, ELIST2_ITERATOR *end_it)
void add_after_then_move(ELIST2_LINK *new_link)
void shallow_copy(ELIST2 *from_list)
const ERRCODE STILL_LINKED
ELIST2_ITERATOR(ELIST2 *list_to_iterate)
void operator=(const ELIST2_LINK &)
void add_before_then_move(ELIST2_LINK *new_link)
const ERRCODE BAD_PARAMETER
void add_list_after(ELIST2 *list_to_add)
const ERRCODE NULL_CURRENT
void set_to_list(ELIST2 *list_to_iterate)
ELIST2_LINK * move_to_first()
ELIST2_LINK(const ELIST2_LINK &)
void sort(int comparator(const void *, const void *))
void add_to_end(ELIST2_LINK *new_link)
void error(const char *caller, TessErrorLogCode action, const char *format,...) const