2 **********************************************************************
3 * Copyright (C) 1998-2014, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
8 #ifndef __LEINSERTIONLIST_H
9 #define __LEINSERTIONLIST_H
15 struct InsertionRecord
;
17 #ifndef U_HIDE_INTERNAL_API
19 * This class encapsulates the callback used by <code>LEInsertionList</code>
20 * to apply an insertion from the insertion list.
24 class U_LAYOUT_API LEInsertionCallback
28 * This method will be called by <code>LEInsertionList::applyInsertions</code> for each
29 * entry on the insertion list.
31 * @param atPosition the position of the insertion
32 * @param count the number of glyphs to insert
33 * @param newGlyphs the address of the glyphs to insert
35 * @return <code>TRUE</code> if <code>LEInsertions::applyInsertions</code> should
36 * stop after applying this insertion.
40 virtual le_bool
applyInsertion(le_int32 atPosition
, le_int32 count
, LEGlyphID newGlyphs
[]) = 0;
45 virtual ~LEInsertionCallback();
49 * This class is used to keep track of insertions to an array of
50 * <code>LEGlyphIDs</code>. The insertions are kept on a linked
51 * list of <code>InsertionRecords</code> so that the glyph array
52 * doesn't have to be grown for each insertion. The insertions are
53 * stored on the list from leftmost to rightmost to make it easier
54 * to do the insertions.
56 * The insertions are applied to the array by calling the
57 * <code>applyInsertions</code> method, which calls a client
58 * supplied <code>LEInsertionCallback</code> object to actually
59 * apply the individual insertions.
63 class LEInsertionList
: public UObject
67 * Construct an empty insertion list.
69 * @param rightToLeft <code>TRUE</code> if the glyphs are stored
70 * in the array in right to left order.
74 LEInsertionList(le_bool rightToLeft
);
82 * Add an entry to the insertion list.
84 * @param position the glyph at this position in the array will be
85 * replaced by the new glyphs.
86 * @param count the number of new glyphs
87 * @param success set to an error code if the auxillary data cannot be retrieved.
89 * @return the address of an array in which to store the new glyphs. This will
90 * <em>not</em> be in the glyph array.
94 LEGlyphID
*insert(le_int32 position
, le_int32 count
, LEErrorCode
&success
);
97 * Return the number of new glyphs that have been inserted.
99 * @return the number of new glyphs which have been inserted
103 le_int32
getGrowAmount();
106 * Call the <code>LEInsertionCallback</code> once for each
107 * entry on the insertion list.
109 * @param callback the <code>LEInsertionCallback</code> to call for each insertion.
111 * @return <code>TRUE</code> if <code>callback</code> returned <code>TRUE</code> to
112 * terminate the insertion list processing.
116 le_bool
applyInsertions(LEInsertionCallback
*callback
);
119 * Empty the insertion list and free all associated
127 * ICU "poor man's RTTI", returns a UClassID for the actual class.
129 * @deprecated ICU 54. See {@link icu::LayoutEngine}
131 virtual UClassID
getDynamicClassID() const;
134 * ICU "poor man's RTTI", returns a UClassID for this class.
136 * @deprecated ICU 54. See {@link icu::LayoutEngine}
138 static UClassID
getStaticClassID();
143 * The head of the insertion list.
147 InsertionRecord
*head
;
150 * The tail of the insertion list.
154 InsertionRecord
*tail
;
157 * The total number of new glyphs on the insertion list.
164 * Set to <code>TRUE</code> if the glyphs are in right
165 * to left order. Since we want the rightmost insertion
166 * to be first on the list, we need to append the
167 * insertions in this case. Otherwise they're prepended.
173 #endif /* U_HIDE_INTERNAL_API */