Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ucmp32.h

Go to the documentation of this file.
00001 /*
00002  **********************************************************************
00003  *   Copyright (C) 1995-1999, International Business Machines
00004  *   Corporation and others.  All Rights Reserved.
00005  **********************************************************************
00006  * and others. All Rights Reserved.
00007  * @version 1.0 23/10/96
00008  * @author  Helena Shih
00009  * Based on Taligent international support for java
00010  * Modification History : 
00011  *
00012  *  Date        Name        Description
00013  *  2/5/97      aliu        Added CompactIntArray streamIn and streamOut methods.
00014  * 05/07/97     helena      Added isBogus()
00015  * 04/26/99     Madhu       Ported to C for C Implementation
00016  * 11/21/99     srl         macroized ucmp32_get()
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 /* INTERNAL CONSTANTS */
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 /*CompactIntArray
00085  * Provides a compact way to store information that is indexed by Unicode values,
00086  * such as character properties, types, keyboard values, etc.
00087  * The ATypes are used by value, so should be small, integers or pointers.
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; /* don't free CBA on close */
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 

Generated at Tue Dec 5 17:55:34 2000 for ICU by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000