tesseract  4.00.00dev
ELIST_ITERATOR Class Reference

#include <elst.h>

Public Member Functions

 ELIST_ITERATOR ()
 
 ELIST_ITERATOR (ELIST *list_to_iterate)
 
void set_to_list (ELIST *list_to_iterate)
 
void add_after_then_move (ELIST_LINK *new_link)
 
void add_after_stay_put (ELIST_LINK *new_link)
 
void add_before_then_move (ELIST_LINK *new_link)
 
void add_before_stay_put (ELIST_LINK *new_link)
 
void add_list_after (ELIST *list_to_add)
 
void add_list_before (ELIST *list_to_add)
 
ELIST_LINKdata ()
 
ELIST_LINKdata_relative (inT8 offset)
 
ELIST_LINKforward ()
 
ELIST_LINKextract ()
 
ELIST_LINKmove_to_first ()
 
ELIST_LINKmove_to_last ()
 
void mark_cycle_pt ()
 
bool empty ()
 
bool current_extracted ()
 
bool at_first ()
 
bool at_last ()
 
bool cycled_list ()
 
void add_to_end (ELIST_LINK *new_link)
 
void exchange (ELIST_ITERATOR *other_it)
 
inT32 length ()
 
void sort (int comparator(const void *, const void *))
 

Friends

void ELIST::assign_to_sublist (ELIST_ITERATOR *, ELIST_ITERATOR *)
 

Detailed Description

Definition at line 187 of file elst.h.

Constructor & Destructor Documentation

◆ ELIST_ITERATOR() [1/2]

ELIST_ITERATOR::ELIST_ITERATOR ( )
inline

Definition at line 208 of file elst.h.

208  { //constructor
209  list = NULL;
210  } //unassigned list

◆ ELIST_ITERATOR() [2/2]

ELIST_ITERATOR::ELIST_ITERATOR ( ELIST list_to_iterate)
inlineexplicit

Definition at line 322 of file elst.h.

322  {
323  set_to_list(list_to_iterate);
324 }
void set_to_list(ELIST *list_to_iterate)
Definition: elst.h:297

Member Function Documentation

◆ add_after_stay_put()

void ELIST_ITERATOR::add_after_stay_put ( ELIST_LINK new_link)
inline

Definition at line 379 of file elst.h.

380  {
381  #ifndef NDEBUG
382  if (!list)
383  NO_LIST.error ("ELIST_ITERATOR::add_after_stay_put", ABORT, NULL);
384  if (!new_element)
385  BAD_PARAMETER.error ("ELIST_ITERATOR::add_after_stay_put", ABORT,
386  "new_element is NULL");
387  if (new_element->next)
388  STILL_LINKED.error ("ELIST_ITERATOR::add_after_stay_put", ABORT, NULL);
389  #endif
390 
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;
396  current = NULL;
397  }
398  else {
399  new_element->next = next;
400 
401  if (current) { //not extracted
402  current->next = new_element;
403  if (prev == current)
404  prev = new_element;
405  if (current == list->last)
406  list->last = new_element;
407  }
408  else { //current extracted
409  prev->next = new_element;
410  if (ex_current_was_last) {
411  list->last = new_element;
412  ex_current_was_last = FALSE;
413  }
414  }
415  next = new_element;
416  }
417 }
const ERRCODE STILL_LINKED
Definition: lsterr.h:40
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
#define FALSE
Definition: capi.h:46
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132

◆ add_after_then_move()

void ELIST_ITERATOR::add_after_then_move ( ELIST_LINK new_link)
inline

Definition at line 334 of file elst.h.

