0N/A/*
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A *
0N/A */
0N/A
0N/A/*
0N/A **********************************************************************
5891N/A * Copyright (C) 1998-2013, International Business Machines
0N/A * Corporation and others. All Rights Reserved.
0N/A **********************************************************************
0N/A */
0N/A
0N/A#ifndef __LEINSERTIONLIST_H
0N/A#define __LEINSERTIONLIST_H
0N/A
0N/A#include "LETypes.h"
0N/A
1693N/AU_NAMESPACE_BEGIN
1693N/A
0N/Astruct InsertionRecord;
0N/A
5891N/A#ifndef U_HIDE_INTERNAL_API
0N/A/**
0N/A * This class encapsulates the callback used by <code>LEInsertionList</code>
0N/A * to apply an insertion from the insertion list.
0N/A *
0N/A * @internal
0N/A */
3171N/Aclass U_LAYOUT_API LEInsertionCallback
0N/A{
0N/Apublic:
0N/A /**
0N/A * This method will be called by <code>LEInsertionList::applyInsertions</code> for each
0N/A * entry on the insertion list.
0N/A *
0N/A * @param atPosition the position of the insertion
0N/A * @param count the number of glyphs to insert
0N/A * @param newGlyphs the address of the glyphs to insert
0N/A *
0N/A * @return <code>TRUE</code> if <code>LEInsertions::applyInsertions</code> should
0N/A * stop after applying this insertion.
0N/A *
0N/A * @internal
0N/A */
0N/A virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, LEGlyphID newGlyphs[]) = 0;
3171N/A
3171N/A /**
3171N/A * The destructor
3171N/A */
3171N/A virtual ~LEInsertionCallback();
0N/A};
0N/A
0N/A/**
0N/A * This class is used to keep track of insertions to an array of
0N/A * <code>LEGlyphIDs</code>. The insertions are kept on a linked
0N/A * list of <code>InsertionRecords</code> so that the glyph array
0N/A * doesn't have to be grown for each insertion. The insertions are
0N/A * stored on the list from leftmost to rightmost to make it easier
0N/A * to do the insertions.
0N/A *
0N/A * The insertions are applied to the array by calling the
0N/A * <code>applyInsertions</code> method, which calls a client
0N/A * supplied <code>LEInsertionCallback</code> object to actually
0N/A * apply the individual insertions.
0N/A *
0N/A * @internal
0N/A */
1693N/Aclass LEInsertionList : public UObject
0N/A{
0N/Apublic:
0N/A /**
0N/A * Construct an empty insertion list.
0N/A *
0N/A * @param rightToLeft <code>TRUE</code> if the glyphs are stored
0N/A * in the array in right to left order.
0N/A *
0N/A * @internal
0N/A */
0N/A LEInsertionList(le_bool rightToLeft);
0N/A
0N/A /**
0N/A * The destructor.
0N/A */
0N/A ~LEInsertionList();
0N/A
0N/A /**
0N/A * Add an entry to the insertion list.
0N/A *
0N/A * @param position the glyph at this position in the array will be
0N/A * replaced by the new glyphs.
0N/A * @param count the number of new glyphs
3171N/A * @param success set to an error code if the auxillary data cannot be retrieved.
0N/A *
0N/A * @return the address of an array in which to store the new glyphs. This will
0N/A * <em>not</em> be in the glyph array.
0N/A *
0N/A * @internal
0N/A */
3171N/A LEGlyphID *insert(le_int32 position, le_int32 count, LEErrorCode &success);
0N/A
0N/A /**
0N/A * Return the number of new glyphs that have been inserted.
0N/A *
0N/A * @return the number of new glyphs which have been inserted
0N/A *
0N/A * @internal
0N/A */
0N/A le_int32 getGrowAmount();
0N/A
0N/A /**
0N/A * Call the <code>LEInsertionCallback</code> once for each
0N/A * entry on the insertion list.
0N/A *
0N/A * @param callback the <code>LEInsertionCallback</code> to call for each insertion.
0N/A *
0N/A * @return <code>TRUE</code> if <code>callback</code> returned <code>TRUE</code> to
0N/A * terminate the insertion list processing.
0N/A *
0N/A * @internal
0N/A */
0N/A le_bool applyInsertions(LEInsertionCallback *callback);
0N/A
0N/A /**
0N/A * Empty the insertion list and free all associated
0N/A * storage.
0N/A *
0N/A * @internal
0N/A */
0N/A void reset();
0N/A
1693N/A /**
1693N/A * ICU "poor man's RTTI", returns a UClassID for the actual class.
1693N/A *
1693N/A * @stable ICU 2.8
1693N/A */
1693N/A virtual UClassID getDynamicClassID() const;
1693N/A
1693N/A /**
1693N/A * ICU "poor man's RTTI", returns a UClassID for this class.
1693N/A *
1693N/A * @stable ICU 2.8
1693N/A */
1693N/A static UClassID getStaticClassID();
1693N/A
0N/Aprivate:
0N/A
0N/A /**
0N/A * The head of the insertion list.
0N/A *
0N/A * @internal
0N/A */
0N/A InsertionRecord *head;
0N/A
0N/A /**
0N/A * The tail of the insertion list.
0N/A *
0N/A * @internal
0N/A */
0N/A InsertionRecord *tail;
0N/A
0N/A /**
0N/A * The total number of new glyphs on the insertion list.
0N/A *
0N/A * @internal
0N/A */
0N/A le_int32 growAmount;
0N/A
0N/A /**
0N/A * Set to <code>TRUE</code> if the glyphs are in right
0N/A * to left order. Since we want the rightmost insertion
0N/A * to be first on the list, we need to append the
0N/A * insertions in this case. Otherwise they're prepended.
0N/A *
0N/A * @internal
0N/A */
0N/A le_bool append;
0N/A};
5891N/A#endif /* U_HIDE_INTERNAL_API */
0N/A
1693N/AU_NAMESPACE_END
0N/A#endif
1693N/A