1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html |
3 | /* |
4 | ******************************************************************************* |
5 | * Copyright (C) 2003-2006, International Business Machines |
6 | * Corporation and others. All Rights Reserved. |
7 | ******************************************************************************* |
8 | * file name: regexc.cpp |
9 | * description: The purpose of this function is to separate the codepage |
10 | * conversion from the rest of the uregex_ API. This can removes any |
11 | * dependency on codepage conversion, which reduces the overhead of |
12 | */ |
13 | |
14 | #include "unicode/uregex.h" |
15 | #include "unicode/unistr.h" |
16 | |
17 | U_NAMESPACE_USE |
18 | |
19 | //---------------------------------------------------------------------------------------- |
20 | // |
21 | // uregex_openC |
22 | // |
23 | //---------------------------------------------------------------------------------------- |
24 | #if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_REGULAR_EXPRESSIONS |
25 | |
26 | U_CAPI URegularExpression * U_EXPORT2 |
27 | uregex_openC( const char *pattern, |
28 | uint32_t flags, |
29 | UParseError *pe, |
30 | UErrorCode *status) { |
31 | if (U_FAILURE(*status)) { |
32 | return NULL; |
33 | } |
34 | if (pattern == NULL) { |
35 | *status = U_ILLEGAL_ARGUMENT_ERROR; |
36 | return NULL; |
37 | } |
38 | |
39 | UnicodeString patString(pattern); |
40 | return uregex_open(patString.getBuffer(), patString.length(), flags, pe, status); |
41 | } |
42 | #endif |
43 | |