335  {
336  #ifndef NDEBUG
337  if (!list)
338  NO_LIST.error ("ELIST_ITERATOR::add_after_then_move", ABORT, NULL);
339  if (!new_element)
340  BAD_PARAMETER.error ("ELIST_ITERATOR::add_after_then_move", ABORT,
341  "new_element is NULL");
342  if (new_element->next)
343  STILL_LINKED.error ("ELIST_ITERATOR::add_after_then_move", ABORT, NULL);
344  #endif
345 
346  if (list->empty ()) {
347  new_element->next = new_element;
348  list->last = new_element;
349  prev = next = new_element;
350  }
351  else {
352  new_element->next = next;
353 
354  if (current) { //not extracted
355  current->next = new_element;
356  prev = current;
357  if (current == list->last)
358  list->last = new_element;
359  }
360  else { //current extracted
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;
366  }
367  }
368  current = new_element;
369 }
const ERRCODE STILL_LINKED
Definition: lsterr.h:40
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132

◆ add_before_stay_put()

void ELIST_ITERATOR::add_before_stay_put ( ELIST_LINK new_link)
inline

Definition at line 468 of file elst.h.

469  {
470  #ifndef NDEBUG
471  if (!list)
472  NO_LIST.error ("ELIST_ITERATOR::add_before_stay_put", ABORT, NULL);
473  if (!new_element)
474  BAD_PARAMETER.error ("ELIST_ITERATOR::add_before_stay_put", ABORT,
475  "new_element is NULL");
476  if (new_element->next)
477  STILL_LINKED.error ("ELIST_ITERATOR::add_before_stay_put", ABORT, NULL);
478  #endif
479 
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;
485  current = NULL;
486  }
487  else {
488  prev->next = new_element;
489  if (current) { //not extracted
490  new_element->next = current;
491  if (next == current)
492  next = new_element;
493  }
494  else { //current extracted
495  new_element->next = next;
496  if (ex_current_was_last)
497  list->last = new_element;
498  }
499  prev = new_element;
500  }
501 }
#define TRUE
Definition: capi.h:45
const ERRCODE STILL_LINKED
Definition: lsterr.h:40
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132

◆ add_before_then_move()

void ELIST_ITERATOR::add_before_then_move ( ELIST_LINK new_link)
inline

Definition at line 427 of file elst.h.

428  {
429  #ifndef NDEBUG
430  if (!list)
431  NO_LIST.error ("ELIST_ITERATOR::add_before_then_move", ABORT, NULL);
432  if (!new_element)
433  BAD_PARAMETER.error ("ELIST_ITERATOR::add_before_then_move", ABORT,
434  "new_element is NULL");
435  if (new_element->next)
436  STILL_LINKED.error ("ELIST_ITERATOR::add_before_then_move", ABORT, NULL);
437  #endif
438 
439  if (list->empty ()) {
440  new_element->next = new_element;
441  list->last = new_element;
442  prev = next = new_element;
443  }
444  else {
445  prev->next = new_element;
446  if (current) { //not extracted
447  new_element->next = current;
448  next = current;
449  }
450  else { //current extracted
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;
456  }
457  }
458  current = new_element;
459 }
const ERRCODE STILL_LINKED
Definition: lsterr.h:40
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132

◆ add_list_after()

void ELIST_ITERATOR::add_list_after ( ELIST list_to_add)
inline

Definition at line 511 of file elst.h.

511  {
512  #ifndef NDEBUG
513  if (!list)
514  NO_LIST.error ("ELIST_ITERATOR::add_list_after", ABORT, NULL);
515  if (!list_to_add)
516  BAD_PARAMETER.error ("ELIST_ITERATOR::add_list_after", ABORT,
517  "list_to_add is NULL");
518  #endif
519 
520  if (!list_to_add->empty ()) {
521  if (list->empty ()) {
522  list->last = list_to_add->last;
523  prev = list->last;
524  next = list->First ();
525  ex_current_was_last = TRUE;
526  current = NULL;
527  }
528  else {
529  if (current) { //not extracted
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;
535  }
536  else { //current extracted
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;
541  }
542  list_to_add->last->next = next;
543  next = prev->next;
544  }
545  }
546  list_to_add->last = NULL;
547  }
548 }
#define TRUE
Definition: capi.h:45
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
#define FALSE
Definition: capi.h:46
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132

