summaryrefslogtreecommitdiff
path: root/deps/icu-small/source/i18n/number_padding.cpp
diff options
context:
space:
mode:
authorSteven R. Loomis <srloomis@us.ibm.com>2018-07-09 13:46:16 -0700
committerAnna Henningsen <anna@addaleax.net>2018-07-11 00:15:23 +0200
commit538acead6670d711ddb71c0b852089b792c996e3 (patch)
tree917c6df14436e66d4883feb7bb9269480fce06ab /deps/icu-small/source/i18n/number_padding.cpp
parented715ef8900afa5056ebd5ef995e89eebd4987c2 (diff)
downloadandroid-node-v8-538acead6670d711ddb71c0b852089b792c996e3.tar.gz
android-node-v8-538acead6670d711ddb71c0b852089b792c996e3.tar.bz2
android-node-v8-538acead6670d711ddb71c0b852089b792c996e3.zip
deps: icu 62.1 bump (Unicode 11, CLDR 33.1)
- Full release notes: http://site.icu-project.org/download/62 Fixes: https://github.com/nodejs/node/issues/21452 PR-URL: https://github.com/nodejs/node/pull/21728 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Diffstat (limited to 'deps/icu-small/source/i18n/number_padding.cpp')
-rw-r--r--deps/icu-small/source/i18n/number_padding.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/deps/icu-small/source/i18n/number_padding.cpp b/deps/icu-small/source/i18n/number_padding.cpp
index b1db3490cd..97e7b6014f 100644
--- a/deps/icu-small/source/i18n/number_padding.cpp
+++ b/deps/icu-small/source/i18n/number_padding.cpp
@@ -3,11 +3,12 @@
#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING && !UPRV_INCOMPLETE_CPP11_SUPPORT
+#if !UCONFIG_NO_FORMATTING
#include "unicode/numberformatter.h"
#include "number_types.h"
#include "number_stringbuilder.h"
+#include "number_decimfmtprops.h"
using namespace icu;
using namespace icu::number;
@@ -28,6 +29,7 @@ addPaddingHelper(UChar32 paddingCp, int32_t requiredPadding, NumberStringBuilder
}
Padder::Padder(UChar32 cp, int32_t width, UNumberFormatPadPosition position) : fWidth(width) {
+ // TODO(13034): Consider making this a string instead of code point.
fUnion.padding.fCp = cp;
fUnion.padding.fPosition = position;
}
@@ -47,6 +49,16 @@ Padder Padder::codePoints(UChar32 cp, int32_t targetWidth, UNumberFormatPadPosit
}
}
+Padder Padder::forProperties(const DecimalFormatProperties& properties) {
+ UChar32 padCp;
+ if (properties.padString.length() > 0) {
+ padCp = properties.padString.char32At(0);
+ } else {
+ padCp = kFallbackPaddingString[0];
+ }
+ return {padCp, properties.formatWidth, properties.padPosition.getOrDefault(UNUM_PAD_BEFORE_PREFIX)};
+}
+
int32_t Padder::padAndApply(const Modifier &mod1, const Modifier &mod2,
NumberStringBuilder &string, int32_t leftIndex, int32_t rightIndex,
UErrorCode &status) const {