summaryrefslogtreecommitdiff
path: root/deps/icu-small/source/common/lsr.h
diff options
context:
space:
mode:
authorAlbert Wang <git@albertyw.com>2019-11-02 18:08:46 -0700
committerRichard Lau <riclau@uk.ibm.com>2019-12-05 20:39:20 -0500
commit418dd68b611cce7e916dae82c75cb3d63b3c43a6 (patch)
tree0ed206d2abae637584d4f5690a17b4ab4dd46d39 /deps/icu-small/source/common/lsr.h
parent6c40cb2aca89df4c7c0e3923d93024734dd49f2d (diff)
downloadandroid-node-v8-418dd68b611cce7e916dae82c75cb3d63b3c43a6.tar.gz
android-node-v8-418dd68b611cce7e916dae82c75cb3d63b3c43a6.tar.bz2
android-node-v8-418dd68b611cce7e916dae82c75cb3d63b3c43a6.zip
tools: update icu to 65.1
Update the version of the bundled ICU (deps/icu-small) to ICU version 65.2. Fixes: https://github.com/nodejs/node/issues/30211 Fixes: https://github.com/nodejs/node/issues/29540 PR-URL: https://github.com/nodejs/node/pull/30232 Reviewed-By: Steven R Loomis <srloomis@us.ibm.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Diffstat (limited to 'deps/icu-small/source/common/lsr.h')
-rw-r--r--deps/icu-small/source/common/lsr.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/deps/icu-small/source/common/lsr.h b/deps/icu-small/source/common/lsr.h
new file mode 100644
index 0000000000..db6cf938f4
--- /dev/null
+++ b/deps/icu-small/source/common/lsr.h
@@ -0,0 +1,72 @@
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// lsr.h
+// created: 2019may08 Markus W. Scherer
+
+#ifndef __LSR_H__
+#define __LSR_H__
+
+#include "unicode/utypes.h"
+#include "unicode/uobject.h"
+#include "cstring.h"
+
+U_NAMESPACE_BEGIN
+
+struct LSR final : public UMemory {
+ static constexpr int32_t REGION_INDEX_LIMIT = 1001 + 26 * 26;
+
+ const char *language;
+ const char *script;
+ const char *region;
+ char *owned = nullptr;
+ /** Index for region, 0 if ill-formed. @see indexForRegion */
+ int32_t regionIndex = 0;
+ /** Only set for LSRs that will be used in a hash table. */
+ int32_t hashCode = 0;
+
+ LSR() : language("und"), script(""), region("") {}
+
+ /** Constructor which aliases all subtag pointers. */
+ LSR(const char *lang, const char *scr, const char *r) :
+ language(lang), script(scr), region(r),
+ regionIndex(indexForRegion(region)) {}
+ /**
+ * Constructor which prepends the prefix to the language and script,
+ * copies those into owned memory, and aliases the region.
+ */
+ LSR(char prefix, const char *lang, const char *scr, const char *r, UErrorCode &errorCode);
+ LSR(LSR &&other) U_NOEXCEPT;
+ LSR(const LSR &other) = delete;
+ inline ~LSR() {
+ // Pure inline code for almost all instances.
+ if (owned != nullptr) {
+ deleteOwned();
+ }
+ }
+
+ LSR &operator=(LSR &&other) U_NOEXCEPT;
+ LSR &operator=(const LSR &other) = delete;
+
+ /**
+ * Returns a positive index (>0) for a well-formed region code.
+ * Do not rely on a particular region->index mapping; it may change.
+ * Returns 0 for ill-formed strings.
+ */
+ static int32_t indexForRegion(const char *region);
+
+ UBool operator==(const LSR &other) const;
+
+ inline UBool operator!=(const LSR &other) const {
+ return !operator==(other);
+ }
+
+ LSR &setHashCode();
+
+private:
+ void deleteOwned();
+};
+
+U_NAMESPACE_END
+
+#endif // __LSR_H__