tesseract  3.04.01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CLIST_ITERATOR Class Reference

#include <clst.h>

Public Member Functions

 CLIST_ITERATOR ()
 
 CLIST_ITERATOR (CLIST *list_to_iterate)
 
void set_to_list (CLIST *list_to_iterate)
 
void add_after_then_move (void *new_data)
 
void add_after_stay_put (void *new_data)
 
void add_before_then_move (void *new_data)
 
void add_before_stay_put (void *new_data)
 
void add_list_after (CLIST *list_to_add)
 
void add_list_before (CLIST *list_to_add)
 
void * data ()
 
void * data_relative (inT8 offset)
 
void * forward ()
 
void * extract ()
 
void * move_to_first ()
 
void * move_to_last ()
 
void mark_cycle_pt ()
 
BOOL8 empty ()
 
BOOL8 current_extracted ()
 
BOOL8 at_first ()
 
BOOL8 at_last ()
 
BOOL8 cycled_list ()
 
void add_to_end (void *new_data)
 
void exchange (CLIST_ITERATOR *other_it)
 
inT32 length ()
 
void sort (int comparator(const void *, const void *))
 

Friends

void CLIST::assign_to_sublist (CLIST_ITERATOR *, CLIST_ITERATOR *)
 

Detailed Description

Definition at line 144 of file clst.h.

Constructor & Destructor Documentation

CLIST_ITERATOR::CLIST_ITERATOR ( )
inline

Definition at line 165 of file clst.h.

165  { //constructor
166  list = NULL;
167  } //unassigned list
CLIST_ITERATOR::CLIST_ITERATOR ( CLIST list_to_iterate)
inline

Definition at line 280 of file clst.h.

280  {
281  set_to_list(list_to_iterate);
282 }
void set_to_list(CLIST *list_to_iterate)
Definition: clst.h:255

Member Function Documentation

void CLIST_ITERATOR::add_after_stay_put ( void *  new_data)
inline

Definition at line 340 of file clst.h.

341  {
342  CLIST_LINK *new_element;
343 
344  #ifndef NDEBUG
345  if (!list)
346  NO_LIST.error ("CLIST_ITERATOR::add_after_stay_put", ABORT, NULL);
347  if (!new_data)
348  BAD_PARAMETER.error ("CLIST_ITERATOR::add_after_stay_put", ABORT,
349  "new_data is NULL");
350  #endif
351 
352  new_element = new CLIST_LINK;
353  new_element->data = new_data;
354 
355  if (list->empty ()) {
356  new_element->next = new_element;
357  list->last = new_element;
358  prev = next = new_element;
359  ex_current_was_last = FALSE;
360  current = NULL;
361  }
362  else {
363  new_element->next = next;
364 
365  if (current) { //not extracted
366  current->next = new_element;
367  if (prev == current)
368  prev = new_element;
369  if (current == list->last)
370  list->last = new_element;
371  }
372  else { //current extracted
373  prev->next = new_element;
374  if (ex_current_was_last) {
375  list->last = new_element;
376  ex_current_was_last = FALSE;
377  }
378  }
379  next = new_element;
380  }
381 }
#define FALSE
Definition: capi.h:29
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool empty() const
Definition: clst.h:95
Definition: errcode.h:30
void CLIST_ITERATOR::add_after_then_move ( void *  new_data)
inline

Definition at line 292 of file clst.h.

293  {
294  CLIST_LINK *new_element;
295 
296  #ifndef NDEBUG
297  if (!list)
298  NO_LIST.error ("CLIST_ITERATOR::add_after_then_move", ABORT, NULL);
299  if (!new_data)
300  BAD_PARAMETER.error ("CLIST_ITERATOR::add_after_then_move", ABORT,
301  "new_data is NULL");
302  #endif
303 
304  new_element = new CLIST_LINK;
305  new_element->data = new_data;
306 
307  if (list->empty ()) {
308  new_element->next = new_element;
309  list->last = new_element;
310  prev = next = new_element;
311  }
312  else {
313  new_element->next = next;
314 
315  if (current) { //not extracted
316  current->next = new_element;
317  prev = current;
318  if (current == list->last)
319  list->last = new_element;
320  }
321  else { //current extracted
322  prev->next = new_element;
323  if (ex_current_was_last)
324  list->last = new_element;
325  if (ex_current_was_cycle_pt)
326  cycle_pt = new_element;
327  }
328  }
329  current = new_element;
330 }
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool empty() const
Definition: clst.h:95
Definition: errcode.h:30
void CLIST_ITERATOR::add_before_stay_put ( void *  new_data)
inline

Definition at line 436 of file clst.h.

437  {
438  CLIST_LINK *new_element;
439 
440  #ifndef NDEBUG
441  if (!list)
442  NO_LIST.error ("CLIST_ITERATOR::add_before_stay_put", ABORT, NULL);
443  if (!new_data)
444  BAD_PARAMETER.error ("CLIST_ITERATOR::add_before_stay_put", ABORT,
445  "new_data is NULL");
446  #endif
447 
448  new_element = new CLIST_LINK;
449  new_element->data = new_data;
450 
451  if (list->empty ()) {
452  new_element->next = new_element;
453  list->last = new_element;
454  prev = next = new_element;
455  ex_current_was_last = TRUE;
456  current = NULL;
457  }
458  else {
459  prev->next = new_element;
460  if (current) { //not extracted
461  new_element->next = current;
462  if (next == current)
463  next = new_element;
464  }
465  else { //current extracted
466  new_element->next = next;
467  if (ex_current_was_last)
468  list->last = new_element;
469  }
470  prev = new_element;
471  }
472 }
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool empty() const
Definition: clst.h:95
Definition: errcode.h:30
#define TRUE
Definition: capi.h:28
void CLIST_ITERATOR::add_before_then_move ( void *  new_data)
inline

Definition at line 391 of file clst.h.

392  {
393  CLIST_LINK *new_element;
394 
395  #ifndef NDEBUG
396  if (!list)
397  NO_LIST.error ("CLIST_ITERATOR::add_before_then_move", ABORT, NULL);
398  if (!new_data)
399  BAD_PARAMETER.error ("CLIST_ITERATOR::add_before_then_move", ABORT,
400  "new_data is NULL");
401  #endif
402 
403  new_element = new CLIST_LINK;
404  new_element->data = new_data;
405 
406  if (list->empty ()) {
407  new_element->next = new_element;
408  list->last = new_element;
409  prev = next = new_element;
410  }
411  else {
412  prev->next = new_element;
413  if (current) { //not extracted
414  new_element->next = current;
415  next = current;
416  }
417  else { //current extracted
418  new_element->next = next;
419  if (ex_current_was_last)
420  list->last = new_element;
421  if (ex_current_was_cycle_pt)
422  cycle_pt = new_element;
423  }
424  }
425  current = new_element;
426 }
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool empty() const
Definition: clst.h:95
Definition: errcode.h:30
void CLIST_ITERATOR::add_list_after ( CLIST list_to_add)
inline

Definition at line 482 of file clst.h.

482  {
483  #ifndef NDEBUG
484  if (!list)
485  NO_LIST.error ("CLIST_ITERATOR::add_list_after", ABORT, NULL);
486  if (!list_to_add)
487  BAD_PARAMETER.error ("CLIST_ITERATOR::add_list_after", ABORT,
488  "list_to_add is NULL");
489  #endif
490 
491  if (!list_to_add->empty ()) {
492  if (list->empty ()) {
493  list->last = list_to_add->last;
494  prev = list->last;
495  next = list->First ();
496  ex_current_was_last = TRUE;
497  current = NULL;
498  }
499  else {
500  if (current) { //not extracted
501  current->next = list_to_add->First ();
502  if (current == list->last)
503  list->last = list_to_add->last;
504  list_to_add->last->next = next;
505  next = current->next;
506  }
507  else { //current extracted
508  prev->next = list_to_add->First ();
509  if (ex_current_was_last) {
510  list->last = list_to_add->last;
511  ex_current_was_last = FALSE;
512  }
513  list_to_add->last->next = next;
514  next = prev->next;
515  }
516  }
517  list_to_add->last = NULL;
518  }
519 }
#define FALSE
Definition: capi.h:29
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool empty() const
Definition: clst.h:95
Definition: errcode.h:30
#define TRUE
Definition: capi.h:28
void CLIST_ITERATOR::add_list_before ( CLIST list_to_add)
inline

