Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/intl/icu/source/common/ucnv_set.cpp
Line
Count
Source (jump to first uncovered line)
1
// © 2016 and later: Unicode, Inc. and others.
2
// License & terms of use: http://www.unicode.org/copyright.html
3
/*
4
*******************************************************************************
5
*
6
*   Copyright (C) 2003-2007, International Business Machines
7
*   Corporation and others.  All Rights Reserved.
8
*
9
*******************************************************************************
10
*   file name:  ucnv_set.c
11
*   encoding:   UTF-8
12
*   tab size:   8 (not used)
13
*   indentation:4
14
*
15
*   created on: 2004sep07
16
*   created by: Markus W. Scherer
17
*
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.
21
*/
22
23
#include "unicode/utypes.h"
24
#include "unicode/uset.h"
25
#include "unicode/ucnv.h"
26
#include "ucnv_bld.h"
27
#include "uset_imp.h"
28
29
#if !UCONFIG_NO_CONVERSION
30
31
U_CAPI void U_EXPORT2
32
ucnv_getUnicodeSet(const UConverter *cnv,
33
                   USet *setFillIn,
34
                   UConverterUnicodeSet whichSet,
35
0
                   UErrorCode *pErrorCode) {
36
0
    /* argument checking */
37
0
    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
38
0
        return;
39
0
    }
40
0
    if(cnv==NULL || setFillIn==NULL || whichSet<UCNV_ROUNDTRIP_SET || UCNV_SET_COUNT<=whichSet) {
41
0
        *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
42
0
        return;
43
0
    }
44
0
45
0
    /* does this converter support this function? */
46
0
    if(cnv->sharedData->impl->getUnicodeSet==NULL) {
47
0
        *pErrorCode=U_UNSUPPORTED_ERROR;
48
0
        return;
49
0
    }
50
0
51
0
    {
52
0
        USetAdder sa={
53
0
            NULL,
54
0
            uset_add,
55
0
            uset_addRange,
56
0
            uset_addString,
57
0
            uset_remove,
58
0
            uset_removeRange
59
0
        };
60
0
        sa.set=setFillIn;
61
0
62
0
        /* empty the set */
63
0
        uset_clear(setFillIn);
64
0
65
0
        /* call the converter to add the code points it supports */
66
0
        cnv->sharedData->impl->getUnicodeSet(cnv, &sa, whichSet, pErrorCode);
67
0
    }
68
0
}
69
70
#endif