| 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 |
| 14 |
namespace numparse::impl::utils { |
| 15 |
|
| 16 |
inline static void putLeadCodePoints(const UnicodeSet* input, UnicodeSet* output) { |
| 17 |
for (int32_t i = 0; i < input->getRangeCount(); i++) { |
| 18 |
output->add(input->getRangeStart(i), input->getRangeEnd(i)); |
| 19 |
} |
| 20 |
// TODO: ANDY: How to iterate over the strings in ICU4C UnicodeSet? |
| 21 |
} |
| 22 |
|
| 23 |
inline static void putLeadCodePoint(const UnicodeString& input, UnicodeSet* output) { |
| 24 |
if (!input.isEmpty()) { |
| 25 |
output->add(input.char32At(0)); |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
inline static void copyCurrencyCode(char16_t* dest, const char16_t* src) { |
| 30 |
uprv_memcpy(dest, src, sizeof(char16_t) * 3); |
| 31 |
dest[3] = 0; |
| 32 |
} |
| 33 |
|
| 34 |
} // namespace numparse::impl::utils |
| 35 |
U_NAMESPACE_END |
| 36 |
|
| 37 |
#endif //__NUMPARSE_UTILS_H__ |
| 38 |
#endif /* #if !UCONFIG_NO_FORMATTING */ |