Definition at line 530 of file clst.h.

530  {
531  #ifndef NDEBUG
532  if (!list)
533  NO_LIST.error ("CLIST_ITERATOR::add_list_before", ABORT, NULL);
534  if (!list_to_add)
535  BAD_PARAMETER.error ("CLIST_ITERATOR::add_list_before", ABORT,
536  "list_to_add is NULL");
537  #endif
538 
539  if (!list_to_add->empty ()) {
540  if (list->empty ()) {
541  list->last = list_to_add->last;
542  prev = list->last;
543  current = list->First ();
544  next = current->next;
545  ex_current_was_last = FALSE;
546  }
547  else {
548  prev->next = list_to_add->First ();
549  if (current) { //not extracted
550  list_to_add->last->next = current;
551  }
552  else { //current extracted
553  list_to_add->last->next = next;
554  if (ex_current_was_last)
555  list->last = list_to_add->last;
556  if (ex_current_was_cycle_pt)
557  cycle_pt = prev->next;
558  }
559  current = prev->next;
560  next = current->next;
561  }
562  list_to_add->last = NULL;
563  }
564 }
#define FALSE
Definition: capi.h:29
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool empty() const
Definition: clst.h:95
Definition: errcode.h:30
void CLIST_ITERATOR::add_to_end ( void *  new_data)
inline

Definition at line 761 of file clst.h.

762  {
763  CLIST_LINK *new_element;
764 
765  #ifndef NDEBUG
766  if (!list)
767  NO_LIST.error ("CLIST_ITERATOR::add_to_end", ABORT, NULL);
768  if (!new_data)
769  BAD_PARAMETER.error ("CLIST_ITERATOR::add_to_end", ABORT,
770  "new_data is NULL");
771  #endif
772 
773  if (this->at_last ()) {
774  this->add_after_stay_put (new_data);
775  }
776  else {
777  if (this->at_first ()) {
778  this->add_before_stay_put (new_data);
779  list->last = prev;
780  }
781  else { //Iteratr is elsewhere
782  new_element = new CLIST_LINK;
783  new_element->data = new_data;
784 
785  new_element->next = list->last->next;
786  list->last->next = new_element;
787  list->last = new_element;
788  }
789  }
790 }
void add_before_stay_put(void *new_data)
Definition: clst.h:436
void add_after_stay_put(void *new_data)
Definition: clst.h:340
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
const ERRCODE NO_LIST
Definition: lsterr.h:32
BOOL8 at_last()
Definition: clst.h:682
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
BOOL8 at_first()
Definition: clst.h:662
Definition: errcode.h:30
BOOL8 CLIST_ITERATOR::at_first ( )
inline

Definition at line 662 of file clst.h.

662  {
663  #ifndef NDEBUG
664  if (!list)
665  NO_LIST.error ("CLIST_ITERATOR::at_first", ABORT, NULL);
666  #endif
667 
668  //we're at a deleted
669  return ((list->empty ()) || (current == list->First ()) || ((current == NULL) &&
670  (prev == list->last) && //NON-last pt between
671  !ex_current_was_last)); //first and last
672 }
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool empty() const
Definition: clst.h:95
Definition: errcode.h:30
BOOL8 CLIST_ITERATOR::at_last ( )
inline

Definition at line 682 of file clst.h.

