]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | ******************************************************************************* | |
3 | * | |
4 | * Copyright (C) 2001, International Business Machines | |
5 | * Corporation and others. All Rights Reserved. | |
6 | * | |
7 | ******************************************************************************* | |
8 | * file name: ucol_tok.cpp | |
9 | * encoding: US-ASCII | |
10 | * tab size: 8 (not used) | |
11 | * indentation:4 | |
12 | * | |
13 | * created 02/22/2001 | |
14 | * created by: Vladimir Weinstein | |
15 | * | |
16 | * This module maintains a contraction table structure in expanded form | |
17 | * and provides means to flatten this structure | |
18 | * | |
19 | */ | |
20 | ||
21 | #ifndef UCOL_CNTTABLE_H | |
22 | #define UCOL_CNTTABLE_H | |
23 | ||
24 | #include "unicode/utypes.h" | |
25 | ||
26 | #if !UCONFIG_NO_COLLATION | |
27 | ||
28 | /*#include "ucmpe32.h"*/ | |
29 | #include "utrie.h" | |
30 | #include "uhash.h" | |
31 | #include "ucol_elm.h" | |
32 | #include "ucol_imp.h" | |
33 | ||
34 | U_NAMESPACE_BEGIN | |
35 | ||
36 | #define UPRV_CNTTAB_NEWELEMENT 0xFFFFFF | |
37 | ||
38 | #define isCntTableElement(CE) (isSpecial((CE)) && \ | |
39 | ((getCETag((CE)) == CONTRACTION_TAG)||(getCETag((CE)) == SPEC_PROC_TAG))) | |
40 | ||
41 | typedef struct ContractionTable ContractionTable; | |
42 | struct ContractionTable { | |
43 | UChar *codePoints; | |
44 | uint32_t *CEs; | |
45 | uint32_t position; | |
46 | uint32_t size; | |
47 | }; | |
48 | ||
49 | struct CntTable { | |
50 | ContractionTable **elements; | |
51 | /*CompactEIntArray *mapping;*/ | |
52 | UNewTrie *mapping; | |
53 | UChar *codePoints; | |
54 | uint32_t *CEs; | |
55 | int32_t *offsets; | |
56 | int32_t position; | |
57 | int32_t size; | |
58 | int32_t capacity; | |
59 | UColCETags currentTag; | |
60 | }; | |
61 | ||
62 | U_CAPI CntTable* U_EXPORT2 | |
63 | /*uprv_cnttab_open(CompactEIntArray *mapping, UErrorCode *status);*/ | |
64 | uprv_cnttab_open(UNewTrie *mapping, UErrorCode *status); | |
65 | U_CAPI CntTable* U_EXPORT2 | |
66 | uprv_cnttab_clone(CntTable *table, UErrorCode *status); | |
67 | U_CAPI void U_EXPORT2 | |
68 | uprv_cnttab_close(CntTable *table); | |
69 | ||
70 | /* construct the table for output */ | |
71 | U_CAPI int32_t U_EXPORT2 | |
72 | uprv_cnttab_constructTable(CntTable *table, uint32_t mainOffset, UErrorCode *status); | |
73 | /* adds more contractions in table. If element is non existant, it creates on. Returns element handle */ | |
74 | U_CAPI uint32_t U_EXPORT2 | |
75 | uprv_cnttab_addContraction(CntTable *table, uint32_t element, UChar codePoint, uint32_t value, UErrorCode *status); | |
76 | /* sets a part of contraction sequence in table. If element is non existant, it creates on. Returns element handle */ | |
77 | U_CAPI uint32_t U_EXPORT2 | |
78 | uprv_cnttab_setContraction(CntTable *table, uint32_t element, uint32_t offset, UChar codePoint, uint32_t value, UErrorCode *status); | |
79 | /* inserts a part of contraction sequence in table. Sequences behind the offset are moved back. If element is non existant, it creates on. Returns element handle */ | |
80 | U_CAPI uint32_t U_EXPORT2 | |
81 | uprv_cnttab_insertContraction(CntTable *table, uint32_t element, UChar codePoint, uint32_t value, UErrorCode *status); | |
82 | /* this is for adding non contractions */ | |
83 | U_CAPI uint32_t U_EXPORT2 | |
84 | uprv_cnttab_changeLastCE(CntTable *table, uint32_t element, uint32_t value, UErrorCode *status); | |
85 | ||
86 | U_CAPI int32_t U_EXPORT2 | |
87 | uprv_cnttab_findCP(CntTable *table, uint32_t element, UChar codePoint, UErrorCode *status); | |
88 | ||
89 | U_CAPI uint32_t U_EXPORT2 | |
90 | uprv_cnttab_getCE(CntTable *table, uint32_t element, uint32_t position, UErrorCode *status); | |
91 | ||
92 | U_CAPI uint32_t U_EXPORT2 | |
93 | uprv_cnttab_changeContraction(CntTable *table, uint32_t element, UChar codePoint, uint32_t newCE, UErrorCode *status); | |
94 | ||
95 | U_CAPI uint32_t U_EXPORT2 | |
96 | uprv_cnttab_findCE(CntTable *table, uint32_t element, UChar codePoint, UErrorCode *status); | |
97 | ||
98 | U_CAPI UBool U_EXPORT2 | |
99 | uprv_cnttab_isTailored(CntTable *table, uint32_t element, UChar *ztString, UErrorCode *status); | |
100 | ||
101 | U_NAMESPACE_END | |
102 | ||
103 | #endif /* #if !UCONFIG_NO_COLLATION */ | |
104 | ||
105 | #endif |