1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/i18n/ucol_cnt.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,102 @@ 1.4 +/* 1.5 +******************************************************************************* 1.6 +* 1.7 +* Copyright (C) 2001-2008, International Business Machines 1.8 +* Corporation and others. All Rights Reserved. 1.9 +* 1.10 +******************************************************************************* 1.11 +* file name: ucol_tok.cpp 1.12 +* encoding: US-ASCII 1.13 +* tab size: 8 (not used) 1.14 +* indentation:4 1.15 +* 1.16 +* created 02/22/2001 1.17 +* created by: Vladimir Weinstein 1.18 +* 1.19 +* This module maintains a contraction table structure in expanded form 1.20 +* and provides means to flatten this structure 1.21 +* 1.22 +*/ 1.23 + 1.24 +#ifndef UCOL_CNTTABLE_H 1.25 +#define UCOL_CNTTABLE_H 1.26 + 1.27 +#include "unicode/utypes.h" 1.28 + 1.29 +#if !UCONFIG_NO_COLLATION 1.30 + 1.31 +#include "utrie.h" 1.32 +#include "ucol_imp.h" 1.33 + 1.34 +U_CDECL_BEGIN 1.35 + 1.36 +#define UPRV_CNTTAB_NEWELEMENT 0xFFFFFF 1.37 + 1.38 +#define isCntTableElement(CE) (isSpecial((CE)) && \ 1.39 +((getCETag((CE)) == CONTRACTION_TAG)||(getCETag((CE)) == SPEC_PROC_TAG))) 1.40 + 1.41 +typedef struct ContractionTable ContractionTable; 1.42 +struct ContractionTable { 1.43 + UChar *codePoints; 1.44 + uint32_t *CEs; 1.45 + uint32_t position; 1.46 + uint32_t size; 1.47 +}; 1.48 + 1.49 +struct CntTable { 1.50 + ContractionTable **elements; 1.51 + /*CompactEIntArray *mapping;*/ 1.52 + UNewTrie *mapping; 1.53 + UChar *codePoints; 1.54 + uint32_t *CEs; 1.55 + int32_t *offsets; 1.56 + int32_t position; 1.57 + int32_t size; 1.58 + int32_t capacity; 1.59 + UColCETags currentTag; 1.60 +}; 1.61 + 1.62 +U_CAPI CntTable* U_EXPORT2 1.63 +/*uprv_cnttab_open(CompactEIntArray *mapping, UErrorCode *status);*/ 1.64 +uprv_cnttab_open(UNewTrie *mapping, UErrorCode *status); 1.65 +U_CAPI CntTable* U_EXPORT2 1.66 +uprv_cnttab_clone(CntTable *table, UErrorCode *status); 1.67 +U_CAPI void U_EXPORT2 1.68 +uprv_cnttab_close(CntTable *table); 1.69 + 1.70 +/* construct the table for output */ 1.71 +U_CAPI int32_t U_EXPORT2 1.72 +uprv_cnttab_constructTable(CntTable *table, uint32_t mainOffset, UErrorCode *status); 1.73 +/* adds more contractions in table. If element is non existant, it creates on. Returns element handle */ 1.74 +U_CAPI uint32_t U_EXPORT2 1.75 +uprv_cnttab_addContraction(CntTable *table, uint32_t element, UChar codePoint, uint32_t value, UErrorCode *status); 1.76 +/* sets a part of contraction sequence in table. If element is non existant, it creates on. Returns element handle */ 1.77 +U_CAPI uint32_t U_EXPORT2 1.78 +uprv_cnttab_setContraction(CntTable *table, uint32_t element, uint32_t offset, UChar codePoint, uint32_t value, UErrorCode *status); 1.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 */ 1.80 +U_CAPI uint32_t U_EXPORT2 1.81 +uprv_cnttab_insertContraction(CntTable *table, uint32_t element, UChar codePoint, uint32_t value, UErrorCode *status); 1.82 +/* this is for adding non contractions */ 1.83 +U_CAPI uint32_t U_EXPORT2 1.84 +uprv_cnttab_changeLastCE(CntTable *table, uint32_t element, uint32_t value, UErrorCode *status); 1.85 + 1.86 +U_CAPI int32_t U_EXPORT2 1.87 +uprv_cnttab_findCP(CntTable *table, uint32_t element, UChar codePoint, UErrorCode *status); 1.88 + 1.89 +U_CAPI uint32_t U_EXPORT2 1.90 +uprv_cnttab_getCE(CntTable *table, uint32_t element, uint32_t position, UErrorCode *status); 1.91 + 1.92 +U_CAPI uint32_t U_EXPORT2 1.93 +uprv_cnttab_changeContraction(CntTable *table, uint32_t element, UChar codePoint, uint32_t newCE, UErrorCode *status); 1.94 + 1.95 +U_CAPI uint32_t U_EXPORT2 1.96 +uprv_cnttab_findCE(CntTable *table, uint32_t element, UChar codePoint, UErrorCode *status); 1.97 + 1.98 +U_CAPI UBool U_EXPORT2 1.99 +uprv_cnttab_isTailored(CntTable *table, uint32_t element, UChar *ztString, UErrorCode *status); 1.100 + 1.101 +U_CDECL_END 1.102 + 1.103 +#endif /* #if !UCONFIG_NO_COLLATION */ 1.104 + 1.105 +#endif