682  {
683  #ifndef NDEBUG
684  if (!list)
685  NO_LIST.error ("CLIST_ITERATOR::at_last", ABORT, NULL);
686  #endif
687 
688  //we're at a deleted
689  return ((list->empty ()) || (current == list->last) || ((current == NULL) &&
690  (prev == list->last) && //last point between
691  ex_current_was_last)); //first and last
692 }
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool empty() const
Definition: clst.h:95
Definition: errcode.h:30
BOOL8 CLIST_ITERATOR::current_extracted ( )
inline

Definition at line 224 of file clst.h.

224  { //current extracted?
225  return !current;
226  }
BOOL8 CLIST_ITERATOR::cycled_list ( )
inline

Definition at line 702 of file clst.h.

702  {
703  #ifndef NDEBUG
704  if (!list)
705  NO_LIST.error ("CLIST_ITERATOR::cycled_list", ABORT, NULL);
706  #endif
707 
708  return ((list->empty ()) || ((current == cycle_pt) && started_cycling));
709 
710 }
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool empty() const
Definition: clst.h:95
Definition: errcode.h:30
void* CLIST_ITERATOR::data ( )
inline

Definition at line 193 of file clst.h.

193  { //get current data
194  #ifndef NDEBUG
195  if (!list)
196  NO_LIST.error ("CLIST_ITERATOR::data", ABORT, NULL);
197  if (!current)
198  NULL_DATA.error ("CLIST_ITERATOR::data", ABORT, NULL);
199  #endif
200  return current->data;
201  }
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
void * CLIST_ITERATOR::data_relative ( inT8  offset)

Definition at line 288 of file clst.cpp.

289  { //offset from current
290  CLIST_LINK *ptr;
291 
292  #ifndef NDEBUG
293  if (!list)
294  NO_LIST.error ("CLIST_ITERATOR::data_relative", ABORT, NULL);
295  if (list->empty ())
296  EMPTY_LIST.error ("CLIST_ITERATOR::data_relative", ABORT, NULL);
297  if (offset < -1)
298  BAD_PARAMETER.error ("CLIST_ITERATOR::data_relative", ABORT,
299  "offset < -l");
300  #endif
301 
302  if (offset == -1)
303  ptr = prev;
304  else
305  for (ptr = current ? current : prev; offset-- > 0; ptr = ptr->next);
306 
307  #ifndef NDEBUG
308  if (!ptr)
309  NULL_DATA.error ("CLIST_ITERATOR::data_relative", ABORT, NULL);
310  #endif
311 
312  return ptr->data;
313 }
const ERRCODE EMPTY_LIST
Definition: lsterr.h:38
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool empty() const
Definition: clst.h:95
const ERRCODE NULL_DATA
Definition: lsterr.h:34
Definition: errcode.h:30
BOOL8 CLIST_ITERATOR::empty ( )
inline

Definition at line 216 of file clst.h.

216  { //is list empty?
217  #ifndef NDEBUG
218  if (!list)
219  NO_LIST.error ("CLIST_ITERATOR::empty", ABORT, NULL);
220  #endif
221  return list->empty ();
222  }
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool empty() const
Definition: clst.h:95
Definition: errcode.h:30
void CLIST_ITERATOR::exchange ( CLIST_ITERATOR other_it)

Definition at line 350 of file clst.cpp.

