Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/common/LEInsertionList.h
38825 views
1
/*
2
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3
*
4
* This code is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 2 only, as
6
* published by the Free Software Foundation. Oracle designates this
7
* particular file as subject to the "Classpath" exception as provided
8
* by Oracle in the LICENSE file that accompanied this code.
9
*
10
* This code is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13
* version 2 for more details (a copy is included in the LICENSE file that
14
* accompanied this code).
15
*
16
* You should have received a copy of the GNU General Public License version
17
* 2 along with this work; if not, write to the Free Software Foundation,
18
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
*
20
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21
* or visit www.oracle.com if you need additional information or have any
22
* questions.
23
*
24
*/
25
26
/*
27
**********************************************************************
28
* Copyright (C) 1998-2013, International Business Machines
29
* Corporation and others. All Rights Reserved.
30
**********************************************************************
31
*/
32
33
#ifndef __LEINSERTIONLIST_H
34
#define __LEINSERTIONLIST_H
35
36
#include "LETypes.h"
37
38
U_NAMESPACE_BEGIN
39
40
struct InsertionRecord;
41
42
#ifndef U_HIDE_INTERNAL_API
43
/**
44
* This class encapsulates the callback used by <code>LEInsertionList</code>
45
* to apply an insertion from the insertion list.
46
*
47
* @internal
48
*/
49
class U_LAYOUT_API LEInsertionCallback
50
{
51
public:
52
/**
53
* This method will be called by <code>LEInsertionList::applyInsertions</code> for each
54
* entry on the insertion list.
55
*
56
* @param atPosition the position of the insertion
57
* @param count the number of glyphs to insert
58
* @param newGlyphs the address of the glyphs to insert
59
*
60
* @return <code>TRUE</code> if <code>LEInsertions::applyInsertions</code> should
61
* stop after applying this insertion.
62
*
63
* @internal
64
*/
65
virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, LEGlyphID newGlyphs[]) = 0;
66
67
/**
68
* The destructor
69
*/
70
virtual ~LEInsertionCallback();
71
};
72
73
/**
74
* This class is used to keep track of insertions to an array of
75
* <code>LEGlyphIDs</code>. The insertions are kept on a linked
76
* list of <code>InsertionRecords</code> so that the glyph array
77
* doesn't have to be grown for each insertion. The insertions are
78
* stored on the list from leftmost to rightmost to make it easier
79
* to do the insertions.
80
*
81
* The insertions are applied to the array by calling the
82
* <code>applyInsertions</code> method, which calls a client
83
* supplied <code>LEInsertionCallback</code> object to actually
84
* apply the individual insertions.
85
*
86
* @internal
87
*/
88
class LEInsertionList : public UObject
89
{
90
public:
91
/**
92
* Construct an empty insertion list.
93
*
94
* @param rightToLeft <code>TRUE</code> if the glyphs are stored
95
* in the array in right to left order.
96
*
97
* @internal
98
*/
99
LEInsertionList(le_bool rightToLeft);
100
101
/**
102
* The destructor.
103
*/
104
~LEInsertionList();
105
106
/**
107
* Add an entry to the insertion list.
108
*
109
* @param position the glyph at this position in the array will be
110
* replaced by the new glyphs.
111
* @param count the number of new glyphs
112
* @param success set to an error code if the auxillary data cannot be retrieved.
113
*
114
* @return the address of an array in which to store the new glyphs. This will
115
* <em>not</em> be in the glyph array.
116
*
117
* @internal
118
*/
119
LEGlyphID *insert(le_int32 position, le_int32 count, LEErrorCode &success);
120
121
/**
122
* Return the number of new glyphs that have been inserted.
123
*
124
* @return the number of new glyphs which have been inserted
125
*
126
* @internal
127
*/
128
le_int32 getGrowAmount();
129
130
/**
131
* Call the <code>LEInsertionCallback</code> once for each
132
* entry on the insertion list.
133
*
134
* @param callback the <code>LEInsertionCallback</code> to call for each insertion.
135
*
136
* @return <code>TRUE</code> if <code>callback</code> returned <code>TRUE</code> to
137
* terminate the insertion list processing.
138
*
139
* @internal
140
*/
141
le_bool applyInsertions(LEInsertionCallback *callback);
142
143
/**
144
* Empty the insertion list and free all associated
145
* storage.
146
*
147
* @internal
148
*/
149
void reset();
150
151
/**
152
* ICU "poor man's RTTI", returns a UClassID for the actual class.
153
*
154
* @stable ICU 2.8
155
*/
156
virtual UClassID getDynamicClassID() const;
157
158
/**
159
* ICU "poor man's RTTI", returns a UClassID for this class.
160
*
161
* @stable ICU 2.8
162
*/
163
static UClassID getStaticClassID();
164
165
private:
166
167
/**
168
* The head of the insertion list.
169
*
170
* @internal
171
*/
172
InsertionRecord *head;
173
174
/**
175
* The tail of the insertion list.
176
*
177
* @internal
178
*/
179
InsertionRecord *tail;
180
181
/**
182
* The total number of new glyphs on the insertion list.
183
*
184
* @internal
185
*/
186
le_int32 growAmount;
187
188
/**
189
* Set to <code>TRUE</code> if the glyphs are in right
190
* to left order. Since we want the rightmost insertion
191
* to be first on the list, we need to append the
192
* insertions in this case. Otherwise they're prepended.
193
*
194
* @internal
195
*/
196
le_bool append;
197
};
198
#endif /* U_HIDE_INTERNAL_API */
199
200
U_NAMESPACE_END
201
#endif
202
203
204