annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/unicode/urep.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 // © 2016 and later: Unicode, Inc. and others.
jpayne@69 2 // License & terms of use: http://www.unicode.org/copyright.html
jpayne@69 3 /*
jpayne@69 4 ******************************************************************************
jpayne@69 5 * Copyright (C) 1997-2010, International Business Machines
jpayne@69 6 * Corporation and others. All Rights Reserved.
jpayne@69 7 ******************************************************************************
jpayne@69 8 * Date Name Description
jpayne@69 9 * 06/23/00 aliu Creation.
jpayne@69 10 ******************************************************************************
jpayne@69 11 */
jpayne@69 12
jpayne@69 13 #ifndef __UREP_H
jpayne@69 14 #define __UREP_H
jpayne@69 15
jpayne@69 16 #include "unicode/utypes.h"
jpayne@69 17
jpayne@69 18 U_CDECL_BEGIN
jpayne@69 19
jpayne@69 20 /********************************************************************
jpayne@69 21 * General Notes
jpayne@69 22 ********************************************************************
jpayne@69 23 * TODO
jpayne@69 24 * Add usage scenario
jpayne@69 25 * Add test code
jpayne@69 26 * Talk about pinning
jpayne@69 27 * Talk about "can truncate result if out of memory"
jpayne@69 28 */
jpayne@69 29
jpayne@69 30 /********************************************************************
jpayne@69 31 * Data Structures
jpayne@69 32 ********************************************************************/
jpayne@69 33 /**
jpayne@69 34 * \file
jpayne@69 35 * \brief C API: Callbacks for UReplaceable
jpayne@69 36 */
jpayne@69 37 /**
jpayne@69 38 * An opaque replaceable text object. This will be manipulated only
jpayne@69 39 * through the caller-supplied UReplaceableFunctor struct. Related
jpayne@69 40 * to the C++ class Replaceable.
jpayne@69 41 * This is currently only used in the Transliterator C API, see utrans.h .
jpayne@69 42 * @stable ICU 2.0
jpayne@69 43 */
jpayne@69 44 typedef void* UReplaceable;
jpayne@69 45
jpayne@69 46 /**
jpayne@69 47 * A set of function pointers that transliterators use to manipulate a
jpayne@69 48 * UReplaceable. The caller should supply the required functions to
jpayne@69 49 * manipulate their text appropriately. Related to the C++ class
jpayne@69 50 * Replaceable.
jpayne@69 51 * @stable ICU 2.0
jpayne@69 52 */
jpayne@69 53 typedef struct UReplaceableCallbacks {
jpayne@69 54
jpayne@69 55 /**
jpayne@69 56 * Function pointer that returns the number of UChar code units in
jpayne@69 57 * this text.
jpayne@69 58 *
jpayne@69 59 * @param rep A pointer to "this" UReplaceable object.
jpayne@69 60 * @return The length of the text.
jpayne@69 61 * @stable ICU 2.0
jpayne@69 62 */
jpayne@69 63 int32_t (*length)(const UReplaceable* rep);
jpayne@69 64
jpayne@69 65 /**
jpayne@69 66 * Function pointer that returns a UChar code units at the given
jpayne@69 67 * offset into this text; 0 <= offset < n, where n is the value
jpayne@69 68 * returned by (*length)(rep). See unistr.h for a description of
jpayne@69 69 * charAt() vs. char32At().
jpayne@69 70 *
jpayne@69 71 * @param rep A pointer to "this" UReplaceable object.
jpayne@69 72 * @param offset The index at which to fetch the UChar (code unit).
jpayne@69 73 * @return The UChar (code unit) at offset, or U+FFFF if the offset is out of bounds.
jpayne@69 74 * @stable ICU 2.0
jpayne@69 75 */
jpayne@69 76 UChar (*charAt)(const UReplaceable* rep,
jpayne@69 77 int32_t offset);
jpayne@69 78
jpayne@69 79 /**
jpayne@69 80 * Function pointer that returns a UChar32 code point at the given
jpayne@69 81 * offset into this text. See unistr.h for a description of
jpayne@69 82 * charAt() vs. char32At().
jpayne@69 83 *
jpayne@69 84 * @param rep A pointer to "this" UReplaceable object.
jpayne@69 85 * @param offset The index at which to fetch the UChar32 (code point).
jpayne@69 86 * @return The UChar32 (code point) at offset, or U+FFFF if the offset is out of bounds.
jpayne@69 87 * @stable ICU 2.0
jpayne@69 88 */
jpayne@69 89 UChar32 (*char32At)(const UReplaceable* rep,
jpayne@69 90 int32_t offset);
jpayne@69 91
jpayne@69 92 /**
jpayne@69 93 * Function pointer that replaces text between start and limit in
jpayne@69 94 * this text with the given text. Attributes (out of band info)
jpayne@69 95 * should be retained.
jpayne@69 96 *
jpayne@69 97 * @param rep A pointer to "this" UReplaceable object.
jpayne@69 98 * @param start the starting index of the text to be replaced,
jpayne@69 99 * inclusive.
jpayne@69 100 * @param limit the ending index of the text to be replaced,
jpayne@69 101 * exclusive.
jpayne@69 102 * @param text the new text to replace the UChars from
jpayne@69 103 * start..limit-1.
jpayne@69 104 * @param textLength the number of UChars at text, or -1 if text
jpayne@69 105 * is null-terminated.
jpayne@69 106 * @stable ICU 2.0
jpayne@69 107 */
jpayne@69 108 void (*replace)(UReplaceable* rep,
jpayne@69 109 int32_t start,
jpayne@69 110 int32_t limit,
jpayne@69 111 const UChar* text,
jpayne@69 112 int32_t textLength);
jpayne@69 113
jpayne@69 114 /**
jpayne@69 115 * Function pointer that copies the characters in the range
jpayne@69 116 * [<tt>start</tt>, <tt>limit</tt>) into the array <tt>dst</tt>.
jpayne@69 117 *
jpayne@69 118 * @param rep A pointer to "this" UReplaceable object.
jpayne@69 119 * @param start offset of first character which will be copied
jpayne@69 120 * into the array
jpayne@69 121 * @param limit offset immediately following the last character to
jpayne@69 122 * be copied
jpayne@69 123 * @param dst array in which to copy characters. The length of
jpayne@69 124 * <tt>dst</tt> must be at least <tt>(limit - start)</tt>.
jpayne@69 125 * @stable ICU 2.1
jpayne@69 126 */
jpayne@69 127 void (*extract)(UReplaceable* rep,
jpayne@69 128 int32_t start,
jpayne@69 129 int32_t limit,
jpayne@69 130 UChar* dst);
jpayne@69 131
jpayne@69 132 /**
jpayne@69 133 * Function pointer that copies text between start and limit in
jpayne@69 134 * this text to another index in the text. Attributes (out of
jpayne@69 135 * band info) should be retained. After this call, there will be
jpayne@69 136 * (at least) two copies of the characters originally located at
jpayne@69 137 * start..limit-1.
jpayne@69 138 *
jpayne@69 139 * @param rep A pointer to "this" UReplaceable object.
jpayne@69 140 * @param start the starting index of the text to be copied,
jpayne@69 141 * inclusive.
jpayne@69 142 * @param limit the ending index of the text to be copied,
jpayne@69 143 * exclusive.
jpayne@69 144 * @param dest the index at which the copy of the UChars should be
jpayne@69 145 * inserted.
jpayne@69 146 * @stable ICU 2.0
jpayne@69 147 */
jpayne@69 148 void (*copy)(UReplaceable* rep,
jpayne@69 149 int32_t start,
jpayne@69 150 int32_t limit,
jpayne@69 151 int32_t dest);
jpayne@69 152
jpayne@69 153 } UReplaceableCallbacks;
jpayne@69 154
jpayne@69 155 U_CDECL_END
jpayne@69 156
jpayne@69 157 #endif