◆ add_list_before()

void ELIST_ITERATOR::add_list_before ( ELIST list_to_add)
inline

Definition at line 559 of file elst.h.

559  {
560  #ifndef NDEBUG
561  if (!list)
562  NO_LIST.error ("ELIST_ITERATOR::add_list_before", ABORT, NULL);
563  if (!list_to_add)
564  BAD_PARAMETER.error ("ELIST_ITERATOR::add_list_before", ABORT,
565  "list_to_add is NULL");
566  #endif
567 
568  if (!list_to_add->empty ()) {
569  if (list->empty ()) {
570  list->last = list_to_add->last;
571  prev = list->last;
572  current = list->First ();
573  next = current->next;
574  ex_current_was_last = FALSE;
575  }
576  else {
577  prev->next = list_to_add->First ();
578  if (current) { //not extracted
579  list_to_add->last->next = current;
580  }
581  else { //current extracted
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;
587  }
588  current = prev->next;
589  next = current->next;
590  }
591  list_to_add->last = NULL;
592  }
593 }
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
#define FALSE
Definition: capi.h:46
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132

◆ add_to_end()

void ELIST_ITERATOR::add_to_end ( ELIST_LINK new_link)
inline

Definition at line 790 of file elst.h.

791  {
792  #ifndef NDEBUG
793  if (!list)
794  NO_LIST.error ("ELIST_ITERATOR::add_to_end", ABORT, NULL);
795  if (!new_element)
796  BAD_PARAMETER.error ("ELIST_ITERATOR::add_to_end", ABORT,
797  "new_element is NULL");
798  if (new_element->next)
799  STILL_LINKED.error ("ELIST_ITERATOR::add_to_end", ABORT, NULL);
800  #endif
801 
802  if (this->at_last ()) {
803  this->add_after_stay_put (new_element);
804  }
805  else {
806  if (this->at_first ()) {
807  this->add_before_stay_put (new_element);
808  list->last = new_element;
809  }
810  else { //Iteratr is elsewhere
811  new_element->next = list->last->next;
812  list->last->next = new_element;
813  list->last = new_element;
814  }
815  }
816 }
bool at_last()
Definition: elst.h:711
const ERRCODE STILL_LINKED
Definition: lsterr.h:40
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
bool at_first()
Definition: elst.h:691
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
void add_before_stay_put(ELIST_LINK *new_link)
Definition: elst.h:468
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
void add_after_stay_put(ELIST_LINK *new_link)
Definition: elst.h:379

◆ at_first()

bool ELIST_ITERATOR::at_first ( )
inline

Definition at line 691 of file elst.h.

691  {
692  #ifndef NDEBUG
693  if (!list)
694  NO_LIST.error ("ELIST_ITERATOR::at_first", ABORT, NULL);
695  #endif
696 
697  //we're at a deleted
698  return ((list->empty ()) || (current == list->First ()) || ((current == NULL) &&
699  (prev == list->last) && //NON-last pt between
700  !ex_current_was_last)); //first and last
701 }
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132

◆ at_last()

bool ELIST_ITERATOR::at_last ( )
inline

Definition at line 711 of file elst.h.

711  {
712  #ifndef NDEBUG
713  if (!list)
714  NO_LIST.error ("ELIST_ITERATOR::at_last", ABORT, NULL);
715  #endif
716 
717  //we're at a deleted
718  return ((list->empty ()) || (current == list->last) || ((current == NULL) &&
719  (prev == list->last) && //last point between
720  ex_current_was_last)); //first and last
721 }
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132

◆ current_extracted()

bool ELIST_ITERATOR::current_extracted ( )
inline

Definition at line 266 of file elst.h.

266  { //current extracted?
267  return !current;
268  }

◆ cycled_list()

