]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/uregexc.cpp
ICU-8.11.1.tar.gz
[apple/icu.git] / icuSources / i18n / uregexc.cpp
1 /*
2 *******************************************************************************
3 * Copyright (C) 2003-2005, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 *******************************************************************************
6 * file name: regexc.cpp
7 * description: The purpose of this function is to separate the codepage
8 * conversion from the rest of the uregex_ API. This can removes any
9 * dependency on codepage conversion, which reduces the overhead of
10 */
11
12 #include "unicode/uregex.h"
13 #include "unicode/unistr.h"
14
15 //----------------------------------------------------------------------------------------
16 //
17 // uregex_openC
18 //
19 //----------------------------------------------------------------------------------------
20 #if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_REGULAR_EXPRESSIONS
21
22 U_CAPI URegularExpression * U_EXPORT2
23 uregex_openC( const char *pattern,
24 uint32_t flags,
25 UParseError *pe,
26 UErrorCode *status) {
27 if (U_FAILURE(*status)) {
28 return NULL;
29 }
30 if (pattern == NULL) {
31 *status = U_ILLEGAL_ARGUMENT_ERROR;
32 return NULL;
33 }
34
35 UnicodeString patString(pattern);
36 URegularExpression *re = uregex_open(patString.getBuffer(), patString.length(), flags, pe, status);
37 return re;
38 }
39 #endif