128 void internal_clear (
142 last = from_list->last;
149 void assign_to_sublist(
157 const void *,
const void *));
169 ELIST_LINK *add_sorted_and_find(
int comparator(
const void*,
const void*),
176 return (add_sorted_and_find(comparator, unique, new_link) == new_link);
195 bool ex_current_was_last;
197 bool ex_current_was_cycle_pt;
201 bool started_cycling;
215 ELIST *list_to_iterate);
217 void add_after_then_move(
220 void add_after_stay_put(
223 void add_before_then_move(
226 void add_before_stay_put(
232 void add_list_before(
256 void mark_cycle_pt();
263 return list->
empty ();
286 const void *,
const void *));
298 ELIST *list_to_iterate) {
300 if (!list_to_iterate)
302 "list_to_iterate is nullptr");
305 list = list_to_iterate;
307 current = list->First ();
308 next = current ? current->next :
nullptr;
310 started_cycling =
FALSE;
311 ex_current_was_last =
FALSE;
312 ex_current_was_cycle_pt =
FALSE;
341 "new_element is nullptr");
342 if (new_element->next)
346 if (list->
empty ()) {
347 new_element->next = new_element;
348 list->last = new_element;
349 prev = next = new_element;
352 new_element->next = next;
355 current->next = new_element;
357 if (current == list->last)
358 list->last = new_element;
361 prev->next = new_element;
362 if (ex_current_was_last)
363 list->last = new_element;
364 if (ex_current_was_cycle_pt)
365 cycle_pt = new_element;
368 current = new_element;
386 "new_element is nullptr");
387 if (new_element->next)
391 if (list->
empty ()) {
392 new_element->next = new_element;
393 list->last = new_element;
394 prev = next = new_element;
395 ex_current_was_last =
FALSE;
399 new_element->next = next;
402 current->next = new_element;
405 if (current == list->last)
406 list->last = new_element;
409 prev->next = new_element;
410 if (ex_current_was_last) {
411 list->last = new_element;
412 ex_current_was_last =
FALSE;
434 "new_element is nullptr");
435 if (new_element->next)
439 if (list->
empty ()) {
440 new_element->next = new_element;
441 list->last = new_element;
442 prev = next = new_element;
445 prev->next = new_element;
447 new_element->next = current;
451 new_element->next = next;
452 if (ex_current_was_last)
453 list->last = new_element;
454 if (ex_current_was_cycle_pt)
455 cycle_pt = new_element;
458 current = new_element;
475 "new_element is nullptr");
476 if (new_element->next)
480 if (list->
empty ()) {
481 new_element->next = new_element;
482 list->last = new_element;
483 prev = next = new_element;
484 ex_current_was_last =
TRUE;
488 prev->next = new_element;
490 new_element->next = current;
495 new_element->next = next;
496 if (ex_current_was_last)
497 list->last = new_element;
517 "list_to_add is nullptr");
520 if (!list_to_add->
empty ()) {
521 if (list->
empty ()) {
522 list->last = list_to_add->last;
524 next = list->First ();
525 ex_current_was_last =
TRUE;
530 current->next = list_to_add->First ();
531 if (current == list->last)
532 list->last = list_to_add->last;
533 list_to_add->last->next = next;
534 next = current->next;
537 prev->next = list_to_add->First ();
538 if (ex_current_was_last) {
539 list->last = list_to_add->last;
540 ex_current_was_last =
FALSE;
542 list_to_add->last->next = next;
546 list_to_add->last =
nullptr;
565 "list_to_add is nullptr");
568 if (!list_to_add->
empty ()) {
569 if (list->
empty ()) {
570 list->last = list_to_add->last;
572 current = list->First ();
573 next = current->next;
574 ex_current_was_last =
FALSE;
577 prev->next = list_to_add->First ();
579 list_to_add->last->next = current;
582 list_to_add->last->next = next;
583 if (ex_current_was_last)
584 list->last = list_to_add->last;
585 if (ex_current_was_cycle_pt)
586 cycle_pt = prev->next;
588 current = prev->next;
589 next = current->next;
591 list_to_add->last =
nullptr;
619 prev = next = list->last =
nullptr;
623 if (current == list->last) {
625 ex_current_was_last =
TRUE;
627 ex_current_was_last =
FALSE;
631 ex_current_was_cycle_pt = (current == cycle_pt) ?
TRUE :
FALSE;
632 extracted_link = current;
633 extracted_link->next =
nullptr;
635 return extracted_link;
652 current = list->First ();
654 next = current ? current->next :
nullptr;
679 ex_current_was_cycle_pt =
TRUE;
680 started_cycling =
FALSE;
698 return ((list->
empty ()) || (current == list->First ()) || ((current ==
nullptr) &&
699 (prev == list->last) &&
700 !ex_current_was_last));
718 return ((list->
empty ()) || (current == list->last) || ((current ==
nullptr) &&
719 (prev == list->last) &&
720 ex_current_was_last));
737 return ((list->
empty ()) || ((current == cycle_pt) && started_cycling));
769 const void *,
const void *)) {
775 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 list->last->next = new_element;
813 list->last = new_element;
829 #define QUOTE_IT(parm) #parm 861 #define ELISTIZEH_A(CLASSNAME) \ 863 extern DLLSYM void CLASSNAME##_zapper(ELIST_LINK* link); 865 #define ELISTIZEH_B(CLASSNAME) \ 874 class DLLSYM CLASSNAME##_LIST : public ELIST { \ 876 CLASSNAME##_LIST():ELIST() {} \ 879 ELIST::internal_clear(&CLASSNAME##_zapper); \ 882 ~CLASSNAME##_LIST() { \ 887 void deep_copy(const CLASSNAME##_LIST* src_list, \ 888 CLASSNAME* (*copier)(const CLASSNAME*)); \ 892 CLASSNAME##_LIST(const CLASSNAME##_LIST&) { \ 893 DONT_CONSTRUCT_LIST_BY_COPY.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, nullptr);\ 895 void operator=(const CLASSNAME##_LIST&) { \ 896 DONT_ASSIGN_LISTS.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, nullptr); \ 899 #define ELISTIZEH_C(CLASSNAME) \ 915 class DLLSYM CLASSNAME##_IT : public ELIST_ITERATOR { \ 917 CLASSNAME##_IT():ELIST_ITERATOR(){} \ 921 CLASSNAME##_IT(CLASSNAME##_LIST* list) : ELIST_ITERATOR(list) {} \ 923 CLASSNAME* data() { \ 924 return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::data()); \ 927 CLASSNAME* data_relative(int8_t offset) { \ 928 return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::data_relative(offset));\ 931 CLASSNAME* forward() { \ 932 return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::forward()); \ 935 CLASSNAME* extract() { \ 936 return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::extract()); \ 939 CLASSNAME* move_to_first() { \ 940 return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::move_to_first()); \ 943 CLASSNAME* move_to_last() { \ 944 return reinterpret_cast<CLASSNAME*>(ELIST_ITERATOR::move_to_last()); \ 948 #define ELISTIZEH(CLASSNAME) \ 950 ELISTIZEH_A(CLASSNAME) \ 952 ELISTIZEH_B(CLASSNAME) \ 954 ELISTIZEH_C(CLASSNAME) 961 #define ELISTIZE(CLASSNAME) \ 972 DLLSYM void CLASSNAME##_zapper(ELIST_LINK *link) { \ 973 delete reinterpret_cast<CLASSNAME *>(link); \ 977 void CLASSNAME##_LIST::deep_copy(const CLASSNAME##_LIST *src_list, \ 978 CLASSNAME *(*copier)(const CLASSNAME *)) { \ 979 CLASSNAME##_IT from_it(const_cast<CLASSNAME##_LIST *>(src_list)); \ 980 CLASSNAME##_IT to_it(this); \ 982 for (from_it.mark_cycle_pt(); !from_it.cycled_list(); from_it.forward()) \ 983 to_it.add_after_then_move((*copier)(from_it.data())); \ ELIST_LINK(const ELIST_LINK &)
bool add_sorted(int comparator(const void *, const void *), bool unique, ELIST_LINK *new_link)
void add_before_then_move(ELIST_LINK *new_link)
void assign_to_sublist(ELIST_ITERATOR *start_it, ELIST_ITERATOR *end_it)
void add_after_stay_put(ELIST_LINK *new_link)
void add_to_end(ELIST_LINK *new_link)
void set_to_list(ELIST *list_to_iterate)
void add_list_before(ELIST *list_to_add)
const ERRCODE STILL_LINKED
ELIST_LINK * move_to_first()
void sort(int comparator(const void *, const void *))
void sort(int comparator(const void *, const void *))
void operator=(const ELIST_LINK &)
void add_after_then_move(ELIST_LINK *new_link)
void shallow_copy(ELIST *from_list)
const ERRCODE BAD_PARAMETER
void add_before_stay_put(ELIST_LINK *new_link)
const ERRCODE NULL_CURRENT
void add_list_after(ELIST *list_to_add)
void error(const char *caller, TessErrorLogCode action, const char *format,...) const