1 /********************************************************************
3 * Copyright (c) 2008-2011, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
9 // This file contains utility code for supporting UText in the regular expression engine.
12 #include "unicode/utf.h"
17 U_CFUNC UChar U_CALLCONV
18 uregex_utext_unescape_charAt(int32_t offset
, void *ct
) {
19 struct URegexUTextUnescapeCharContext
*context
= (struct URegexUTextUnescapeCharContext
*)ct
;
21 if (offset
== context
->lastOffset
+ 1) {
22 c
= UTEXT_NEXT32(context
->text
);
23 context
->lastOffset
++;
24 } else if (offset
== context
->lastOffset
) {
25 c
= UTEXT_PREVIOUS32(context
->text
);
26 UTEXT_NEXT32(context
->text
);
28 utext_moveIndex32(context
->text
, offset
- context
->lastOffset
- 1);
29 c
= UTEXT_NEXT32(context
->text
);
30 context
->lastOffset
= offset
;
33 // !!!: Doesn't handle characters outside BMP
41 U_CFUNC UChar U_CALLCONV
42 uregex_ucstr_unescape_charAt(int32_t offset
, void *context
) {
43 return ((UChar
*)context
)[offset
];