00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef UCMP8_H
00012 #define UCMP8_H
00013
00014
00015
00016
00017 #define ICU_UCMP8_VERSION 0x01260000
00018
00019 #include "umemstrm.h"
00020 #include "unicode/utypes.h"
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 U_CAPI int32_t U_EXPORT2 ucmp8_getkUnicodeCount(void);
00031 U_CAPI int32_t U_EXPORT2 ucmp8_getkBlockCount(void);
00032
00033 typedef struct CompactByteArray {
00034 uint32_t fStructSize;
00035 int8_t* fArray;
00036 uint16_t* fIndex;
00037 int32_t fCount;
00038 UBool fCompact;
00039 UBool fBogus;
00040 UBool fAlias;
00041 UBool fIAmOwned;
00042 } CompactByteArray;
00043
00044 #define UCMP8_kUnicodeCount 65536
00045 #define UCMP8_kBlockShift 7
00046 #define UCMP8_kBlockCount (1<<UCMP8_kBlockShift)
00047 #define UCMP8_kIndexShift (16-UCMP8_kBlockShift)
00048 #define UCMP8_kIndexCount (1<<UCMP8_kIndexShift)
00049 #define UCMP8_kBlockMask (UCMP8_kBlockCount-1)
00050
00051
00052 U_CAPI CompactByteArray* U_EXPORT2 ucmp8_open(int8_t defaultValue);
00053
00054 U_CAPI void U_EXPORT2 ucmp8_init(CompactByteArray* array, int8_t defaultValue);
00055 U_CAPI void U_EXPORT2 ucmp8_initBogus(CompactByteArray* array);
00056
00068 U_CAPI CompactByteArray* U_EXPORT2 ucmp8_openAdopt(uint16_t* indexArray,
00069 int8_t* newValues,
00070 int32_t count);
00071 U_CAPI CompactByteArray* U_EXPORT2 ucmp8_openAlias(uint16_t* indexArray,
00072 int8_t* newValues,
00073 int32_t count);
00074
00086 U_CAPI CompactByteArray* U_EXPORT2 ucmp8_initAdopt(CompactByteArray *this_obj,
00087 uint16_t* indexArray,
00088 int8_t* newValues,
00089 int32_t count);
00090 U_CAPI CompactByteArray* U_EXPORT2 ucmp8_initAlias(CompactByteArray *this_obj,
00091 uint16_t* indexArray,
00092 int8_t* newValues,
00093 int32_t count);
00094
00095 U_CAPI void U_EXPORT2 ucmp8_close(CompactByteArray* array);
00096 U_CAPI UBool U_EXPORT2 ucmp8_isBogus(const CompactByteArray* array);
00097
00098 #define ucmp8_get(array, index) (array->fArray[(array->fIndex[index >> UCMP8_kBlockShift] & 0xFFFF) + (index & UCMP8_kBlockMask)])
00099
00100 #define ucmp8_getu(array,index) (uint8_t)ucmp8_get(array,index)
00101
00102
00103 U_CAPI void U_EXPORT2 ucmp8_set(CompactByteArray* array,
00104 UChar character,
00105 int8_t value);
00106
00107 U_CAPI void U_EXPORT2 ucmp8_setRange(CompactByteArray* array,
00108 UChar start,
00109 UChar end,
00110 int8_t value);
00111
00112 U_CAPI int32_t U_EXPORT2 ucmp8_getCount(const CompactByteArray* array);
00113 U_CAPI const int8_t* U_EXPORT2 ucmp8_getArray(const CompactByteArray* array);
00114 U_CAPI const uint16_t* U_EXPORT2 ucmp8_getIndex(const CompactByteArray* array);
00115
00116
00117
00118
00119
00120
00121
00122
00123 U_CAPI void U_EXPORT2 ucmp8_compact(CompactByteArray* array,
00124 uint32_t cycle);
00125
00126
00127 U_CAPI void U_EXPORT2 ucmp8_expand(CompactByteArray* array);
00128
00130 U_CAPI uint32_t U_EXPORT2 ucmp8_flattenMem (const CompactByteArray* array, UMemoryStream *MS);
00131
00132 U_CAPI void U_EXPORT2 ucmp8_initFromData(CompactByteArray* array, const uint8_t **source, UErrorCode *status);
00133
00134 #endif
00135
00136
00137