intl/icu/source/common/ucnv_set.c

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 /*
michael@0 2 *******************************************************************************
michael@0 3 *
michael@0 4 * Copyright (C) 2003-2007, International Business Machines
michael@0 5 * Corporation and others. All Rights Reserved.
michael@0 6 *
michael@0 7 *******************************************************************************
michael@0 8 * file name: ucnv_set.c
michael@0 9 * encoding: US-ASCII
michael@0 10 * tab size: 8 (not used)
michael@0 11 * indentation:4
michael@0 12 *
michael@0 13 * created on: 2004sep07
michael@0 14 * created by: Markus W. Scherer
michael@0 15 *
michael@0 16 * Conversion API functions using USet (ucnv_getUnicodeSet())
michael@0 17 * moved here from ucnv.c for removing the dependency of other ucnv_
michael@0 18 * implementation functions on the USet implementation.
michael@0 19 */
michael@0 20
michael@0 21 #include "unicode/utypes.h"
michael@0 22 #include "unicode/uset.h"
michael@0 23 #include "unicode/ucnv.h"
michael@0 24 #include "ucnv_bld.h"
michael@0 25 #include "uset_imp.h"
michael@0 26
michael@0 27 #if !UCONFIG_NO_CONVERSION
michael@0 28
michael@0 29 U_CAPI void U_EXPORT2
michael@0 30 ucnv_getUnicodeSet(const UConverter *cnv,
michael@0 31 USet *setFillIn,
michael@0 32 UConverterUnicodeSet whichSet,
michael@0 33 UErrorCode *pErrorCode) {
michael@0 34 /* argument checking */
michael@0 35 if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
michael@0 36 return;
michael@0 37 }
michael@0 38 if(cnv==NULL || setFillIn==NULL || whichSet<UCNV_ROUNDTRIP_SET || UCNV_SET_COUNT<=whichSet) {
michael@0 39 *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
michael@0 40 return;
michael@0 41 }
michael@0 42
michael@0 43 /* does this converter support this function? */
michael@0 44 if(cnv->sharedData->impl->getUnicodeSet==NULL) {
michael@0 45 *pErrorCode=U_UNSUPPORTED_ERROR;
michael@0 46 return;
michael@0 47 }
michael@0 48
michael@0 49 {
michael@0 50 USetAdder sa={
michael@0 51 NULL,
michael@0 52 uset_add,
michael@0 53 uset_addRange,
michael@0 54 uset_addString,
michael@0 55 uset_remove,
michael@0 56 uset_removeRange
michael@0 57 };
michael@0 58 sa.set=setFillIn;
michael@0 59
michael@0 60 /* empty the set */
michael@0 61 uset_clear(setFillIn);
michael@0 62
michael@0 63 /* call the converter to add the code points it supports */
michael@0 64 cnv->sharedData->impl->getUnicodeSet(cnv, &sa, whichSet, pErrorCode);
michael@0 65 }
michael@0 66 }
michael@0 67
michael@0 68 #endif

mercurial