1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/common/sprpimpl.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,129 @@ 1.4 +/* 1.5 + ******************************************************************************* 1.6 + * 1.7 + * Copyright (C) 2003-2006, International Business Machines 1.8 + * Corporation and others. All Rights Reserved. 1.9 + * 1.10 + ******************************************************************************* 1.11 + * file name: sprpimpl.h 1.12 + * encoding: US-ASCII 1.13 + * tab size: 8 (not used) 1.14 + * indentation:4 1.15 + * 1.16 + * created on: 2003feb1 1.17 + * created by: Ram Viswanadha 1.18 + */ 1.19 + 1.20 +#ifndef SPRPIMPL_H 1.21 +#define SPRPIMPL_H 1.22 + 1.23 +#include "unicode/utypes.h" 1.24 + 1.25 +#if !UCONFIG_NO_IDNA 1.26 + 1.27 +#include "unicode/ustring.h" 1.28 +#include "unicode/parseerr.h" 1.29 +#include "unicode/usprep.h" 1.30 +#include "unicode/udata.h" 1.31 +#include "utrie.h" 1.32 +#include "udataswp.h" 1.33 +#include "ubidi_props.h" 1.34 + 1.35 +#define _SPREP_DATA_TYPE "spp" 1.36 + 1.37 +enum UStringPrepType{ 1.38 + USPREP_UNASSIGNED = 0x0000 , 1.39 + USPREP_MAP = 0x0001 , 1.40 + USPREP_PROHIBITED = 0x0002 , 1.41 + USPREP_DELETE = 0x0003 , 1.42 + USPREP_TYPE_LIMIT = 0x0004 1.43 +}; 1.44 + 1.45 +typedef enum UStringPrepType UStringPrepType; 1.46 + 1.47 +#ifdef USPREP_TYPE_NAMES_ARRAY 1.48 +static const char* usprepTypeNames[] ={ 1.49 + "UNASSIGNED" , 1.50 + "MAP" , 1.51 + "PROHIBITED" , 1.52 + "DELETE", 1.53 + "TYPE_LIMIT" 1.54 +}; 1.55 +#endif 1.56 + 1.57 +enum{ 1.58 + _SPREP_NORMALIZATION_ON = 0x0001, 1.59 + _SPREP_CHECK_BIDI_ON = 0x0002 1.60 +}; 1.61 + 1.62 +enum{ 1.63 + _SPREP_TYPE_THRESHOLD = 0xFFF0, 1.64 + _SPREP_MAX_INDEX_VALUE = 0x3FBF, /*16139*/ 1.65 + _SPREP_MAX_INDEX_TOP_LENGTH = 0x0003 1.66 +}; 1.67 + 1.68 +/* indexes[] value names */ 1.69 +enum { 1.70 + _SPREP_INDEX_TRIE_SIZE = 0, /* number of bytes in StringPrep trie */ 1.71 + _SPREP_INDEX_MAPPING_DATA_SIZE = 1, /* The array that contains the mapping */ 1.72 + _SPREP_NORM_CORRECTNS_LAST_UNI_VERSION = 2, /* The index of Unicode version of last entry in NormalizationCorrections.txt */ 1.73 + _SPREP_ONE_UCHAR_MAPPING_INDEX_START = 3, /* The starting index of 1 UChar mapping index in the mapping data array */ 1.74 + _SPREP_TWO_UCHARS_MAPPING_INDEX_START = 4, /* The starting index of 2 UChars mapping index in the mapping data array */ 1.75 + _SPREP_THREE_UCHARS_MAPPING_INDEX_START = 5, /* The starting index of 3 UChars mapping index in the mapping data array */ 1.76 + _SPREP_FOUR_UCHARS_MAPPING_INDEX_START = 6, /* The starting index of 4 UChars mapping index in the mapping data array */ 1.77 + _SPREP_OPTIONS = 7, /* Bit set of options to turn on in the profile */ 1.78 + _SPREP_INDEX_TOP=16 /* changing this requires a new formatVersion */ 1.79 +}; 1.80 + 1.81 +typedef struct UStringPrepKey UStringPrepKey; 1.82 + 1.83 + 1.84 +struct UStringPrepKey{ 1.85 + char* name; 1.86 + char* path; 1.87 +}; 1.88 + 1.89 +struct UStringPrepProfile{ 1.90 + int32_t indexes[_SPREP_INDEX_TOP]; 1.91 + UTrie sprepTrie; 1.92 + const uint16_t* mappingData; 1.93 + UDataMemory* sprepData; 1.94 + const UBiDiProps *bdp; /* used only if checkBiDi is set */ 1.95 + int32_t refCount; 1.96 + UBool isDataLoaded; 1.97 + UBool doNFKC; 1.98 + UBool checkBiDi; 1.99 +}; 1.100 + 1.101 +/** 1.102 + * Helper function for populating the UParseError struct 1.103 + * @internal 1.104 + */ 1.105 +U_CAPI void U_EXPORT2 1.106 +uprv_syntaxError(const UChar* rules, 1.107 + int32_t pos, 1.108 + int32_t rulesLen, 1.109 + UParseError* parseError); 1.110 + 1.111 + 1.112 +/** 1.113 + * Swap StringPrep .spp profile data. See udataswp.h. 1.114 + * @internal 1.115 + */ 1.116 +U_CAPI int32_t U_EXPORT2 1.117 +usprep_swap(const UDataSwapper *ds, 1.118 + const void *inData, int32_t length, void *outData, 1.119 + UErrorCode *pErrorCode); 1.120 + 1.121 +#endif /* #if !UCONFIG_NO_IDNA */ 1.122 + 1.123 +#endif 1.124 + 1.125 +/* 1.126 + * Hey, Emacs, please set the following: 1.127 + * 1.128 + * Local Variables: 1.129 + * indent-tabs-mode: nil 1.130 + * End: 1.131 + * 1.132 + */