#include <clst.h>
List of all members.
Detailed Description
Definition at line 70 of file clst.h.
Constructor & Destructor Documentation
Member Function Documentation
bool CLIST::add_sorted |
( |
int |
comparatorconst void *, const void *, |
|
|
bool |
unique, |
|
|
void * |
new_data |
|
) |
| |
Definition at line 199 of file clst.cpp.
{
if (
last ==
NULL || comparator(&
last->data, &new_data) < 0) {
new_element->data = new_data;
new_element->next = new_element;
} else {
}
return true;
}
else if (!unique ||
last->data != new_data) {
for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
void* data = it.data();
if (data == new_data && unique)
return false;
if (comparator(&data, &new_data) > 0)
break;
}
if (it.cycled_list())
it.add_to_end(new_data);
else
it.add_before_then_move(new_data);
return true;
}
return false;
}
Definition at line 109 of file clst.cpp.
{
"Destination list must be empty before extracting a sublist";
#ifndef NDEBUG
if (!this)
#endif
last = start_it->extract_sublist (end_it);
}
bool CLIST::empty |
( |
| ) |
const |
|
inline |
void CLIST::internal_deep_clear |
( |
void(*)(void *) |
zapper | ) |
|
Definition at line 42 of file clst.cpp.
{
#ifndef NDEBUG
if (!this)
#endif
while (ptr) {
next = ptr->next;
zapper (ptr->data);
delete(ptr);
ptr = next;
}
}
}
inT32 CLIST::length |
( |
| ) |
const |
Definition at line 133 of file clst.cpp.
{
#ifndef NDEBUG
if (!this)
#endif
for (it.mark_cycle_pt(); !it.cycled_list(); it.forward())
count++;
}
void CLIST::set_subtract |
( |
int |
comparatorconst void *, const void *, |
|
|
bool |
unique, |
|
|
CLIST * |
minuend, |
|
|
CLIST * |
subtrahend |
|
) |
| |
Definition at line 237 of file clst.cpp.
{
for (m_it.mark_cycle_pt(); !m_it.cycled_list(); m_it.forward()) {
void* minu = m_it.data();
if (!s_it.empty()) {
subtra = s_it.data();
while (!s_it.at_last() &&
comparator(&subtra, &minu) < 0) {
s_it.forward();
subtra = s_it.data();
}
}
if (subtra ==
NULL || comparator(&subtra, &minu) != 0)
}
}
void CLIST::shallow_clear |
( |
| ) |
|
Definition at line 75 of file clst.cpp.
{
#ifndef NDEBUG
if (!this)
#endif
while (ptr) {
next = ptr->next;
delete(ptr);
ptr = next;
}
}
}
void CLIST::shallow_copy |
( |
CLIST * |
from_list | ) |
|
|
inline |
bool CLIST::singleton |
( |
| ) |
const |
|
inline |
void CLIST::sort |
( |
int |
comparatorconst void *, const void * | ) |
|
Definition at line 155 of file clst.cpp.
{
void **current;
#ifndef NDEBUG
if (!this)
#endif
base = (void **) malloc (count * sizeof (void *));
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
*current = it.extract ();
current++;
}
qsort ((char *) base, count, sizeof (*base), comparator);
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:
- /mnt/data/src/tesseract-ocr/ccutil/clst.h
- /mnt/data/src/tesseract-ocr/ccutil/clst.cpp