bool ELIST_ITERATOR::cycled_list ( )
inline

Definition at line 731 of file elst.h.

731  {
732  #ifndef NDEBUG
733  if (!list)
734  NO_LIST.error ("ELIST_ITERATOR::cycled_list", ABORT, NULL);
735  #endif
736 
737  return ((list->empty ()) || ((current == cycle_pt) && started_cycling));
738 
739 }
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132

◆ data()

ELIST_LINK* ELIST_ITERATOR::data ( )
inline

Definition at line 235 of file elst.h.

235  { //get current data
236  #ifndef NDEBUG
237  if (!list)
238  NO_LIST.error ("ELIST_ITERATOR::data", ABORT, NULL);
239  if (!current)
240  NULL_DATA.error ("ELIST_ITERATOR::data", ABORT, NULL);
241  #endif
242  return current;
243  }
const ERRCODE NULL_DATA
Definition: lsterr.h:34
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32

◆ data_relative()

ELIST_LINK * ELIST_ITERATOR::data_relative ( inT8  offset)

Definition at line 233 of file elst.cpp.

234  { //offset from current
235  ELIST_LINK *ptr;
236 
237  #ifndef NDEBUG
238  if (!list)
239  NO_LIST.error ("ELIST_ITERATOR::data_relative", ABORT, NULL);
240  if (list->empty ())
241  EMPTY_LIST.error ("ELIST_ITERATOR::data_relative", ABORT, NULL);
242  if (offset < -1)
243  BAD_PARAMETER.error ("ELIST_ITERATOR::data_relative", ABORT,
244  "offset < -l");
245  #endif
246 
247  if (offset == -1)
248  ptr = prev;
249  else
250  for (ptr = current ? current : prev; offset-- > 0; ptr = ptr->next);
251 
252  #ifndef NDEBUG
253  if (!ptr)
254  NULL_DATA.error ("ELIST_ITERATOR::data_relative", ABORT, NULL);
255  #endif
256 
257  return ptr;
258 }
const ERRCODE NULL_DATA
Definition: lsterr.h:34
voidpf uLong offset
Definition: ioapi.h:42
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
const ERRCODE EMPTY_LIST
Definition: lsterr.h:38
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132

◆ empty()

bool ELIST_ITERATOR::empty ( )
inline

Definition at line 258 of file elst.h.

258  { //is list empty?
259  #ifndef NDEBUG
260  if (!list)
261  NO_LIST.error ("ELIST_ITERATOR::empty", ABORT, NULL);
262  #endif
263  return list->empty ();
264  }
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132

◆ exchange()

void ELIST_ITERATOR::exchange ( ELIST_ITERATOR other_it)

Definition at line 290 of file elst.cpp.

291  { //other iterator
292  const ERRCODE DONT_EXCHANGE_DELETED =
293  "Can't exchange deleted elements of lists";
294 
295  ELIST_LINK *old_current;
296 
297  #ifndef NDEBUG
298  if (!list)
299  NO_LIST.error ("ELIST_ITERATOR::exchange", ABORT, NULL);
300  if (!other_it)
301  BAD_PARAMETER.error ("ELIST_ITERATOR::exchange", ABORT, "other_it NULL");
302  if (!(other_it->list))
303  NO_LIST.error ("ELIST_ITERATOR::exchange", ABORT, "other_it");
304  #endif
305 
306  /* Do nothing if either list is empty or if both iterators reference the same
307  link */
308 
309  if ((list->empty ()) ||
310  (other_it->list->empty ()) || (current == other_it->current))
311  return;
312 
313  /* Error if either current element is deleted */
314 
315  if (!current || !other_it->current)
316  DONT_EXCHANGE_DELETED.error ("ELIST_ITERATOR.exchange", ABORT, NULL);
317 
318  /* Now handle the 4 cases: doubleton list; non-doubleton adjacent elements
319  (other before this); non-doubleton adjacent elements (this before other);
320  non-adjacent elements. */
321 
322  //adjacent links
323  if ((next == other_it->current) ||
324  (other_it->next == current)) {
325  //doubleton list
326  if ((next == other_it->current) &&
327  (other_it->next == current)) {
328  prev = next = current;
329  other_it->prev = other_it->next = other_it->current;
330  }
331  else { //non-doubleton with
332  //adjacent links
333  //other before this
334  if (other_it->next == current) {
335  other_it->prev->next = current;
336  other_it->current->next = next;
337  current->next = other_it->current;
338  other_it->next = other_it->current;
339  prev = current;
340  }
341  else { //this before other
342  prev->next = other_it->current;
343  current->next = other_it->next;
344  other_it->current->next = current;
345  next = current;
346  other_it->prev = other_it->current;
347  }
348  }
349  }
350  else { //no overlap
351  prev->next = other_it->current;
352  current->next = other_it->next;
353  other_it->prev->next = current;
354  other_it->current->next = next;
355  }
356 
357  /* update end of list pointer when necessary (remember that the 2 iterators
358  may iterate over different lists!) */
359 
360  if (list->last == current)
361  list->last = other_it->current;
362  if (other_it->list->last == other_it->current)
363  other_it->list->last = current;
364 
365  if (current == cycle_pt)
366  cycle_pt = other_it->cycle_pt;
367  if (other_it->current == other_it->cycle_pt)
368  other_it->cycle_pt = cycle_pt;
369 
370  /* The actual exchange - in all cases*/
371 
372  old_current = current;
373  current = other_it->current;
374  other_it->current = old_current;
375 }
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132

◆ extract()

ELIST_LINK * ELIST_ITERATOR::extract ( )
inline

Definition at line 605 of file elst.h.

605  {
606  ELIST_LINK *extracted_link;
607 
608  #ifndef NDEBUG
609  if (!list)
610  NO_LIST.error ("ELIST_ITERATOR::extract", ABORT, NULL);
611  if (!current) //list empty or
612  //element extracted
613  NULL_CURRENT.error ("ELIST_ITERATOR::extract",
614  ABORT, NULL);
615  #endif
616 
617  if (list->singleton()) {
618  // Special case where we do need to change the iterator.
619  prev = next = list->last = NULL;
620  } else {
621  prev->next = next; //remove from list
622 
623  if (current == list->last) {
624  list->last = prev;
625  ex_current_was_last = TRUE;
626  } else {
627  ex_current_was_last = FALSE;
628  }
629  }
630  // Always set ex_current_was_cycle_pt so an add/forward will work in a loop.
631  ex_current_was_cycle_pt = (current == cycle_pt) ? TRUE : FALSE;
632  extracted_link = current;
633  extracted_link->next = NULL; //for safety
634  current = NULL;
635  return extracted_link;
636 }
#define TRUE
Definition: capi.h:45
#define FALSE
Definition: capi.h:46
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool singleton() const
Definition: elst.h:136
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
const ERRCODE NULL_CURRENT
Definition: lsterr.h:35

◆ forward()

ELIST_LINK * ELIST_ITERATOR::forward ( )

Definition at line 194 of file elst.cpp.

194  {
195  #ifndef NDEBUG
196  if (!list)
197  NO_LIST.error ("ELIST_ITERATOR::forward", ABORT, NULL);
198  #endif
199  if (list->empty ())
200  return NULL;
201 
202  if (current) { //not removed so
203  //set previous
204  prev = current;
205  started_cycling = TRUE;
206  // In case next is deleted by another iterator, get next from current.
207  current = current->next;
208  } else {
209  if (ex_current_was_cycle_pt)
210  cycle_pt = next;
211  current = next;
212  }
213  next = current->next;
214 
215  #ifndef NDEBUG
216  if (!current)
217  NULL_DATA.error ("ELIST_ITERATOR::forward", ABORT, NULL);
218  if (!next)
219  NULL_NEXT.error ("ELIST_ITERATOR::forward", ABORT,
220  "This is: %p Current is: %p", this, current);
221  #endif
222  return current;
223 }
#define TRUE
Definition: capi.h:45
const ERRCODE NULL_NEXT
Definition: lsterr.h:36
const ERRCODE NULL_DATA
Definition: lsterr.h:34
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132

