Coverage Report

Created: 2026-06-07 06:21

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/icu/icu4c/source/i18n/regextxt.cpp
Line
Count
Source
1
// © 2016 and later: Unicode, Inc. and others.
2
// License & terms of use: http://www.unicode.org/copyright.html
3
/********************************************************************
4
 * COPYRIGHT:
5
 * Copyright (c) 2008-2011, International Business Machines Corporation and
6
 * others. All Rights Reserved.
7
 ********************************************************************/
8
//
9
//  file:  regextxt.cpp
10
//
11
//  This file contains utility code for supporting UText in the regular expression engine.
12
//
13
14
#include "unicode/utf.h"
15
#include "regextxt.h"
16
17
U_NAMESPACE_BEGIN
18
19
U_CFUNC char16_t U_CALLCONV
20
0
uregex_utext_unescape_charAt(int32_t offset, void *ct) {
21
0
    struct URegexUTextUnescapeCharContext *context = (struct URegexUTextUnescapeCharContext *)ct;
22
0
    UChar32 c;
23
0
    if (offset == context->lastOffset + 1) {
24
0
        c = UTEXT_NEXT32(context->text);
25
0
        context->lastOffset++;
26
0
    } else if (offset == context->lastOffset) {
27
0
        c = UTEXT_PREVIOUS32(context->text);
28
0
        UTEXT_NEXT32(context->text);
29
0
    } else {
30
0
        utext_moveIndex32(context->text, offset - context->lastOffset - 1);
31
0
        c = UTEXT_NEXT32(context->text);
32
0
        context->lastOffset = offset;
33
0
    }
34
35
    // !!!: Doesn't handle characters outside BMP
36
0
    if (U_IS_BMP(c)) {
37
0
        return (char16_t)c;
38
0
    } else {
39
0
        return 0;
40
0
    }
41
0
}
42
43
U_CFUNC char16_t U_CALLCONV
44
2.67M
uregex_ucstr_unescape_charAt(int32_t offset, void *context) {
45
2.67M
    return ((char16_t *)context)[offset];
46
2.67M
}
47
48
U_NAMESPACE_END