351  { //other iterator
352  const ERRCODE DONT_EXCHANGE_DELETED =
353  "Can't exchange deleted elements of lists";
354 
355  CLIST_LINK *old_current;
356 
357  #ifndef NDEBUG
358  if (!list)
359  NO_LIST.error ("CLIST_ITERATOR::exchange", ABORT, NULL);
360  if (!other_it)
361  BAD_PARAMETER.error ("CLIST_ITERATOR::exchange", ABORT, "other_it NULL");
362  if (!(other_it->list))
363  NO_LIST.error ("CLIST_ITERATOR::exchange", ABORT, "other_it");
364  #endif
365 
366  /* Do nothing if either list is empty or if both iterators reference the same
367  link */
368 
369  if ((list->empty ()) ||
370  (other_it->list->empty ()) || (current == other_it->current))
371  return;
372 
373  /* Error if either current element is deleted */
374 
375  if (!current || !other_it->current)
376  DONT_EXCHANGE_DELETED.error ("CLIST_ITERATOR.exchange", ABORT, NULL);
377 
378  /* Now handle the 4 cases: doubleton list; non-doubleton adjacent elements
379  (other before this); non-doubleton adjacent elements (this before other);
380  non-adjacent elements. */
381 
382  //adjacent links
383  if ((next == other_it->current) ||
384  (other_it->next == current)) {
385  //doubleton list
386  if ((next == other_it->current) &&
387  (other_it->next == current)) {
388  prev = next = current;
389  other_it->prev = other_it->next = other_it->current;
390  }
391  else { //non-doubleton with
392  //adjacent links
393  //other before this
394  if (other_it->next == current) {
395  other_it->prev->next = current;
396  other_it->current->next = next;
397  current->next = other_it->current;
398  other_it->next = other_it->current;
399  prev = current;
400  }
401  else { //this before other
402  prev->next = other_it->current;
403  current->next = other_it->next;
404  other_it->current->next = current;
405  next = current;
406  other_it->prev = other_it->current;
407  }
408  }
409  }
410  else { //no overlap
411  prev->next = other_it->current;
412  current->next = other_it->next;
413  other_it->prev->next = current;
414  other_it->current->next = next;
415  }
416 
417  /* update end of list pointer when necessary (remember that the 2 iterators
418  may iterate over different lists!) */
419 
420  if (list->last == current)
421  list->last = other_it->current;
422  if (other_it->list->last == other_it->current)
423  other_it->list->last = current;
424 
425  if (current == cycle_pt)
426  cycle_pt = other_it->cycle_pt;
427  if (other_it->current == other_it->cycle_pt)
428  other_it->cycle_pt = cycle_pt;
429 
430  /* The actual exchange - in all cases*/
431 
432  old_current = current;
433  current = other_it->current;
434  other_it->current = old_current;
435 }
const ERRCODE BAD_PARAMETER
Definition: lsterr.h:39
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool empty() const
Definition: clst.h:95
Definition: errcode.h:30
void * CLIST_ITERATOR::extract ( )
inline

Definition at line 576 of file clst.h.

576  {
577  void *extracted_data;
578 
579  #ifndef NDEBUG
580  if (!list)
581  NO_LIST.error ("CLIST_ITERATOR::extract", ABORT, NULL);
582  if (!current) //list empty or
583  //element extracted
584  NULL_CURRENT.error ("CLIST_ITERATOR::extract",
585  ABORT, NULL);
586  #endif
587 
588  if (list->singleton()) {
589  // Special case where we do need to change the iterator.
590  prev = next = list->last = NULL;
591  } else {
592  prev->next = next; //remove from list
593 
594  if (current == list->last) {
595  list->last = prev;
596  ex_current_was_last = TRUE;
597  } else {
598  ex_current_was_last = FALSE;
599  }
600  }
601  // Always set ex_current_was_cycle_pt so an add/forward will work in a loop.
602  ex_current_was_cycle_pt = (current == cycle_pt) ? TRUE : FALSE;
603  extracted_data = current->data;
604  delete(current); //destroy CONS cell
605  current = NULL;
606  return extracted_data;
607 }
#define FALSE
Definition: capi.h:29
bool singleton() const
Definition: clst.h:99
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
void * CLIST_ITERATOR::forward ( )

Definition at line 248 of file clst.cpp.

