1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
6 * Copyright (C) 2003-2007, International Business Machines
7 * Corporation and others. All Rights Reserved.
9 *******************************************************************************
10 * file name: ucnv_set.c
12 * tab size: 8 (not used)
15 * created on: 2004sep07
16 * created by: Markus W. Scherer
18 * Conversion API functions using USet (ucnv_getUnicodeSet())
19 * moved here from ucnv.c for removing the dependency of other ucnv_
20 * implementation functions on the USet implementation.
23 #include "unicode/utypes.h"
24 #include "unicode/uset.h"
25 #include "unicode/ucnv.h"
29 #if !UCONFIG_NO_CONVERSION
32 ucnv_getUnicodeSet(const UConverter *cnv,
34 UConverterUnicodeSet whichSet,
35 UErrorCode *pErrorCode) {
36 /* argument checking */
37 if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
40 if(cnv==NULL || setFillIn==NULL || whichSet<UCNV_ROUNDTRIP_SET || UCNV_SET_COUNT<=whichSet) {
41 *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
45 /* does this converter support this function? */
46 if(cnv->sharedData->impl->getUnicodeSet==NULL) {
47 *pErrorCode=U_UNSUPPORTED_ERROR;
63 uset_clear(setFillIn);
65 /* call the converter to add the code points it supports */
66 cnv->sharedData->impl->getUnicodeSet(cnv, &sa, whichSet, pErrorCode);