122 void internal_clear(
void (*zapper)(
void *));
134 last = from_list->last;
141 void assign_to_sublist(
148 if (
last !=
nullptr) {
159 const void *,
const void *));
171 ELIST_LINK *add_sorted_and_find(
int comparator(
const void *,
const void *),
bool unique,
177 return (add_sorted_and_find(comparator, unique, new_link) == new_link);
196 bool ex_current_was_last;
197 bool ex_current_was_cycle_pt;
198 bool started_cycling;
211 ELIST *list_to_iterate);
213 void add_after_then_move(
216 void add_after_stay_put(
219 void add_before_then_move(
222 void add_before_stay_put(
228 void add_list_before(
254 void mark_cycle_pt();
262 return list->
empty();
269 bool at_first()
const;
271 bool at_last()
const;
273 bool cycled_list()
const;
288 const void *,
const void *));
299 ELIST *list_to_iterate) {
301 if (!list_to_iterate) {
306 list = list_to_iterate;
308 current = list->First();
309 next = current ? current->next :
nullptr;
311 started_cycling =
false;
312 ex_current_was_last =
false;
313 ex_current_was_cycle_pt =
false;
342 if (new_element->next) {
348 new_element->next = new_element;
349 list->last = new_element;
350 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;
365 if (ex_current_was_cycle_pt) {
366 cycle_pt = new_element;
370 current = new_element;
389 if (new_element->next) {
395 new_element->next = new_element;
396 list->last = new_element;
397 prev = next = new_element;
398 ex_current_was_last =
false;
401 new_element->next = next;
404 current->next = new_element;
405 if (prev == current) {
408 if (current == list->last) {
409 list->last = new_element;
412 prev->next = new_element;
413 if (ex_current_was_last) {
414 list->last = new_element;
415 ex_current_was_last =
false;
438 if (new_element->next) {
444 new_element->next = new_element;
445 list->last = new_element;
446 prev = next = new_element;
448 prev->next = new_element;
450 new_element->next = current;
453 new_element->next = next;
454 if (ex_current_was_last) {
455 list->last = new_element;
457 if (ex_current_was_cycle_pt) {
458 cycle_pt = new_element;
462 current = new_element;
481 if (new_element->next) {
487 new_element->next = new_element;
488 list->last = new_element;
489 prev = next = new_element;
490 ex_current_was_last =
true;
493 prev->next = new_element;
495 new_element->next = current;
496 if (next == current) {
500 new_element->next = next;
501 if (ex_current_was_last) {
502 list->last = new_element;
527 if (!list_to_add->
empty()) {
529 list->last = list_to_add->last;
531 next = list->First();
532 ex_current_was_last =
true;
536 current->next = list_to_add->First();
537 if (current == list->last) {
538 list->last = list_to_add->last;
540 list_to_add->last->next = next;
541 next = current->next;
543 prev->next = list_to_add->First();
544 if (ex_current_was_last) {
545 list->last = list_to_add->last;
546 ex_current_was_last =
false;
548 list_to_add->last->next = next;
552 list_to_add->last =
nullptr;
574 if (!list_to_add->
empty()) {
576 list->last = list_to_add->last;
578 current = list->First();
579 next = current->next;
580 ex_current_was_last =
false;
582 prev->next = list_to_add->First();
584 list_to_add->last->next = current;
586 list_to_add->last->next = next;
587 if (ex_current_was_last) {
588 list->last = list_to_add->last;
590 if (ex_current_was_cycle_pt) {
591 cycle_pt = prev->next;
594 current = prev->next;
595 next = current->next;
597 list_to_add->last =
nullptr;
625 prev = next = list->last =
nullptr;
629 ex_current_was_last = (current == list->last);
630 if (ex_current_was_last) {
635 ex_current_was_cycle_pt = (current == cycle_pt);
636 extracted_link = current;
637 extracted_link->next =
nullptr;
639 return extracted_link;
656 current = list->First();
658 next = current ? current->next :
nullptr;
683 ex_current_was_cycle_pt =
true;
685 started_cycling =
false;
703 return ((list->
empty()) || (current == list->First()) ||
704 ((current ==
nullptr) && (prev == list->last) &&
705 !ex_current_was_last));
723 return ((list->
empty()) || (current == list->last) ||
724 ((current ==
nullptr) && (prev == list->last) &&
725 ex_current_was_last));
742 return ((list->
empty()) || ((current == cycle_pt) && started_cycling));
754 const void *,
const void *)) {
761 list->
sort(comparator);
784 if (new_element->next) {
794 list->last = new_element;
796 new_element->next = list->last->next;
797 list->last->next = new_element;
798 list->last = new_element;
803#define ELISTIZEH(CLASSNAME) \
804 class CLASSNAME##_LIST : public X_LIST<ELIST, ELIST_ITERATOR, CLASSNAME> { \
805 using X_LIST<ELIST, ELIST_ITERATOR, CLASSNAME>::X_LIST; \
807 class CLASSNAME##_IT : public X_ITER<ELIST_ITERATOR, CLASSNAME> { \
808 using X_ITER<ELIST_ITERATOR, CLASSNAME>::X_ITER; \
constexpr ERRCODE BAD_PARAMETER("List parameter error")
constexpr ERRCODE STILL_LINKED("Attempting to add an element with non nullptr links, to a list")
constexpr ERRCODE NULL_CURRENT("List current position is nullptr")
constexpr ERRCODE NO_LIST("Iterator not set to a list")
constexpr ERRCODE NULL_DATA("List would have returned a nullptr data pointer")
ELIST_LINK(const ELIST_LINK &)
void operator=(const ELIST_LINK &)
void sort(int comparator(const void *, const void *))
void shallow_copy(ELIST *from_list)
void assign_to_sublist(ELIST_ITERATOR *start_it, ELIST_ITERATOR *end_it)
void internal_deep_copy(ELIST_LINK *(*copier)(ELIST_LINK *), const ELIST *list)
bool add_sorted(int comparator(const void *, const void *), bool unique, ELIST_LINK *new_link)
void set_to_list(ELIST *list_to_iterate)
void add_list_after(ELIST *list_to_add)
void add_after_stay_put(ELIST_LINK *new_link)
ELIST_LINK * move_to_first()
void add_before_stay_put(ELIST_LINK *new_link)
void add_to_end(ELIST_LINK *new_link)
void add_list_before(ELIST *list_to_add)
void add_before_then_move(ELIST_LINK *new_link)
void add_after_then_move(ELIST_LINK *new_link)
void sort(int comparator(const void *, const void *))
bool current_extracted() const
void error(const char *caller, TessErrorLogCode action, const char *format,...) const __attribute__((format(gnu_printf