]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/unicode/urep.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 ******************************************************************************
5 * Copyright (C) 1997-2010, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 ******************************************************************************
8 * Date Name Description
9 * 06/23/00 aliu Creation.
10 ******************************************************************************
16 #include "unicode/utypes.h"
20 /********************************************************************
22 ********************************************************************
27 * Talk about "can truncate result if out of memory"
30 /********************************************************************
32 ********************************************************************/
35 * \brief C API: Callbacks for UReplaceable
38 * An opaque replaceable text object. This will be manipulated only
39 * through the caller-supplied UReplaceableFunctor struct. Related
40 * to the C++ class Replaceable.
41 * This is currently only used in the Transliterator C API, see utrans.h .
44 typedef void* UReplaceable
;
47 * A set of function pointers that transliterators use to manipulate a
48 * UReplaceable. The caller should supply the required functions to
49 * manipulate their text appropriately. Related to the C++ class
53 typedef struct UReplaceableCallbacks
{
56 * Function pointer that returns the number of UChar code units in
59 * @param rep A pointer to "this" UReplaceable object.
60 * @return The length of the text.
63 int32_t (*length
)(const UReplaceable
* rep
);
66 * Function pointer that returns a UChar code units at the given
67 * offset into this text; 0 <= offset < n, where n is the value
68 * returned by (*length)(rep). See unistr.h for a description of
69 * charAt() vs. char32At().
71 * @param rep A pointer to "this" UReplaceable object.
72 * @param offset The index at which to fetch the UChar (code unit).
73 * @return The UChar (code unit) at offset, or U+FFFF if the offset is out of bounds.
76 UChar (*charAt
)(const UReplaceable
* rep
,
80 * Function pointer that returns a UChar32 code point at the given
81 * offset into this text. See unistr.h for a description of
82 * charAt() vs. char32At().
84 * @param rep A pointer to "this" UReplaceable object.
85 * @param offset The index at which to fetch the UChar32 (code point).
86 * @return The UChar32 (code point) at offset, or U+FFFF if the offset is out of bounds.
89 UChar32 (*char32At
)(const UReplaceable
* rep
,
93 * Function pointer that replaces text between start and limit in
94 * this text with the given text. Attributes (out of band info)
97 * @param rep A pointer to "this" UReplaceable object.
98 * @param start the starting index of the text to be replaced,
100 * @param limit the ending index of the text to be replaced,
102 * @param text the new text to replace the UChars from
104 * @param textLength the number of UChars at text, or -1 if text
105 * is null-terminated.
108 void (*replace
)(UReplaceable
* rep
,
115 * Function pointer that copies the characters in the range
116 * [<tt>start</tt>, <tt>limit</tt>) into the array <tt>dst</tt>.
118 * @param rep A pointer to "this" UReplaceable object.
119 * @param start offset of first character which will be copied
121 * @param limit offset immediately following the last character to
123 * @param dst array in which to copy characters. The length of
124 * <tt>dst</tt> must be at least <tt>(limit - start)</tt>.
127 void (*extract
)(UReplaceable
* rep
,
133 * Function pointer that copies text between start and limit in
134 * this text to another index in the text. Attributes (out of
135 * band info) should be retained. After this call, there will be
136 * (at least) two copies of the characters originally located at
139 * @param rep A pointer to "this" UReplaceable object.
140 * @param start the starting index of the text to be copied,
142 * @param limit the ending index of the text to be copied,
144 * @param dest the index at which the copy of the UChars should be
148 void (*copy
)(UReplaceable
* rep
,
153 } UReplaceableCallbacks
;