michael@0: /* michael@0: ******************************************************************************* michael@0: * michael@0: * Copyright (C) 2003-2007, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: * michael@0: ******************************************************************************* michael@0: * file name: ucnv_set.c michael@0: * encoding: US-ASCII michael@0: * tab size: 8 (not used) michael@0: * indentation:4 michael@0: * michael@0: * created on: 2004sep07 michael@0: * created by: Markus W. Scherer michael@0: * michael@0: * Conversion API functions using USet (ucnv_getUnicodeSet()) michael@0: * moved here from ucnv.c for removing the dependency of other ucnv_ michael@0: * implementation functions on the USet implementation. michael@0: */ michael@0: michael@0: #include "unicode/utypes.h" michael@0: #include "unicode/uset.h" michael@0: #include "unicode/ucnv.h" michael@0: #include "ucnv_bld.h" michael@0: #include "uset_imp.h" michael@0: michael@0: #if !UCONFIG_NO_CONVERSION michael@0: michael@0: U_CAPI void U_EXPORT2 michael@0: ucnv_getUnicodeSet(const UConverter *cnv, michael@0: USet *setFillIn, michael@0: UConverterUnicodeSet whichSet, michael@0: UErrorCode *pErrorCode) { michael@0: /* argument checking */ michael@0: if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { michael@0: return; michael@0: } michael@0: if(cnv==NULL || setFillIn==NULL || whichSetsharedData->impl->getUnicodeSet==NULL) { michael@0: *pErrorCode=U_UNSUPPORTED_ERROR; michael@0: return; michael@0: } michael@0: michael@0: { michael@0: USetAdder sa={ michael@0: NULL, michael@0: uset_add, michael@0: uset_addRange, michael@0: uset_addString, michael@0: uset_remove, michael@0: uset_removeRange michael@0: }; michael@0: sa.set=setFillIn; michael@0: michael@0: /* empty the set */ michael@0: uset_clear(setFillIn); michael@0: michael@0: /* call the converter to add the code points it supports */ michael@0: cnv->sharedData->impl->getUnicodeSet(cnv, &sa, whichSet, pErrorCode); michael@0: } michael@0: } michael@0: michael@0: #endif