1 /********************************************************************
3 * Copyright (c) 2008-2010, 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.
16 U_CFUNC UChar U_CALLCONV
17 uregex_utext_unescape_charAt(int32_t offset
, void *ct
) {
18 struct URegexUTextUnescapeCharContext
*context
= (struct URegexUTextUnescapeCharContext
*)ct
;
20 if (offset
== context
->lastOffset
+ 1) {
21 c
= UTEXT_NEXT32(context
->text
);
22 context
->lastOffset
++;
23 } else if (offset
== context
->lastOffset
) {
24 c
= UTEXT_PREVIOUS32(context
->text
);
25 UTEXT_NEXT32(context
->text
);
27 utext_moveIndex32(context
->text
, offset
- context
->lastOffset
- 1);
28 c
= UTEXT_NEXT32(context
->text
);
29 context
->lastOffset
= offset
;
32 // !!!: Doesn't handle characters outside BMP
40 U_CFUNC UChar U_CALLCONV
41 uregex_ucstr_unescape_charAt(int32_t offset
, void *context
) {
42 return ((UChar
*)context
)[offset
];