Update contrib.
2 **********************************************************************
3 * Copyright (C) 1998-2004, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
9 #include "LEInsertionList.h"
15 struct InsertionRecord
17 InsertionRecord *next;
20 LEGlyphID glyphs[ANY_NUMBER];
23 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LEInsertionList)
25 LEInsertionList::LEInsertionList(le_bool rightToLeft)
26 : head(NULL), tail(NULL), growAmount(0), append(rightToLeft)
28 tail = (InsertionRecord *) &head;
31 LEInsertionList::~LEInsertionList()
36 void LEInsertionList::reset()
38 while (head != NULL) {
39 InsertionRecord *record = head;
42 LE_DELETE_ARRAY(record);
45 tail = (InsertionRecord *) &head;
49 le_int32 LEInsertionList::getGrowAmount()
54 LEGlyphID *LEInsertionList::insert(le_int32 position, le_int32 count,
57 if (LE_FAILURE(success)) {
61 InsertionRecord *insertion = (InsertionRecord *) LE_NEW_ARRAY(char, sizeof(InsertionRecord) + (count - ANY_NUMBER) * sizeof (LEGlyphID));
64 success = LE_MEMORY_ALLOCATION_ERROR;
68 insertion->position = position;
69 insertion->count = count;
71 growAmount += count - 1;
74 // insert on end of list...
75 insertion->next = NULL;
76 tail->next = insertion;
79 // insert on front of list...
80 insertion->next = head;
84 return insertion->glyphs;
87 le_bool LEInsertionList::applyInsertions(LEInsertionCallback *callback)
89 for (InsertionRecord *rec = head; rec != NULL; rec = rec->next) {
90 if (callback->applyInsertion(rec->position, rec->count, rec->glyphs)) {