◆ length()

inT32 ELIST_ITERATOR::length ( )
inline

Definition at line 749 of file elst.h.

749  {
750  #ifndef NDEBUG
751  if (!list)
752  NO_LIST.error ("ELIST_ITERATOR::length", ABORT, NULL);
753  #endif
754 
755  return list->length ();
756 }
inT32 length() const
Definition: elst.cpp:90
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32

◆ mark_cycle_pt()

void ELIST_ITERATOR::mark_cycle_pt ( )
inline

Definition at line 670 of file elst.h.

670  {
671  #ifndef NDEBUG
672  if (!list)
673  NO_LIST.error ("ELIST_ITERATOR::mark_cycle_pt", ABORT, NULL);
674  #endif
675 
676  if (current)
677  cycle_pt = current;
678  else
679  ex_current_was_cycle_pt = TRUE;
680  started_cycling = FALSE;
681 }
#define TRUE
Definition: capi.h:45
#define FALSE
Definition: capi.h:46
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32

◆ move_to_first()

ELIST_LINK * ELIST_ITERATOR::move_to_first ( )
inline

Definition at line 646 of file elst.h.

646  {
647  #ifndef NDEBUG
648  if (!list)
649  NO_LIST.error ("ELIST_ITERATOR::move_to_first", ABORT, NULL);
650  #endif
651 
652  current = list->First ();
653  prev = list->last;
654  next = current ? current->next : NULL;
655  return current;
656 }
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32

◆ move_to_last()

ELIST_LINK * ELIST_ITERATOR::move_to_last ( )

Definition at line 268 of file elst.cpp.

268  {
269  #ifndef NDEBUG
270  if (!list)
271  NO_LIST.error ("ELIST_ITERATOR::move_to_last", ABORT, NULL);
272  #endif
273 
274  while (current != list->last)
275  forward();
276 
277  return current;
278 }
ELIST_LINK * forward()
Definition: elst.cpp:194
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
const ERRCODE NO_LIST
Definition: lsterr.h:32

◆ set_to_list()

void ELIST_ITERATOR::set_to_list ( ELIST list_to_iterate)
inline

Definition at line 297 of file elst.h.

298  {
299  #ifndef NDEBUG
300  if (!list_to_iterate)
301  BAD_PARAMETER.error ("ELIST_ITERATOR::set_to_list", ABORT,
302  "list_to_iterate is NULL");
303  #endif
304 
305  list = list_to_iterate;
306  prev = list->last;
307  current = list->First ();
308  next = current ? current->next : NULL;
309  cycle_pt = NULL; //await explicit set
310  started_cycling = FALSE;
311  ex_current_was_last = FALSE;
312  ex_current_was_cycle_pt = FALSE;
313 }
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
#define FALSE
Definition: capi.h:46
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30

◆ sort()

void ELIST_ITERATOR::sort ( int   comparator const void *, const void *)
inline

Definition at line 767 of file elst.h.

769  {
770  #ifndef NDEBUG
771  if (!list)
772  NO_LIST.error ("ELIST_ITERATOR::sort", ABORT, NULL);
773  #endif
774 
775  list->sort (comparator);
776  move_to_first();
777 }
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
ELIST_LINK * move_to_first()
Definition: elst.h:646
Definition: errcode.h:30
void sort(int comparator(const void *, const void *))
Definition: elst.cpp:108
const ERRCODE NO_LIST
Definition: lsterr.h:32

Friends And Related Function Documentation

◆ ELIST::assign_to_sublist


The documentation for this class was generated from the following files: