Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/common/LEInsertionList.h
38825 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425/*26**********************************************************************27* Copyright (C) 1998-2013, International Business Machines28* Corporation and others. All Rights Reserved.29**********************************************************************30*/3132#ifndef __LEINSERTIONLIST_H33#define __LEINSERTIONLIST_H3435#include "LETypes.h"3637U_NAMESPACE_BEGIN3839struct InsertionRecord;4041#ifndef U_HIDE_INTERNAL_API42/**43* This class encapsulates the callback used by <code>LEInsertionList</code>44* to apply an insertion from the insertion list.45*46* @internal47*/48class U_LAYOUT_API LEInsertionCallback49{50public:51/**52* This method will be called by <code>LEInsertionList::applyInsertions</code> for each53* entry on the insertion list.54*55* @param atPosition the position of the insertion56* @param count the number of glyphs to insert57* @param newGlyphs the address of the glyphs to insert58*59* @return <code>TRUE</code> if <code>LEInsertions::applyInsertions</code> should60* stop after applying this insertion.61*62* @internal63*/64virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, LEGlyphID newGlyphs[]) = 0;6566/**67* The destructor68*/69virtual ~LEInsertionCallback();70};7172/**73* This class is used to keep track of insertions to an array of74* <code>LEGlyphIDs</code>. The insertions are kept on a linked75* list of <code>InsertionRecords</code> so that the glyph array76* doesn't have to be grown for each insertion. The insertions are77* stored on the list from leftmost to rightmost to make it easier78* to do the insertions.79*80* The insertions are applied to the array by calling the81* <code>applyInsertions</code> method, which calls a client82* supplied <code>LEInsertionCallback</code> object to actually83* apply the individual insertions.84*85* @internal86*/87class LEInsertionList : public UObject88{89public:90/**91* Construct an empty insertion list.92*93* @param rightToLeft <code>TRUE</code> if the glyphs are stored94* in the array in right to left order.95*96* @internal97*/98LEInsertionList(le_bool rightToLeft);99100/**101* The destructor.102*/103~LEInsertionList();104105/**106* Add an entry to the insertion list.107*108* @param position the glyph at this position in the array will be109* replaced by the new glyphs.110* @param count the number of new glyphs111* @param success set to an error code if the auxillary data cannot be retrieved.112*113* @return the address of an array in which to store the new glyphs. This will114* <em>not</em> be in the glyph array.115*116* @internal117*/118LEGlyphID *insert(le_int32 position, le_int32 count, LEErrorCode &success);119120/**121* Return the number of new glyphs that have been inserted.122*123* @return the number of new glyphs which have been inserted124*125* @internal126*/127le_int32 getGrowAmount();128129/**130* Call the <code>LEInsertionCallback</code> once for each131* entry on the insertion list.132*133* @param callback the <code>LEInsertionCallback</code> to call for each insertion.134*135* @return <code>TRUE</code> if <code>callback</code> returned <code>TRUE</code> to136* terminate the insertion list processing.137*138* @internal139*/140le_bool applyInsertions(LEInsertionCallback *callback);141142/**143* Empty the insertion list and free all associated144* storage.145*146* @internal147*/148void reset();149150/**151* ICU "poor man's RTTI", returns a UClassID for the actual class.152*153* @stable ICU 2.8154*/155virtual UClassID getDynamicClassID() const;156157/**158* ICU "poor man's RTTI", returns a UClassID for this class.159*160* @stable ICU 2.8161*/162static UClassID getStaticClassID();163164private:165166/**167* The head of the insertion list.168*169* @internal170*/171InsertionRecord *head;172173/**174* The tail of the insertion list.175*176* @internal177*/178InsertionRecord *tail;179180/**181* The total number of new glyphs on the insertion list.182*183* @internal184*/185le_int32 growAmount;186187/**188* Set to <code>TRUE</code> if the glyphs are in right189* to left order. Since we want the rightmost insertion190* to be first on the list, we need to append the191* insertions in this case. Otherwise they're prepended.192*193* @internal194*/195le_bool append;196};197#endif /* U_HIDE_INTERNAL_API */198199U_NAMESPACE_END200#endif201202203204