]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | ******************************************************************************* | |
3 | * | |
4 | * Copyright (C) 2002-2004, International Business Machines | |
5 | * Corporation and others. All Rights Reserved. | |
6 | * | |
7 | ******************************************************************************* | |
8 | * file name: propsvec.h | |
9 | * encoding: US-ASCII | |
10 | * tab size: 8 (not used) | |
11 | * indentation:4 | |
12 | * | |
13 | * created on: 2002feb22 | |
14 | * created by: Markus W. Scherer | |
15 | * | |
16 | * Store additional Unicode character properties in bit set vectors. | |
17 | */ | |
18 | ||
19 | #ifndef __UPROPSVEC_H__ | |
20 | #define __UPROPSVEC_H__ | |
21 | ||
22 | #include "unicode/utypes.h" | |
23 | #include "utrie.h" | |
24 | ||
25 | /* | |
26 | * Unicode Properties Vectors associated with code point ranges. | |
27 | * Stored in an array of uint32_t. | |
28 | * | |
29 | * The array starts with a header, then rows of integers store | |
30 | * the range limits and the properties vectors. | |
31 | * | |
32 | * In each row, row[0] contains the start code point and | |
33 | * row[1] contains the limit code point, | |
34 | * which is the start of the next range. | |
35 | * | |
36 | * Initially, there is only one range [0..0x110000[ with values 0. | |
37 | * | |
38 | * It would be possible to store only one range boundary per row, | |
39 | * but self-contained rows allow to later sort them by contents. | |
40 | */ | |
41 | enum { | |
42 | /* stores number of columns, plus two for start & limit values */ | |
43 | UPVEC_COLUMNS, | |
44 | UPVEC_MAXROWS, | |
45 | UPVEC_ROWS, | |
46 | /* search optimization: remember last row seen */ | |
47 | UPVEC_PREV_ROW, | |
48 | UPVEC_HEADER_LENGTH | |
49 | }; | |
50 | ||
51 | U_CAPI uint32_t * U_EXPORT2 | |
52 | upvec_open(int32_t columns, int32_t maxRows); | |
53 | ||
54 | U_CAPI void U_EXPORT2 | |
55 | upvec_close(uint32_t *pv); | |
56 | ||
57 | U_CAPI UBool U_EXPORT2 | |
58 | upvec_setValue(uint32_t *pv, | |
59 | UChar32 start, UChar32 limit, | |
60 | int32_t column, | |
61 | uint32_t value, uint32_t mask, | |
62 | UErrorCode *pErrorCode); | |
63 | ||
64 | U_CAPI uint32_t U_EXPORT2 | |
65 | upvec_getValue(uint32_t *pv, UChar32 c, int32_t column); | |
66 | ||
67 | /* | |
68 | * pRangeStart and pRangeLimit can be NULL. | |
69 | * @return NULL if rowIndex out of range and for illegal arguments | |
70 | */ | |
71 | U_CAPI uint32_t * U_EXPORT2 | |
72 | upvec_getRow(uint32_t *pv, int32_t rowIndex, | |
73 | UChar32 *pRangeStart, UChar32 *pRangeLimit); | |
74 | ||
75 | U_CAPI int32_t U_EXPORT2 | |
76 | upvec_toTrie(uint32_t *pv, UNewTrie *trie, UErrorCode *pErrorCode); | |
77 | ||
78 | #endif |