2017-01-20 00:20:31 +00:00
|
|
|
// © 2016 and later: Unicode, Inc. and others.
|
2016-06-15 18:58:17 +00:00
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
2004-09-07 17:59:53 +00:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
|
|
|
*
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (C) 2003-2007, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
2004-09-07 17:59:53 +00:00
|
|
|
*
|
|
|
|
*******************************************************************************
|
|
|
|
* file name: ucnv_set.c
|
2017-02-03 18:57:23 +00:00
|
|
|
* encoding: UTF-8
|
2004-09-07 17:59:53 +00:00
|
|
|
* tab size: 8 (not used)
|
|
|
|
* indentation:4
|
|
|
|
*
|
|
|
|
* created on: 2004sep07
|
|
|
|
* created by: Markus W. Scherer
|
|
|
|
*
|
|
|
|
* Conversion API functions using USet (ucnv_getUnicodeSet())
|
|
|
|
* moved here from ucnv.c for removing the dependency of other ucnv_
|
|
|
|
* implementation functions on the USet implementation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "unicode/utypes.h"
|
|
|
|
#include "unicode/uset.h"
|
|
|
|
#include "unicode/ucnv.h"
|
|
|
|
#include "ucnv_bld.h"
|
|
|
|
#include "uset_imp.h"
|
|
|
|
|
2004-09-09 05:55:01 +00:00
|
|
|
#if !UCONFIG_NO_CONVERSION
|
|
|
|
|
2004-09-07 17:59:53 +00:00
|
|
|
U_CAPI void U_EXPORT2
|
|
|
|
ucnv_getUnicodeSet(const UConverter *cnv,
|
|
|
|
USet *setFillIn,
|
|
|
|
UConverterUnicodeSet whichSet,
|
|
|
|
UErrorCode *pErrorCode) {
|
|
|
|
/* argument checking */
|
|
|
|
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(cnv==NULL || setFillIn==NULL || whichSet<UCNV_ROUNDTRIP_SET || UCNV_SET_COUNT<=whichSet) {
|
|
|
|
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* does this converter support this function? */
|
|
|
|
if(cnv->sharedData->impl->getUnicodeSet==NULL) {
|
|
|
|
*pErrorCode=U_UNSUPPORTED_ERROR;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
USetAdder sa={
|
|
|
|
NULL,
|
|
|
|
uset_add,
|
|
|
|
uset_addRange,
|
2005-06-03 20:17:54 +00:00
|
|
|
uset_addString,
|
2007-10-24 21:15:41 +00:00
|
|
|
uset_remove,
|
|
|
|
uset_removeRange
|
2004-09-07 17:59:53 +00:00
|
|
|
};
|
|
|
|
sa.set=setFillIn;
|
|
|
|
|
|
|
|
/* empty the set */
|
|
|
|
uset_clear(setFillIn);
|
|
|
|
|
|
|
|
/* call the converter to add the code points it supports */
|
|
|
|
cnv->sharedData->impl->getUnicodeSet(cnv, &sa, whichSet, pErrorCode);
|
|
|
|
}
|
|
|
|
}
|
2004-09-09 05:55:01 +00:00
|
|
|
|
|
|
|
#endif
|