UReplaceableCallbacks

转写器用于操作 UReplaceable 的一组函数指针。

摘要

调用方应提供所需的函数来适当地操作其文本。与 C++ 类 Replaceable 相关。

公共属性

char32At)(const UReplaceable *rep, int32_t offset)
函数指针,返回此文本中给定偏移量处的 UChar32 代码点。
charAt)(const UReplaceable *rep, int32_t offset)
UChar(*
函数指针,返回此文本中给定偏移量处的 UChar 代码单元;0 <= offset < n,其中 n 是 (*length)(rep) 返回的值。
copy)(UReplaceable *rep, int32_t start, int32_t limit, int32_t dest)
void(*
函数指针,将此文本中 start 和 limit 之间的文本复制到文本中的另一个索引处。
extract)(UReplaceable *rep, int32_t start, int32_t limit, UChar *dst)
void(*
函数指针,将范围 [start, limit) 中的字符复制到数组 dst 中。
length)(const UReplaceable *rep)
int32_t(*
函数指针,返回此文本中的 UChar 代码单元数。
replace)(UReplaceable *rep, int32_t start, int32_t limit, const UChar *text, int32_t textLength)
void(*
函数指针,用给定文本替换此文本中 start 和 limit 之间的文本。

公共属性

char32At

unicode/urep.h 中声明
UChar32(* UReplaceableCallbacks::char32At)(const UReplaceable *rep, int32_t offset)

函数指针,返回此文本中给定偏移量处的 UChar32 代码点。

请参阅 unistr.h,了解 charAt()char32At() 的说明。

详细信息
参数
rep
指向此 UReplaceable 对象的指针。
offset
要获取 UChar32(代码点)的索引。
返回
偏移量处的 UChar32(代码点),如果偏移量超出范围,则为 U+FFFF。

charAt

unicode/urep.h 中声明
UChar(* UReplaceableCallbacks::charAt)(const UReplaceable *rep, int32_t offset)

函数指针,返回此文本中给定偏移量处的 UChar 代码单元;0 <= offset < n,其中 n 是 (*length)(rep) 返回的值。

请参阅 unistr.h,了解 charAt()char32At() 的说明。

详细信息
参数
rep
指向此 UReplaceable 对象的指针。
offset
要获取 UChar(代码单元)的索引。
返回
偏移量处的 UChar(代码单元),如果偏移量超出范围,则为 U+FFFF。

copy

unicode/urep.h 中声明
void(* UReplaceableCallbacks::copy)(UReplaceable *rep, int32_t start, int32_t limit, int32_t dest)

函数指针,将此文本中 start 和 limit 之间的文本复制到文本中的另一个索引处。

应保留属性(带外信息)。此调用后,在 start..limit-1 处原始字符的副本将至少有两个。

详细信息
参数
rep
指向此 UReplaceable 对象的指针。
start
要复制文本的起始索引(包含)。
limit
要复制文本的结束索引(不包含)。
dest
应插入 UChars 副本的索引。

extract

unicode/urep.h 中声明
void(* UReplaceableCallbacks::extract)(UReplaceable *rep, int32_t start, int32_t limit, UChar *dst)

函数指针,将范围 [start, limit) 中的字符复制到数组 dst 中。

详细信息
参数
rep
指向此 UReplaceable 对象的指针。
start
将复制到数组中的第一个字符的偏移量
limit
紧跟在要复制的最后一个字符后面的偏移量
dst
将字符复制到的数组。dst 的长度必须至少为 (limit - start)

length

unicode/urep.h 中声明
int32_t(* UReplaceableCallbacks::length)(const UReplaceable *rep)

函数指针,返回此文本中的 UChar 代码单元数。

详细信息
参数
rep
指向此 UReplaceable 对象的指针。
返回
文本的长度。

replace

unicode/urep.h 中声明
void(* UReplaceableCallbacks::replace)(UReplaceable *rep, int32_t start, int32_t limit, const UChar *text, int32_t textLength)

函数指针,用给定文本替换此文本中 start 和 limit 之间的文本。

应保留属性(带外信息)。

详细信息
参数
rep
指向此 UReplaceable 对象的指针。
start
要替换文本的起始索引(包含)。
limit
要替换文本的结束索引(不包含)。
text
用于替换 start..limit-1 处 UChars 的新文本。
textLength
text 处的 UChars 数,如果文本是以 null 结尾的,则为 -1。