#include <elst.h>
List of all members.
Detailed Description
Definition at line 114 of file elst.h.
Constructor & Destructor Documentation
Member Function Documentation
Definition at line 172 of file elst.cpp.
{
if (last == NULL || comparator(&last, &new_link) < 0) {
if (last == NULL) {
new_link->next = new_link;
} else {
new_link->next = last->next;
last->next = new_link;
}
last = new_link;
} else {
ELIST_ITERATOR it(this);
for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
ELIST_LINK* link = it.data();
int compare = comparator(&link, &new_link);
if (compare > 0) {
break;
} else if (unique && compare == 0) {
return link;
}
}
if (it.cycled_list())
it.add_to_end(new_link);
else
it.add_before_then_move(new_link);
}
return new_link;
}
Definition at line 77 of file elst.cpp.
{
const ERRCODE LIST_NOT_EMPTY =
"Destination list must be empty before extracting a sublist";
#ifndef NDEBUG
if (!this)
NULL_OBJECT.error ("ELIST::assign_to_sublist", ABORT, NULL);
#endif
if (!empty ())
LIST_NOT_EMPTY.error ("ELIST.assign_to_sublist", ABORT, NULL);
last = start_it->extract_sublist (end_it);
}
Definition at line 41 of file elst.cpp.
{
ELIST_LINK *ptr;
ELIST_LINK *next;
#ifndef NDEBUG
if (!this)
NULL_OBJECT.error ("ELIST::internal_clear", ABORT, NULL);
#endif
if (!empty ()) {
ptr = last->next;
last->next = NULL;
last = NULL;
while (ptr) {
next = ptr->next;
zapper(ptr);
ptr = next;
}
}
}
Definition at line 101 of file elst.cpp.
{
ELIST_ITERATOR it(const_cast<ELIST*>(this));
inT32 count = 0;
#ifndef NDEBUG
if (!this)
NULL_OBJECT.error ("ELIST::length", ABORT, NULL);
#endif
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
count++;
return count;
}
Definition at line 141 of file elst.h.
{
last = from_list->last;
}
Definition at line 137 of file elst.h.
{
return last ? (last == last->next) : false;
}
void ELIST::sort |
( |
int |
comparatorconst void *, const void * | ) |
|
Definition at line 125 of file elst.cpp.
{
ELIST_ITERATOR it(this);
inT32 count;
ELIST_LINK **base;
ELIST_LINK **current;
inT32 i;
#ifndef NDEBUG
if (!this)
NULL_OBJECT.error ("ELIST::sort", ABORT, NULL);
#endif
count = length ();
base = (ELIST_LINK **) malloc (count * sizeof (ELIST_LINK *));
current = base;
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
*current = it.extract ();
current++;
}
qsort ((char *) base, count, sizeof (*base), comparator);
current = base;
for (i = 0; i < count; i++) {
it.add_to_end (*current);
current++;
}
free(base);
}
Friends And Related Function Documentation
The documentation for this class was generated from the following files:
- /usr/local/google/home/jbreiden/tesseract-ocr-read-only/ccutil/elst.h
- /usr/local/google/home/jbreiden/tesseract-ocr-read-only/ccutil/elst.cpp