00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef UCMP32_H
00020 #define UCMP32_H
00021
00022 #define ICU_UCMP32_VERSION 0x01260000
00023
00024 #include "unicode/utypes.h"
00025
00026 #include "filestrm.h"
00027 #include "umemstrm.h"
00028
00029
00030 #define UCMP32_kBlockShift 7
00031 #define UCMP32_kBlockCount (1<<UCMP32_kBlockShift)
00032 #define UCMP32_kIndexShift (16-UCMP32_kBlockShift)
00033 #define UCMP32_kIndexCount (1<<UCMP32_kIndexShift)
00034 #define UCMP32_kBlockMask (UCMP32_kBlockCount-1)
00035 #define UCMP32_kUnicodeCount 65536
00036
00083
00084
00085
00086
00087
00088
00089
00090 typedef struct CompactIntArray{
00091 uint32_t fStructSize;
00092 int32_t* fArray;
00093 uint16_t* fIndex;
00094 int32_t fCount;
00095 UBool fCompact;
00096 UBool fBogus;
00097 UBool fAlias;
00098 UBool fIAmOwned;
00099 } CompactIntArray;
00100
00101 U_CAPI int32_t U_EXPORT2 ucmp32_getkUnicodeCount(void);
00102 U_CAPI int32_t U_EXPORT2 ucmp32_getkBlockCount(void);
00103
00104
00110 U_CAPI CompactIntArray* U_EXPORT2 ucmp32_open(int32_t defaultValue);
00111
00123 U_CAPI CompactIntArray* U_EXPORT2 ucmp32_openAdopt(uint16_t *indexArray,
00124 int32_t *newValues,
00125 int32_t count);
00126
00127 U_CAPI CompactIntArray* U_EXPORT2 ucmp32_openAlias(uint16_t *indexArray,
00128 int32_t *newValues,
00129 int32_t count);
00141 U_CAPI CompactIntArray* U_EXPORT2 ucmp32_initAdopt(CompactIntArray *this_obj,
00142 uint16_t *indexArray,
00143 int32_t *newValues,
00144 int32_t count);
00145
00146 U_CAPI CompactIntArray* U_EXPORT2 ucmp32_initAlias(CompactIntArray *this_obj,
00147 uint16_t *indexArray,
00148 int32_t *newValues,
00149 int32_t count);
00150
00151 U_CAPI void U_EXPORT2 ucmp32_close(CompactIntArray* array);
00152
00157 U_CAPI UBool U_EXPORT2 ucmp32_isBogus(const CompactIntArray* array);
00165 #define ucmp32_get(array, index) (array->fArray[(array->fIndex[(index >> UCMP32_kBlockShift)] )+ \
00166 (index & UCMP32_kBlockMask)])
00167
00168 #define ucmp32_getu(array, index) (uint16_t)ucmp32_get(array, index)
00169
00176 U_CAPI void U_EXPORT2 ucmp32_set(CompactIntArray *array,
00177 UChar character,
00178 int32_t value);
00179
00187 U_CAPI void U_EXPORT2 ucmp32_setRange(CompactIntArray* array,
00188 UChar start,
00189 UChar end,
00190 int32_t value);
00191
00199 U_CAPI void U_EXPORT2 ucmp32_compact(CompactIntArray* array, int32_t cycle);
00205 U_CAPI void U_EXPORT2 ucmp32_expand(CompactIntArray* array);
00211 U_CAPI uint32_t U_EXPORT2 ucmp32_getCount(const CompactIntArray* array);
00212
00218 U_CAPI const int32_t* U_EXPORT2 ucmp32_getArray(const CompactIntArray* array);
00219
00225 U_CAPI const uint16_t* U_EXPORT2 ucmp32_getIndex(const CompactIntArray* array);
00226
00227 U_CAPI void U_EXPORT2 ucmp32_streamIn( CompactIntArray* array, FileStream* is);
00228 U_CAPI void U_EXPORT2 ucmp32_streamOut(CompactIntArray* array, FileStream* os);
00229
00230 U_CAPI void U_EXPORT2 ucmp32_streamMemIn( CompactIntArray* array, UMemoryStream* is);
00231 U_CAPI void U_EXPORT2 ucmp32_streamMemOut(CompactIntArray* array, UMemoryStream* os);
00232
00233 U_CAPI uint32_t U_EXPORT2 ucmp32_flattenMem(const CompactIntArray* array, UMemoryStream *MS);
00234 U_CAPI void U_EXPORT2 ucmp32_initFromData(CompactIntArray *this_obj, const uint8_t **source, UErrorCode *status);
00235
00236 #endif
00237
00238
00239
00240
00241
00242