#include <clst.h>
Definition at line 70 of file clst.h.
| bool CLIST::add_sorted |
( |
int |
comparatorconst void *, const void *, |
|
|
bool |
unique, |
|
|
void * |
new_data |
|
) |
| |
Definition at line 173 of file clst.cpp.
176 if (last == NULL || comparator(&last->data, &new_data) < 0) {
178 new_element->data = new_data;
180 new_element->next = new_element;
182 new_element->next = last->next;
183 last->next = new_element;
187 }
else if (!unique || last->data != new_data) {
190 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
191 void* data = it.data();
192 if (data == new_data && unique)
194 if (comparator(&data, &new_data) > 0)
197 if (it.cycled_list())
198 it.add_to_end(new_data);
200 it.add_before_then_move(new_data);
Definition at line 98 of file clst.cpp.
102 "Destination list must be empty before extracting a sublist";
105 LIST_NOT_EMPTY.
error (
"CLIST.assign_to_sublist",
ABORT, NULL);
107 last = start_it->extract_sublist (end_it);
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
| bool CLIST::empty |
( |
| ) |
const |
|
inline |
| void CLIST::internal_deep_clear |
( |
void(*)(void *) |
zapper | ) |
|
| inT32 CLIST::length |
( |
| ) |
const |
Definition at line 117 of file clst.cpp.
121 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward())
| void CLIST::set_subtract |
( |
int |
comparatorconst void *, const void *, |
|
|
bool |
unique, |
|
|
CLIST * |
minuend, |
|
|
CLIST * |
subtrahend |
|
) |
| |
Definition at line 211 of file clst.cpp.
219 for (m_it.mark_cycle_pt(); !m_it.cycled_list(); m_it.forward()) {
220 void* minu = m_it.data();
223 subtra = s_it.data();
224 while (!s_it.at_last() &&
225 comparator(&subtra, &minu) < 0) {
227 subtra = s_it.data();
230 if (subtra == NULL || comparator(&subtra, &minu) != 0)
bool add_sorted(int comparator(const void *, const void *), bool unique, void *new_data)
| void CLIST::shallow_clear |
( |
| ) |
|
| void CLIST::shallow_copy |
( |
CLIST * |
from_list | ) |
|
|
inline |
Definition at line 103 of file clst.h.
105 last = from_list->last;
| bool CLIST::singleton |
( |
| ) |
const |
|
inline |
Definition at line 99 of file clst.h.
100 return last != NULL ? (last == last->next) :
false;
| void CLIST::sort |
( |
int |
comparatorconst void *, const void * | ) |
|
Definition at line 134 of file clst.cpp.
145 base = (
void **) malloc (count *
sizeof (
void *));
149 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
150 *current = it.extract ();
155 qsort ((
char *) base, count,
sizeof (*base), comparator);
159 for (i = 0; i <
count; i++) {
160 it.add_to_end (*current);
The documentation for this class was generated from the following files: