tesseract  3.04.01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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::ELIST_ITERATOR ( )
inline

Definition at line 208 of file elst.h.

208  { //constructor
209  list = NULL;
210  } //unassigned list
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

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 }
#define FALSE
Definition: capi.h:29
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132
const ERRCODE STILL_LINKED
Definition: lsterr.h:40
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
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 BAD_PARAMETER
Definition: lsterr.h:39
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132
const ERRCODE STILL_LINKED
Definition: lsterr.h:40
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
void ELIST_ITERATOR::add_before_stay_put ( ELIST_LINK new_link)
inline

Definition at line 469 of file elst.h.

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

Definition at line 512 of file elst.h.

512  {
513  #ifndef NDEBUG
514  if (!list)
515  NO_LIST.error ("ELIST_ITERATOR::add_list_after", ABORT, NULL);
516  if (!list_to_add)
517  BAD_PARAMETER.error ("ELIST_ITERATOR::add_list_after", ABORT,
518  "list_to_add is NULL");
519  #endif
520 
521  if (!list_to_add->empty ()) {
522  if (list->empty ()) {
523  list->last = list_to_add->last;
524  prev = list->last;
525  next = list->First ();
526  ex_current_was_last = TRUE;
527  current = NULL;
528  }
529  else {
530  if (current) { //not extracted
531  current->next = list_to_add->First ();
532  if (current == list->last)
533  list->last = list_to_add->last;
534  list_to_add->last->next = next;
535  next = current->next;
536  }
537  else { //current extracted
538  prev->next = list_to_add->First ();
539  if (ex_current_was_last) {
540  list->last = list_to_add->last;
541  ex_current_was_last = FALSE;
542  }
543  list_to_add->last->next = next;
544  next = prev->next;
545  }
546  }
547  list_to_add->last = NULL;
548  }
549 }
#define FALSE
Definition: capi.h:29
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
const ERRCODE NO_LIST
Definition: lsterr.h:32
bool empty() const
Definition: elst.h:132
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
#define TRUE
Definition: capi.h:28
void ELIST_ITERATOR::add_list_before ( ELIST list_to_add)
inline

Definition at line 560 of file elst.h.

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

Definition at line 791 of file elst.h.

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

Definition at line 692 of file elst.h.

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

Definition at line 712 of file elst.h.

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

Definition at line 266 of file elst.h.

266  { //current extracted?
267  return !current;
268  }
bool ELIST_ITERATOR::cycled_list ( )
inline

Definition at line 732 of file elst.h.

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

Definition at line 236 of file elst.cpp.

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

Definition at line 295 of file elst.cpp.

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

Definition at line 606 of file elst.h.

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

Definition at line 196 of file elst.cpp.

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

Definition at line 750 of file elst.h.

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

Definition at line 671 of file elst.h.

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

Definition at line 647 of file elst.h.

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

Definition at line 272 of file elst.cpp.

272  {
273  #ifndef NDEBUG
274  if (!list)
275  NO_LIST.error ("ELIST_ITERATOR::move_to_last", ABORT, NULL);
276  #endif
277 
278  while (current != list->last)
279  forward();
280 
281  return current;
282 }
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
ELIST_LINK * forward()
Definition: elst.cpp:196
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 }
#define FALSE
Definition: capi.h:29
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
void ELIST_ITERATOR::sort ( int   comparatorconst void *, const void *)
inline

Definition at line 768 of file elst.h.

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

Friends And Related Function Documentation


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