| 1 | // © 2018 and later: Unicode, Inc. and others. | 
|---|---|
| 2 | // License & terms of use: http://www.unicode.org/copyright.html | 
| 3 | |
| 4 | #include "unicode/utypes.h" | 
| 5 | |
| 6 | #if !UCONFIG_NO_FORMATTING | 
| 7 | #ifndef __NUMPARSE_UTILS_H__ | 
| 8 | #define __NUMPARSE_UTILS_H__ | 
| 9 | |
| 10 | #include "numparse_types.h" | 
| 11 | #include "unicode/uniset.h" | 
| 12 | |
| 13 | U_NAMESPACE_BEGIN namespace numparse { | 
| 14 | namespace impl { | 
| 15 | namespace utils { | 
| 16 | |
| 17 | |
| 18 | inline static void putLeadCodePoints(const UnicodeSet* input, UnicodeSet* output) { | 
| 19 | for (int32_t i = 0; i < input->getRangeCount(); i++) { | 
| 20 | output->add(input->getRangeStart(i), input->getRangeEnd(i)); | 
| 21 | } | 
| 22 | // TODO: ANDY: How to iterate over the strings in ICU4C UnicodeSet? | 
| 23 | } | 
| 24 | |
| 25 | inline static void putLeadCodePoint(const UnicodeString& input, UnicodeSet* output) { | 
| 26 | if (!input.isEmpty()) { | 
| 27 | output->add(input.char32At(0)); | 
| 28 | } | 
| 29 | } | 
| 30 | |
| 31 | inline static void copyCurrencyCode(UChar* dest, const UChar* src) { | 
| 32 | uprv_memcpy(dest, src, sizeof(UChar) * 3); | 
| 33 | dest[3] = 0; | 
| 34 | } | 
| 35 | |
| 36 | |
| 37 | } // namespace utils | 
| 38 | } // namespace impl | 
| 39 | } // namespace numparse | 
| 40 | U_NAMESPACE_END | 
| 41 | |
| 42 | #endif //__NUMPARSE_UTILS_H__ | 
| 43 | #endif /* #if !UCONFIG_NO_FORMATTING */ | 
| 44 | 
