Victor Chang | 7322950 | 2020-09-17 13:39:19 +0100 | [diff] [blame] | 1 | // © 2016 and later: Unicode, Inc. and others. |
| 2 | // License & terms of use: http://www.unicode.org/copyright.html |
| 3 | // |
| 4 | // regexst.h |
| 5 | // |
| 6 | // Copyright (C) 2003-2010, International Business Machines Corporation and others. |
| 7 | // All Rights Reserved. |
| 8 | // |
| 9 | // This file contains declarations for the class RegexStaticSets |
| 10 | // |
| 11 | // This class is internal to the regular expression implementation. |
| 12 | // For the public Regular Expression API, see the file "unicode/regex.h" |
| 13 | // |
| 14 | // RegexStaticSets groups together the common UnicodeSets that are needed |
| 15 | // for compiling or executing RegularExpressions. This grouping simplifies |
| 16 | // the thread safe lazy creation and sharing of these sets across |
| 17 | // all instances of regular expressions. |
| 18 | // |
| 19 | |
| 20 | #ifndef REGEXST_H |
| 21 | #define REGEXST_H |
| 22 | |
| 23 | #include "unicode/utypes.h" |
| 24 | #include "unicode/utext.h" |
| 25 | #if !UCONFIG_NO_REGULAR_EXPRESSIONS |
| 26 | |
| 27 | #include "regeximp.h" |
Victor Chang | d8aa9d5 | 2021-01-05 23:49:57 +0000 | [diff] [blame] | 28 | #include "regexcst.h" |
Victor Chang | 7322950 | 2020-09-17 13:39:19 +0100 | [diff] [blame] | 29 | |
| 30 | U_NAMESPACE_BEGIN |
| 31 | |
| 32 | class UnicodeSet; |
| 33 | |
| 34 | |
| 35 | class RegexStaticSets : public UMemory { |
| 36 | public: |
| 37 | static RegexStaticSets *gStaticSets; // Ptr to all lazily initialized constant |
| 38 | // shared sets. |
| 39 | |
| 40 | RegexStaticSets(UErrorCode *status); |
| 41 | ~RegexStaticSets(); |
| 42 | static void initGlobals(UErrorCode *status); |
Victor Chang | 7322950 | 2020-09-17 13:39:19 +0100 | [diff] [blame] | 43 | |
Victor Chang | d8aa9d5 | 2021-01-05 23:49:57 +0000 | [diff] [blame] | 44 | UnicodeSet fPropSets[URX_LAST_SET] {}; // The sets for common regex items, e.g. \s |
| 45 | Regex8BitSet fPropSets8[URX_LAST_SET] {}; // Fast bitmap sets for latin-1 range for above. |
Victor Chang | 7322950 | 2020-09-17 13:39:19 +0100 | [diff] [blame] | 46 | |
Victor Chang | d8aa9d5 | 2021-01-05 23:49:57 +0000 | [diff] [blame] | 47 | UnicodeSet fRuleSets[kRuleSet_count] {}; // Sets used while parsing regexp patterns. |
| 48 | UnicodeSet fUnescapeCharSet {}; // Set of chars handled by unescape when |
| 49 | // encountered with a \ in a pattern. |
| 50 | UnicodeSet *fRuleDigitsAlias {}; |
| 51 | UText *fEmptyText {}; // An empty string, to be used when a matcher |
| 52 | // is created with no input. |
Victor Chang | 7322950 | 2020-09-17 13:39:19 +0100 | [diff] [blame] | 53 | |
| 54 | }; |
| 55 | |
| 56 | |
| 57 | U_NAMESPACE_END |
| 58 | #endif // !UCONFIG_NO_REGULAR_EXPRESSIONS |
| 59 | #endif // REGEXST_H |
| 60 | |