#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 198 of file clst.cpp.
201 if (last ==
NULL || comparator(&last->data, &new_data) < 0) {
203 new_element->data = new_data;
205 new_element->next = new_element;
207 new_element->next = last->next;
208 last->next = new_element;
212 }
else if (!unique || last->data != new_data) {
215 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
216 void* data = it.data();
217 if (data == new_data && unique)
219 if (comparator(&data, &new_data) > 0)
222 if (it.cycled_list())
223 it.add_to_end(new_data);
225 it.add_before_then_move(new_data);
Definition at line 108 of file clst.cpp.
112 "Destination list must be empty before extracting a sublist";
122 last = start_it->extract_sublist (end_it);
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
const ERRCODE NULL_OBJECT
bool CLIST::empty |
( |
| ) |
const |
|
inline |
void CLIST::internal_deep_clear |
( |
void(*)(void *) |
zapper | ) |
|
Definition at line 41 of file clst.cpp.
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
const ERRCODE NULL_OBJECT
inT32 CLIST::length |
( |
| ) |
const |
Definition at line 132 of file clst.cpp.
141 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward())
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
const ERRCODE NULL_OBJECT
void CLIST::set_subtract |
( |
int |
comparatorconst void *, const void *, |
|
|
bool |
unique, |
|
|
CLIST * |
minuend, |
|
|
CLIST * |
subtrahend |
|
) |
| |
Definition at line 236 of file clst.cpp.
244 for (m_it.mark_cycle_pt(); !m_it.cycled_list(); m_it.forward()) {
245 void* minu = m_it.data();
248 subtra = s_it.data();
249 while (!s_it.at_last() &&
250 comparator(&subtra, &minu) < 0) {
252 subtra = s_it.data();
255 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 |
( |
| ) |
|
Definition at line 74 of file clst.cpp.
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
const ERRCODE NULL_OBJECT
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 154 of file clst.cpp.
170 base = (
void **) malloc (count *
sizeof (
void *));
174 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
175 *current = it.extract ();
180 qsort ((
char *) base, count,
sizeof (*base), comparator);
184 for (i = 0; i <
count; i++) {
185 it.add_to_end (*current);
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
const ERRCODE NULL_OBJECT
The documentation for this class was generated from the following files: