Logo Search packages:      
Sourcecode: icu version File versions

utrie2.h File Reference


Detailed Description

This is a common implementation of a Unicode trie. It is a kind of compressed, serializable table of 16- or 32-bit values associated with Unicode code points (0..0x10ffff). (A map from code points to integers.)

This is the second common version of a Unicode trie (hence the name UTrie2). Compared with UTrie version 1:

Definition in file utrie2.h.

#include "unicode/utypes.h"
#include "udataswp.h"

Go to the source code of this file.

Classes

struct  UTrie2

Defines

#define _UTRIE2_GET(trie, data, asciiOffset, c)   (trie)->data[_UTRIE2_INDEX_FROM_CP(trie, asciiOffset, c)]
#define _UTRIE2_GET_FROM_SUPP(trie, data, c)
#define _UTRIE2_GET_FROM_U16_SINGLE_LEAD(trie, data, c)   (trie)->data[_UTRIE2_INDEX_FROM_U16_SINGLE_LEAD((trie)->index, c)]
#define _UTRIE2_INDEX_FROM_BMP(trieIndex, c)
#define _UTRIE2_INDEX_FROM_CP(trie, asciiOffset, c)
#define _UTRIE2_INDEX_FROM_LSCP(trieIndex, c)   _UTRIE2_INDEX_RAW(UTRIE2_LSCP_INDEX_2_OFFSET-(0xd800>>UTRIE2_SHIFT_2), trieIndex, c)
#define _UTRIE2_INDEX_FROM_SUPP(trieIndex, c)
#define _UTRIE2_INDEX_FROM_U16_SINGLE_LEAD(trieIndex, c)   _UTRIE2_INDEX_RAW(0, trieIndex, c)
#define _UTRIE2_INDEX_RAW(offset, trieIndex, c)
#define _UTRIE2_U16_NEXT(trie, data, src, limit, c, result)
#define _UTRIE2_U16_PREV(trie, data, start, src, c, result)
#define _UTRIE2_U8_NEXT(trie, ascii, data, src, limit, result)
#define _UTRIE2_U8_PREV(trie, ascii, data, start, src, result)
#define UTRIE2_GET16(trie, c)   _UTRIE2_GET((trie), index, (trie)->indexLength, (c))
#define UTRIE2_GET16_FROM_SUPP(trie, c)   _UTRIE2_GET_FROM_SUPP((trie), index, c)
#define UTRIE2_GET16_FROM_U16_SINGLE_LEAD(trie, c)   _UTRIE2_GET_FROM_U16_SINGLE_LEAD((trie), index, c)
#define UTRIE2_GET32(trie, c)   _UTRIE2_GET((trie), data32, 0, (c))
#define UTRIE2_GET32_FROM_SUPP(trie, c)   _UTRIE2_GET_FROM_SUPP((trie), data32, c)
#define UTRIE2_GET32_FROM_U16_SINGLE_LEAD(trie, c)   _UTRIE2_GET_FROM_U16_SINGLE_LEAD((trie), data32, c)
#define UTRIE2_U16_NEXT16(trie, src, limit, c, result)   _UTRIE2_U16_NEXT(trie, index, src, limit, c, result)
#define UTRIE2_U16_NEXT32(trie, src, limit, c, result)   _UTRIE2_U16_NEXT(trie, data32, src, limit, c, result)
#define UTRIE2_U16_PREV16(trie, start, src, c, result)   _UTRIE2_U16_PREV(trie, index, start, src, c, result)
#define UTRIE2_U16_PREV32(trie, start, src, c, result)   _UTRIE2_U16_PREV(trie, data32, start, src, c, result)
#define UTRIE2_U8_NEXT16(trie, src, limit, result)   _UTRIE2_U8_NEXT(trie, data16, index, src, limit, result)
#define UTRIE2_U8_NEXT32(trie, src, limit, result)   _UTRIE2_U8_NEXT(trie, data32, data32, src, limit, result)
#define UTRIE2_U8_PREV16(trie, start, src, result)   _UTRIE2_U8_PREV(trie, data16, index, start, src, result)
#define UTRIE2_U8_PREV32(trie, start, src, result)   _UTRIE2_U8_PREV(trie, data32, data32, start, src, result)

Typedefs

typedef struct UNewTrie2 UNewTrie2
typedef struct UTrie UTrie
typedef struct UTrie2 UTrie2
typedef UBool U_CALLCONV UTrie2EnumRange (const void *context, UChar32 start, UChar32 end, uint32_t value)
typedef uint32_t U_CALLCONV UTrie2EnumValue (const void *context, uint32_t value)
typedef enum UTrie2ValueBits UTrie2ValueBits

Enumerations

enum  {
  UTRIE2_SHIFT_1 = 6+5, UTRIE2_SHIFT_2 = 5, UTRIE2_SHIFT_1_2 = UTRIE2_SHIFT_1-UTRIE2_SHIFT_2, UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = 0x10000>>UTRIE2_SHIFT_1,
  UTRIE2_CP_PER_INDEX_1_ENTRY = 1<<UTRIE2_SHIFT_1, UTRIE2_INDEX_2_BLOCK_LENGTH = 1<<UTRIE2_SHIFT_1_2, UTRIE2_INDEX_2_MASK = UTRIE2_INDEX_2_BLOCK_LENGTH-1, UTRIE2_DATA_BLOCK_LENGTH = 1<<UTRIE2_SHIFT_2,
  UTRIE2_DATA_MASK = UTRIE2_DATA_BLOCK_LENGTH-1, UTRIE2_INDEX_SHIFT = 2, UTRIE2_DATA_GRANULARITY = 1<<UTRIE2_INDEX_SHIFT, UTRIE2_INDEX_2_OFFSET = 0,
  UTRIE2_LSCP_INDEX_2_OFFSET = 0x10000>>UTRIE2_SHIFT_2, UTRIE2_LSCP_INDEX_2_LENGTH = 0x400>>UTRIE2_SHIFT_2, UTRIE2_INDEX_2_BMP_LENGTH = UTRIE2_LSCP_INDEX_2_OFFSET+UTRIE2_LSCP_INDEX_2_LENGTH, UTRIE2_UTF8_2B_INDEX_2_OFFSET = UTRIE2_INDEX_2_BMP_LENGTH,
  UTRIE2_UTF8_2B_INDEX_2_LENGTH = 0x800>>6, UTRIE2_INDEX_1_OFFSET = UTRIE2_UTF8_2B_INDEX_2_OFFSET+UTRIE2_UTF8_2B_INDEX_2_LENGTH, UTRIE2_MAX_INDEX_1_LENGTH = 0x100000>>UTRIE2_SHIFT_1, UTRIE2_BAD_UTF8_DATA_OFFSET = 0x80,
  UTRIE2_DATA_START_OFFSET = 0xc0
}
enum  UTrie2ValueBits { UTRIE2_16_VALUE_BITS, UTRIE2_32_VALUE_BITS, UTRIE2_COUNT_VALUE_BITS }

Functions

U_CAPI UTrie2 *U_EXPORT2 utrie2_clone (const UTrie2 *other, UErrorCode *pErrorCode)
U_CAPI UTrie2 *U_EXPORT2 utrie2_cloneAsThawed (const UTrie2 *other, UErrorCode *pErrorCode)
U_CAPI void U_EXPORT2 utrie2_close (UTrie2 *trie)
U_CAPI void U_EXPORT2 utrie2_enum (const UTrie2 *trie, UTrie2EnumValue *enumValue, UTrie2EnumRange *enumRange, const void *context)
U_CAPI void U_EXPORT2 utrie2_enumForLeadSurrogate (const UTrie2 *trie, UChar32 lead, UTrie2EnumValue *enumValue, UTrie2EnumRange *enumRange, const void *context)
U_CAPI void U_EXPORT2 utrie2_freeze (UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode)
U_CAPI UTrie2 *U_EXPORT2 utrie2_fromUTrie (const UTrie *trie1, uint32_t errorValue, UErrorCode *pErrorCode)
U_CAPI uint32_t U_EXPORT2 utrie2_get32 (const UTrie2 *trie, UChar32 c)
U_CAPI uint32_t U_EXPORT2 utrie2_get32FromLeadSurrogateCodeUnit (const UTrie2 *trie, UChar32 c)
U_CAPI int32_t U_EXPORT2 utrie2_getVersion (const void *data, int32_t length, UBool anyEndianOk)
U_INTERNAL int32_t U_EXPORT2 utrie2_internalU8NextIndex (const UTrie2 *trie, UChar32 c, const uint8_t *src, const uint8_t *limit)
U_INTERNAL int32_t U_EXPORT2 utrie2_internalU8PrevIndex (const UTrie2 *trie, UChar32 c, const uint8_t *start, const uint8_t *src)
U_CAPI UBool U_EXPORT2 utrie2_isFrozen (const UTrie2 *trie)
U_CAPI UTrie2 *U_EXPORT2 utrie2_open (uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode)
U_CAPI UTrie2 *U_EXPORT2 utrie2_openDummy (UTrie2ValueBits valueBits, uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode)
U_CAPI UTrie2 *U_EXPORT2 utrie2_openFromSerialized (UTrie2ValueBits valueBits, const void *data, int32_t length, int32_t *pActualLength, UErrorCode *pErrorCode)
U_CAPI int32_t U_EXPORT2 utrie2_serialize (UTrie2 *trie, void *data, int32_t capacity, UErrorCode *pErrorCode)
U_CAPI void U_EXPORT2 utrie2_set32 (UTrie2 *trie, UChar32 c, uint32_t value, UErrorCode *pErrorCode)
U_CAPI void U_EXPORT2 utrie2_set32ForLeadSurrogateCodeUnit (UTrie2 *trie, UChar32 lead, uint32_t value, UErrorCode *pErrorCode)
U_CAPI void U_EXPORT2 utrie2_setRange32 (UTrie2 *trie, UChar32 start, UChar32 end, uint32_t value, UBool overwrite, UErrorCode *pErrorCode)
U_CAPI int32_t U_EXPORT2 utrie2_swap (const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode)


Generated by  Doxygen 1.6.0   Back to index