248  {
249  #ifndef NDEBUG
250  if (!list)
251  NO_LIST.error ("CLIST_ITERATOR::forward", ABORT, NULL);
252  #endif
253  if (list->empty ())
254  return NULL;
255 
256  if (current) { //not removed so
257  //set previous
258  prev = current;
259  started_cycling = TRUE;
260  // In case next is deleted by another iterator, get next from current.
261  current = current->next;
262  } else {
263  if (ex_current_was_cycle_pt)
264  cycle_pt = next;
265  current = next;
266  }
267  next = current->next;
268 
269  #ifndef NDEBUG
270  if (!current)
271  NULL_DATA.error ("CLIST_ITERATOR::forward", ABORT, NULL);
272  if (!next)
273  NULL_NEXT.error ("CLIST_ITERATOR::forward", ABORT,
274  "This is: %p Current is: %p", this, current);
275  #endif
276  return current->data;
277 }
const ERRCODE NULL_NEXT
Definition: lsterr.h:36
const ERRCODE NO_LIST
Definition: lsterr.h:32
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
bool empty() const
Definition: clst.h:95
const ERRCODE NULL_DATA
Definition: lsterr.h:34
Definition: errcode.h:30
#define TRUE
Definition: capi.h:28
inT32 CLIST_ITERATOR::length ( )
inline

Definition at line 720 of file clst.h.

720  {
721  #ifndef NDEBUG
722  if (!list)
723  NO_LIST.error ("CLIST_ITERATOR::length", ABORT, NULL);
724  #endif
725 
726  return list->length ();
727 }
const ERRCODE NO_LIST
Definition: lsterr.h:32
inT32 length() const
Definition: clst.cpp:117
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
void CLIST_ITERATOR::mark_cycle_pt ( )
inline

Definition at line 641 of file clst.h.

641  {
642  #ifndef NDEBUG
643  if (!list)
644  NO_LIST.error ("CLIST_ITERATOR::mark_cycle_pt", ABORT, NULL);
645  #endif
646 
647  if (current)
648  cycle_pt = current;
649  else
650  ex_current_was_cycle_pt = TRUE;
651  started_cycling = FALSE;
652 }
#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
void * CLIST_ITERATOR::move_to_first ( )
inline

Definition at line 617 of file clst.h.

617  {
618  #ifndef NDEBUG
619  if (!list)
620  NO_LIST.error ("CLIST_ITERATOR::move_to_first", ABORT, NULL);
621  #endif
622 
623  current = list->First ();
624  prev = list->last;
625  next = current != NULL ? current->next : NULL;
626  return current != NULL ? current->data : NULL;
627 }
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
void * CLIST_ITERATOR::move_to_last ( )

Definition at line 324 of file clst.cpp.

324  {
325  #ifndef NDEBUG
326  if (!list)
327  NO_LIST.error ("CLIST_ITERATOR::move_to_last", ABORT, NULL);
328  #endif
329 
330  while (current != list->last)
331  forward();
332 
333  if (current == NULL)
334  return NULL;
335  else
336  return current->data;
337 }
const ERRCODE NO_LIST
Definition: lsterr.h:32
void * forward()
Definition: clst.cpp:248
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:40
Definition: errcode.h:30
void CLIST_ITERATOR::set_to_list ( CLIST list_to_iterate)
inline

Definition at line 255 of file clst.h.

256  {
257  #ifndef NDEBUG
258  if (!list_to_iterate)
259  BAD_PARAMETER.error ("CLIST_ITERATOR::set_to_list", ABORT,
260  "list_to_iterate is NULL");
261  #endif
262 
263  list = list_to_iterate;
264  prev = list->last;
265  current = list->First ();
266  next = current != NULL ? current->next : NULL;
267  cycle_pt = NULL; //await explicit set
268  started_cycling = FALSE;
269  ex_current_was_last = FALSE;
270  ex_current_was_cycle_pt = FALSE;
271 }
#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 CLIST_ITERATOR::sort ( int   comparatorconst void *, const void *)
inline

Definition at line 738 of file clst.h.

740  {
741  #ifndef NDEBUG
742  if (!list)
743  NO_LIST.error ("CLIST_ITERATOR::sort", ABORT, NULL);
744  #endif
745 
746  list->sort (comparator);
747  move_to_first();
748 }
void * move_to_first()
Definition: clst.h:617
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
void sort(int comparator(const void *, const void *))
Definition: clst.cpp:134

Friends And Related Function Documentation


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