Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UTrie2 ¶
type UTrie2 struct { InitialValue uint32 ErrorValue uint32 HighStart rune HighValueIndex int // contains filtered or unexported fields }
func (*UTrie2) SerializedLength ¶
type UcpMapRangeOption ¶
type UcpMapRangeOption int8
*
- Selectors for how ucpmap_getRange() etc. should report value ranges overlapping with surrogates.
- Most users should use UCPMAP_RANGE_NORMAL. *
- @see ucpmap_getRange
- @see ucptrie_getRange
- @see umutablecptrie_getRange
- @stable ICU 63
const ( /** * ucpmap_getRange() enumerates all same-value ranges as stored in the map. * Most users should use this option. * @stable ICU 63 */ UcpMapRangeNormal UcpMapRangeOption = iota /** * ucpmap_getRange() enumerates all same-value ranges as stored in the map, * except that lead surrogates (U+D800..U+DBFF) are treated as having the * surrogateValue, which is passed to getRange() as a separate parameter. * The surrogateValue is not transformed via filter(). * See U_IS_LEAD(c). * * Most users should use UCPMAP_RANGE_NORMAL instead. * * This option is useful for maps that map surrogate code *units* to * special values optimized for UTF-16 string processing * or for special error behavior for unpaired surrogates, * but those values are not to be associated with the lead surrogate code *points*. * @stable ICU 63 */ UcpMapRangeFixedLeadSurrogates /** * ucpmap_getRange() enumerates all same-value ranges as stored in the map, * except that all surrogates (U+D800..U+DFFF) are treated as having the * surrogateValue, which is passed to getRange() as a separate parameter. * The surrogateValue is not transformed via filter(). * See U_IS_SURROGATE(c). * * Most users should use UCPMAP_RANGE_NORMAL instead. * * This option is useful for maps that map surrogate code *units* to * special values optimized for UTF-16 string processing * or for special error behavior for unpaired surrogates, * but those values are not to be associated with the lead surrogate code *points*. * @stable ICU 63 */ UcpMapRangeFixedAllSurrogates )
type UcpMapValueFilter ¶
*
- Callback function type: Modifies a map value.
- Optionally called by ucpmap_getRange()/ucptrie_getRange()/umutablecptrie_getRange().
- The modified value will be returned by the getRange function. *
- Can be used to ignore some of the value bits,
- make a filter for one of several values,
- return a value index computed from the map value, etc. *
- @param context an opaque pointer, as passed into the getRange function
- @param value a value from the map
- @return the modified value
- @stable ICU 63
type UcpTrie ¶
type UcpTrie struct {
// contains filtered or unexported fields
}
func (*UcpTrie) GetRange ¶
func (t *UcpTrie) GetRange(start rune, option UcpMapRangeOption, surrogateValue uint32, filter UcpMapValueFilter) (rune, uint32)
*
- GetRange returns the last code point such that all those from start to there have the same value.
- Can be used to efficiently iterate over all same-value ranges in a trie.
- (This is normally faster than iterating over code points and get()ting each value,
- but much slower than a data structure that stores ranges directly.) *
- If the UCPMapValueFilter function pointer is not NULL, then
- the value to be delivered is passed through that function, and the return value is the end
- of the range where all values are modified to the same actual value.
- The value is unchanged if that function pointer is NULL. *
- Example:
- \code
- UChar32 start = 0, end;
- uint32_t value;
- while ((end = ucptrie_getRange(trie, start, UCPMAP_RANGE_NORMAL, 0,
- NULL, NULL, &value)) >= 0) {
- // Work with the range start..end and its value.
- start = end + 1;
- }
- \endcode *
- @param trie the trie
- @param start range start
- @param option defines whether surrogates are treated normally,
- or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL
- @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL
- @param filter a pointer to a function that may modify the trie data value,
- or NULL if the values from the trie are to be used unmodified
- @param context an opaque pointer that is passed on to the filter function
- @param pValue if not NULL, receives the value that every code point start..end has;
- may have been modified by filter(context, trie value)
- if that function pointer is not NULL
- @return the range end code point, or -1 if start is not a valid code point
- @stable ICU 63
Click to show internal directories.
Click to hide internal directories.