Merge branch 'master' into units-staging

This commit is contained in:
Shane F. Carr 2020-04-03 16:47:36 -05:00
commit e582200332
392 changed files with 5672 additions and 6986 deletions

View file

@ -14,22 +14,23 @@ cache:
# - The VS2017 build is disabled (commented out) below, as we build both VS2015 and VS2017
# on Azure Pipelines instead, since that is much faster.
#
# - For the Cygwin build, the CYG_MIRROR URL below is from the "Cygwin Time Machine" archive,
# and that URL maps to the 64-bit version of Cygwin 2.11.2-1 (with timestamp 1550062412).
# This was the last release of Cygwin 2.11 before version 3.0.0 was released.
# See: http://www.crouchingtigerhiddenfruitbat.org/Cygwin/timemachine.html
# - For the Cygwin build, the CYG_MIRROR URL used to use the "Cygwin Time Machine" archive
# in order to pull a previous version of Cygwin, v2.11.2-1 (with timestamp 1550062412).
# This was done as version 3 had issues and didn't build at all.
# The previous URL was:
# http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/64bit/2019/02/13/045332
#
# Note: The archived Cygwin repo does not keep or retain any file signature files, so we
# must use the "-X" or "--no-verify" option below in the setup command.
# In order to speed the builds up we use the "-X" or "--no-verify" option to skip checking
# the signatures on packages.
environment:
global:
ICU_CI_CACHE: c:\icu-ci-cache
CYG_URL: https://cygwin.com/setup-x86_64.exe
CYG_MIRROR: http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/64bit/2019/02/13/045332
CYG_MIRROR: http://mirrors.kernel.org/sourceware/cygwin/
CYG_PACKAGES: automake,gcc-core,gcc-g++,make,pkg-config,perl,python3
CYG_ROOT: c:\cygwin-root
CYG_CACHE: '%ICU_CI_CACHE%\cygwin64'
CYG_CACHE: '%ICU_CI_CACHE%\cygwin64-v3'
CYG_CACHED_SETUP: '%CYG_CACHE%\setup.exe'
matrix:
@ -65,7 +66,7 @@ for:
- "%CYG_ROOT%\\bin\\sh -lc 'uname -a'"
build_script:
- '%CYG_ROOT%\\bin\\bash -lc "cd $(cygpath ${APPVEYOR_BUILD_FOLDER}) && cd icu4c/source && ./runConfigureICU Cygwin && make check"'
- '%CYG_ROOT%\\bin\\bash -lc "cd $(cygpath ${APPVEYOR_BUILD_FOLDER}) && cd icu4c/source && ./runConfigureICU Cygwin && make -j2 check"'
# -
# matrix:

View file

@ -95,14 +95,15 @@ Start with the stem `scientific` or `engineering`. Those stems take the
following optional options:
- `/sign-xxx` sets the sign display option for the exponent; see [Sign](#sign).
- `/+ee` sets exponent digits to "at least 2"; use `/+eee` for at least 3 digits, etc.
- `/*ee` sets exponent digits to "at least 2"; use `/*eee` for at least 3 digits, etc.
- ***Prior to ICU 67***, use `/+ee` instead of `/*ee`.
For example, all of the following skeletons are valid:
- `scientific`
- `scientific/sign-always`
- `scientific/+ee`
- `scientific/+ee/sign-always`
- `scientific/*ee`
- `scientific/*ee/sign-always`
#### Scientific and Engineering Notation: Concise Form
@ -111,14 +112,14 @@ The following are examples of concise form:
| Concise Skeleton | Equivalent Long-Form Skeleton |
|---|---|
| `E0` | `scientific` |
| `E00` | `scientific/+ee` |
| `EE+0` | `engineering/sign-always` |
| `E00` | `scientific/*ee` |
| `EE+!0` | `engineering/sign-always` |
| `E+?00` | `scientific/sign-except-zero/+ee` |
More precisely:
1. Start with `E` for scientific or `EE` for engineering.
2. Allow either `+` or `+?` as a concise sign display option.
2. Allow either `+!` or `+?` as a concise sign display option.
3. Expect one or more `0`s. If more than one, set minimum integer digits.
### Unit
@ -192,13 +193,13 @@ The following are examples of fraction-precision stems:
| Stem | Explanation | Equivalent C++ Code |
|---|---|---|
| `.00` | Exactly 2 fraction digits | `Precision::fixedFraction(2) ` |
| `.00+` | At least 2 fraction digits | `Precision::minFraction(2)` |
| `.00*` | At least 2 fraction digits | `Precision::minFraction(2)` |
| `.##` | At most 2 fraction digits | `Precision::maxFraction(2) ` |
| `.0#` | Between 1 and 2 fraction digits | `Precision::minMaxFraction(1, 2)` |
More precisely, the fraction precision stem starts with `.`, then contains
zero or more `0` symbols, which implies the minimum fraction digits. Then it
contains either a `+`, for unlimited maximum fraction digits, or zero or more
contains either a `*`, for unlimited maximum fraction digits, or zero or more
`#` symbols, which implies the minimum fraction digits when added to the `0`
symbols.
@ -211,11 +212,11 @@ examples:
| Skeleton | Explanation | Equivalent C++ Code |
|---|---|---|
| `.##/@@@+` | At most 2 fraction digits, but guarantee <br/> at least 3 significant digits | `Precision::maxFraction(2)` <br/> `.withMinDigits(3)` |
| `.##/@@@*` | At most 2 fraction digits, but guarantee <br/> at least 3 significant digits | `Precision::maxFraction(2)` <br/> `.withMinDigits(3)` |
| `.00/@##` | Exactly 2 fraction digits, but do not <br/> display more than 3 significant digits | `Precision::fixedFraction(2)` <br/> `.withMaxDigits(3)` |
Precisely, the option starts with one or more `@` symbols. Then it contains
either a `+`, for `::withMinDigits`, or one or more `#` symbols, for
either a `*`, for `::withMinDigits`, or one or more `#` symbols, for
`::withMaxDigits`. If a `#` symbol is present, there must be only one `@`
symbol.
@ -226,16 +227,22 @@ The following are examples of stems for significant figures:
| Stem | Explanation | Equivalent C++ Code|
|---|---|---|
| `@@@` | Exactly 3 significant digits | `Precision::fixedSignificantDigits(3)` |
| `@@@+` | At least 3 significant digits | `Precision::minSignificantDigits(3)` |
| `@@@*` | At least 3 significant digits | `Precision::minSignificantDigits(3)` |
| `@##` | At most 3 significant digits | `Precision::maxSignificantDigits(3)` |
| `@@#` | Between 2 and 3 significant digits | `...::minMaxSignificantDigits(2, 3)` |
The precise syntax is very similar to fraction precision. The blueprint stem
starts with one or more `@` symbols, which implies the minimum significant
digits. Then it contains either a `+`, for unlimited maximum significant
digits. Then it contains either a `*`, for unlimited maximum significant
digits, or zero or more `#` symbols, which implies the minimum significant
digits when added to the `@` symbols.
#### Wildcard Character
***Prior to ICU 67***, the symbol `+` was used for unlimited precision, instead
of `*` (for example, `.00+`). For backwards compatibility, either `+` or `*` is
accepted. This applies for both fraction digits and significant digits.
### Rounding Mode
The rounding mode can be specified by the following stems:
@ -259,21 +266,23 @@ integer digits):
| Long Form | Concise Form | Explanation | Equivalent C++ Code |
|---|---|---|---|
| `integer-width/+000` | `000` | At least 3 <br/> integer digits | `IntegerWidth::zeroFillTo(3)` |
| `integer-width/*000` | `000` | At least 3 <br/> integer digits | `IntegerWidth::zeroFillTo(3)` |
| `integer-width/##0` | - | Between 1 and 3 <br/> integer digits | `IntegerWidth::zeroFillTo(1)` <br/> `.truncateAt(3)`
| `integer-width/00` | - | Exactly 2 <br/> integer digits | `IntegerWidth::zeroFillTo(2)` <br/> `.truncateAt(2)` |
| `integer-width/+` | - | Zero or more <br/> integer digits | `IntegerWidth::zeroFillTo(0) `
| `integer-width/*` | - | Zero or more <br/> integer digits | `IntegerWidth::zeroFillTo(0) `
The long-form option starts with either a single `+` symbol, signaling no limit
The long-form option starts with either a single `*` symbol, signaling no limit
on the number of integer digits (no *truncateAt*), or zero or more `#` symbols.
It should then be followed by zero or more `0` symbols, indicating the minimum
integer digits (the argument to *zeroFillTo*). If there is no `+` symbol, the
integer digits (the argument to *zeroFillTo*). If there is no `*` symbol, the
maximum integer digits (the argument to *truncateAt*) is the number of `#`
symbols plus the number of `0` symbols.
The concise skeleton is simply one or more `0` characters. This supports
minimum integer digits but not maximum integer digits.
***Prior to ICU 67***, use the symbol `+` instead of `*`.
### Scale
To specify the scale, use the following stem and option:
@ -303,7 +312,7 @@ The grouping strategy can be specified by the following stems:
- `group-min2` or `,?` (concise)
- `group-auto` (or omit since this is the default)
- `group-on-aligned` or `,!` (concise)
- `group-thousands` or `,=` (concise)
- `group-thousands` (no concise equivalent)
For more details, see
[UNumberGroupingStrategy](http://icu-project.org/apiref/icu4c/unumberformatter_8h.html).

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title>ReadMe for ICU 66.1</title>
<title>ReadMe for ICU 67.1</title>
<meta name="COPYRIGHT" content=
"Copyright (C) 2016 and later: Unicode, Inc. and others. License &amp; terms of use: http://www.unicode.org/copyright.html"/>
<!-- meta name="COPYRIGHT" content=
@ -23,8 +23,8 @@
milestone - if the release note is a milestone release
-->
<!-- <body> -->
<body class="rc">
<body>
<!-- <body class="rc"> -->
<p class="only-draft"><b>Note:</b> This is a draft readme.</p>
<h1>
@ -33,7 +33,7 @@
<span class="only-rc">Release Candidate</span>
<!-- <span class="only-milestone">(Milestone Release)</span> -->
<span class="only-milestone">(Preview Release)</span>
<abbr title="International Components for Unicode">ICU</abbr> 66.1 ReadMe
<abbr title="International Components for Unicode">ICU</abbr> 67.1 ReadMe
</h1>
<!-- Most of the time we shouldn't need to comment/uncomment this paragraph, just change the body class -->
@ -47,7 +47,7 @@
<p class="note only-rc">This is a release candidate version of ICU4C.
It is not recommended for production use.</p>
<p>Last updated: 2020-Feb-12<br/>
<p>Last updated: 2020-Mar-25<br/>
Copyright &copy; 2016 and later: Unicode, Inc. and others. License &amp; terms of use:
<a href="http://www.unicode.org/copyright.html">http://www.unicode.org/copyright.html</a><br/>
Copyright &copy; 1997-2016 International Business Machines Corporation and others.
@ -236,10 +236,7 @@
<h2><a name="News" href="#News" id="News">What Is New In This Release?</a></h2>
<p>This release updates to Unicode 13 beta, CLDR 36.1, and includes some bug fixes.
This is a low-impact release with no other significant feature additions or implementation changes.</p>
<p>See the <a href="http://site.icu-project.org/download/66">ICU 66 download page</a>
<p>See the <a href="http://site.icu-project.org/download/67">ICU 67 download page</a>
for more information on this release, including any other changes, bug fixes, known issues,
changes to supported platforms and build environments,
and migration issues for existing applications migrating from previous ICU releases.</p>

View file

@ -74,7 +74,7 @@
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc66d.dll</OutputFile>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc67d.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\$(IcuLibOutputDir)\icuucd.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\$(IcuLibOutputDir)\icuucd.lib</ImportLibrary>
</Link>
@ -86,7 +86,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
</ClCompile>
<Link>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc66.dll</OutputFile>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc67.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\$(IcuLibOutputDir)\icuuc.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\$(IcuLibOutputDir)\icuuc.lib</ImportLibrary>
</Link>

View file

@ -129,7 +129,7 @@
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<AdditionalDependencies>vccorlib.lib;msvcrt.lib;vcruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc66.dll</OutputFile>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc67.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\$(IcuLibOutputDir)\icuuc.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\$(IcuLibOutputDir)\icuuc.lib</ImportLibrary>
</Link>
@ -152,7 +152,7 @@
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>vccorlibd.lib;msvcrtd.lib;vcruntimed.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc66d.dll</OutputFile>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc67d.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\$(IcuLibOutputDir)\icuucd.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\$(IcuLibOutputDir)\icuucd.lib</ImportLibrary>
</Link>

View file

@ -52,6 +52,8 @@
U_CAPI UBool U_EXPORT2
uprv_isASCIILetter(char c);
// NOTE: For u_asciiToUpper that takes a UChar, see ustr_imp.h
U_CAPI char U_EXPORT2
uprv_toupper(char c);

View file

@ -105,7 +105,6 @@ typedef enum ELocalePos {
U_CFUNC int32_t locale_getKeywords(const char *localeID,
char prev,
char *keywords, int32_t keywordCapacity,
char *values, int32_t valuesCapacity, int32_t *valLen,
UBool valuesToo,
UErrorCode *status);
@ -185,17 +184,16 @@ Locale *locale_set_default_internal(const char *id, UErrorCode& status) {
canonicalize = TRUE; // always canonicalize host ID
}
char localeNameBuf[512];
if (canonicalize) {
uloc_canonicalize(id, localeNameBuf, sizeof(localeNameBuf)-1, &status);
} else {
uloc_getName(id, localeNameBuf, sizeof(localeNameBuf)-1, &status);
CharString localeNameBuf;
{
CharStringByteSink sink(&localeNameBuf);
if (canonicalize) {
ulocimp_canonicalize(id, sink, &status);
} else {
ulocimp_getName(id, sink, &status);
}
}
localeNameBuf[sizeof(localeNameBuf)-1] = 0; // Force null termination in event of
// a long name filling the buffer.
// (long names are truncated.)
//
if (U_FAILURE(status)) {
return gDefaultLocale;
}
@ -209,14 +207,14 @@ Locale *locale_set_default_internal(const char *id, UErrorCode& status) {
ucln_common_registerCleanup(UCLN_COMMON_LOCALE, locale_cleanup);
}
Locale *newDefault = (Locale *)uhash_get(gDefaultLocalesHashT, localeNameBuf);
Locale *newDefault = (Locale *)uhash_get(gDefaultLocalesHashT, localeNameBuf.data());
if (newDefault == NULL) {
newDefault = new Locale(Locale::eBOGUS);
if (newDefault == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return gDefaultLocale;
}
newDefault->init(localeNameBuf, FALSE);
newDefault->init(localeNameBuf.data(), FALSE);
uhash_put(gDefaultLocalesHashT, (char*) newDefault->getName(), newDefault, &status);
if (U_FAILURE(status)) {
return gDefaultLocale;
@ -724,7 +722,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
if (U_SUCCESS(status)) {
CharString newVar;
if (begin != variants) {
newVar.append(variants, begin - variants - 1, status);
newVar.append(variants, static_cast<int32_t>(begin - variants - 1), status);
}
if (end != nullptr) {
if (begin != variants) {
@ -1428,7 +1426,7 @@ Locale::createKeywords(UErrorCode &status) const
const char* assignment = uprv_strchr(fullName, '=');
if(variantStart) {
if(assignment > variantStart) {
int32_t keyLen = locale_getKeywords(variantStart+1, '@', keywords, keywordCapacity, NULL, 0, NULL, FALSE, &status);
int32_t keyLen = locale_getKeywords(variantStart+1, '@', keywords, keywordCapacity, FALSE, &status);
if(U_SUCCESS(status) && keyLen) {
result = new KeywordEnumeration(keywords, keyLen, 0, status);
if (!result) {
@ -1457,7 +1455,7 @@ Locale::createUnicodeKeywords(UErrorCode &status) const
const char* assignment = uprv_strchr(fullName, '=');
if(variantStart) {
if(assignment > variantStart) {
int32_t keyLen = locale_getKeywords(variantStart+1, '@', keywords, keywordCapacity, NULL, 0, NULL, FALSE, &status);
int32_t keyLen = locale_getKeywords(variantStart+1, '@', keywords, keywordCapacity, FALSE, &status);
if(U_SUCCESS(status) && keyLen) {
result = new UnicodeKeywordEnumeration(keywords, keyLen, 0, status);
if (!result) {

View file

@ -234,7 +234,7 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
ptrdiff_t pointerAdjustment = aligned_p - p;
if (bufferSizeNeeded + pointerAdjustment <= stackBufferSize) {
stackBuffer = reinterpret_cast<void *>(aligned_p);
stackBufferSize -= pointerAdjustment;
stackBufferSize -= static_cast<int32_t>(pointerAdjustment);
} else {
/* prevent using the stack buffer but keep the size > 0 so that we do not just preflight */
stackBufferSize = 1;

View file

@ -30,10 +30,14 @@
l = lang, C = ctry, M = charmap, V = variant
*/
#include "unicode/bytestream.h"
#include "unicode/errorcode.h"
#include "unicode/stringpiece.h"
#include "unicode/utypes.h"
#include "unicode/ustring.h"
#include "unicode/uloc.h"
#include "bytesinkutil.h"
#include "putilimp.h"
#include "ustr_imp.h"
#include "ulocimp.h"
@ -46,6 +50,7 @@
#include "uassert.h"
#include "charstr.h"
#include <algorithm>
#include <stdio.h> /* for sprintf */
U_NAMESPACE_USE
@ -59,7 +64,6 @@ U_CFUNC int32_t
locale_getKeywords(const char *localeID,
char prev,
char *keywords, int32_t keywordCapacity,
char *values, int32_t valuesCapacity, int32_t *valLen,
UBool valuesToo,
UErrorCode *status);
@ -597,11 +601,10 @@ compareKeywordStructs(const void * /*context*/, const void *left, const void *ri
return uprv_strcmp(leftString, rightString);
}
static int32_t
static void
_getKeywords(const char *localeID,
char prev,
char *keywords, int32_t keywordCapacity,
char *values, int32_t valuesCapacity, int32_t *valLen,
ByteSink& sink,
UBool valuesToo,
UErrorCode *status)
{
@ -613,8 +616,6 @@ _getKeywords(const char *localeID,
const char* equalSign = NULL;
const char* semicolon = NULL;
int32_t i = 0, j, n;
int32_t keywordsLen = 0;
int32_t valuesLen = 0;
if(prev == '@') { /* start of keyword definition */
/* we will grab pairs, trim spaces, lowercase keywords, sort and return */
@ -629,7 +630,7 @@ _getKeywords(const char *localeID,
}
if(numKeywords == maxKeywords) {
*status = U_INTERNAL_PROGRAM_ERROR;
return 0;
return;
}
equalSign = uprv_strchr(pos, '=');
semicolon = uprv_strchr(pos, ';');
@ -637,13 +638,13 @@ _getKeywords(const char *localeID,
/* ';' before '=' [foo@currency;collation=pinyin] is illegal */
if(!equalSign || (semicolon && semicolon<equalSign)) {
*status = U_INVALID_FORMAT_ERROR;
return 0;
return;
}
/* need to normalize both keyword and keyword name */
if(equalSign - pos >= ULOC_KEYWORD_BUFFER_LEN) {
/* keyword name too long for internal buffer */
*status = U_INTERNAL_PROGRAM_ERROR;
return 0;
return;
}
for(i = 0, n = 0; i < equalSign - pos; ++i) {
if (pos[i] != ' ') {
@ -654,7 +655,7 @@ _getKeywords(const char *localeID,
/* zero-length keyword is an error. */
if (n == 0) {
*status = U_INVALID_FORMAT_ERROR;
return 0;
return;
}
keywordList[numKeywords].keyword[n] = 0;
@ -669,7 +670,7 @@ _getKeywords(const char *localeID,
/* Premature end or zero-length value */
if (!*equalSign || equalSign == semicolon) {
*status = U_INVALID_FORMAT_ERROR;
return 0;
return;
}
keywordList[numKeywords].valueStart = equalSign;
@ -707,45 +708,17 @@ _getKeywords(const char *localeID,
/* Now construct the keyword part */
for(i = 0; i < numKeywords; i++) {
if(keywordsLen + keywordList[i].keywordLen + 1< keywordCapacity) {
uprv_strcpy(keywords+keywordsLen, keywordList[i].keyword);
if(valuesToo) {
keywords[keywordsLen + keywordList[i].keywordLen] = '=';
} else {
keywords[keywordsLen + keywordList[i].keywordLen] = 0;
}
}
keywordsLen += keywordList[i].keywordLen + 1;
sink.Append(keywordList[i].keyword, keywordList[i].keywordLen);
if(valuesToo) {
if(keywordsLen + keywordList[i].valueLen <= keywordCapacity) {
uprv_strncpy(keywords+keywordsLen, keywordList[i].valueStart, keywordList[i].valueLen);
}
keywordsLen += keywordList[i].valueLen;
sink.Append("=", 1);
sink.Append(keywordList[i].valueStart, keywordList[i].valueLen);
if(i < numKeywords - 1) {
if(keywordsLen < keywordCapacity) {
keywords[keywordsLen] = ';';
}
keywordsLen++;
sink.Append(";", 1);
}
}
if(values) {
if(valuesLen + keywordList[i].valueLen + 1< valuesCapacity) {
uprv_strcpy(values+valuesLen, keywordList[i].valueStart);
values[valuesLen + keywordList[i].valueLen] = 0;
}
valuesLen += keywordList[i].valueLen + 1;
} else {
sink.Append("\0", 1);
}
}
if(values) {
values[valuesLen] = 0;
if(valLen) {
*valLen = valuesLen;
}
}
return u_terminateChars(keywords, keywordCapacity, keywordsLen, status);
} else {
return 0;
}
}
@ -753,12 +726,28 @@ U_CFUNC int32_t
locale_getKeywords(const char *localeID,
char prev,
char *keywords, int32_t keywordCapacity,
char *values, int32_t valuesCapacity, int32_t *valLen,
UBool valuesToo,
UErrorCode *status) {
return _getKeywords(localeID, prev, keywords, keywordCapacity,
values, valuesCapacity, valLen, valuesToo,
status);
if (U_FAILURE(*status)) {
return 0;
}
CheckedArrayByteSink sink(keywords, keywordCapacity);
_getKeywords(localeID, prev, sink, valuesToo, status);
int32_t reslen = sink.NumberOfBytesAppended();
if (U_FAILURE(*status)) {
return reslen;
}
if (sink.Overflowed()) {
*status = U_BUFFER_OVERFLOW_ERROR;
} else {
u_terminateChars(keywords, keywordCapacity, reslen, status);
}
return reslen;
}
U_CAPI int32_t U_EXPORT2
@ -1135,26 +1124,6 @@ static int16_t _findIndex(const char* const* list, const char* key)
return -1;
}
/* count the length of src while copying it to dest; return strlen(src) */
static inline int32_t
_copyCount(char *dest, int32_t destCapacity, const char *src) {
const char *anchor;
char c;
anchor=src;
for(;;) {
if((c=*src)==0) {
return (int32_t)(src-anchor);
}
if(destCapacity<=0) {
return (int32_t)((src-anchor)+uprv_strlen(src));
}
++src;
*dest++=c;
--destCapacity;
}
}
U_CFUNC const char*
uloc_getCurrentCountryID(const char* oldID){
int32_t offset = _findIndex(DEPRECATED_COUNTRIES, oldID);
@ -1179,13 +1148,11 @@ uloc_getCurrentLanguageID(const char* oldID){
*
* TODO try to use this in Locale
*/
U_CFUNC int32_t
static CharString
ulocimp_getLanguage(const char *localeID,
char *language, int32_t languageCapacity,
const char **pEnd) {
int32_t i=0;
int32_t offset;
char lang[4]={ 0, 0, 0, 0 }; /* temporary buffer to hold language code for searching */
const char **pEnd,
UErrorCode &status) {
CharString result;
if (uprv_stricmp(localeID, "root") == 0) {
localeID += 4;
@ -1199,48 +1166,52 @@ ulocimp_getLanguage(const char *localeID,
/* if it starts with i- or x- then copy that prefix */
if(_isIDPrefix(localeID)) {
if(i<languageCapacity) {
language[i]=(char)uprv_tolower(*localeID);
}
if(i<languageCapacity) {
language[i+1]='-';
}
i+=2;
result.append((char)uprv_tolower(*localeID), status);
result.append('-', status);
localeID+=2;
}
/* copy the language as far as possible and count its length */
while(!_isTerminator(*localeID) && !_isIDSeparator(*localeID)) {
if(i<languageCapacity) {
language[i]=(char)uprv_tolower(*localeID);
}
if(i<3) {
U_ASSERT(i>=0);
lang[i]=(char)uprv_tolower(*localeID);
}
i++;
result.append((char)uprv_tolower(*localeID), status);
localeID++;
}
if(i==3) {
if(result.length()==3) {
/* convert 3 character code to 2 character code if possible *CWB*/
offset=_findIndex(LANGUAGES_3, lang);
int32_t offset = _findIndex(LANGUAGES_3, result.data());
if(offset>=0) {
i=_copyCount(language, languageCapacity, LANGUAGES[offset]);
result.clear();
result.append(LANGUAGES[offset], status);
}
}
if(pEnd!=NULL) {
*pEnd=localeID;
}
return i;
return result;
}
U_CFUNC int32_t
ulocimp_getLanguage(const char *localeID,
char *language, int32_t languageCapacity,
const char **pEnd) {
ErrorCode status;
CharString result = ulocimp_getLanguage(localeID, pEnd, status);
if (status.isFailure()) {
return 0;
}
int32_t reslen = result.length();
uprv_memcpy(language, result.data(), std::min(reslen, languageCapacity));
return reslen;
}
static CharString
ulocimp_getScript(const char *localeID,
char *script, int32_t scriptCapacity,
const char **pEnd)
{
const char **pEnd,
UErrorCode &status) {
CharString result;
int32_t idLen = 0;
if (pEnd != NULL) {
@ -1259,132 +1230,137 @@ ulocimp_getScript(const char *localeID,
if (pEnd != NULL) {
*pEnd = localeID+idLen;
}
if(idLen > scriptCapacity) {
idLen = scriptCapacity;
}
if (idLen >= 1) {
script[0]=(char)uprv_toupper(*(localeID++));
result.append((char)uprv_toupper(*(localeID++)), status);
}
for (i = 1; i < idLen; i++) {
script[i]=(char)uprv_tolower(*(localeID++));
result.append((char)uprv_tolower(*(localeID++)), status);
}
}
else {
idLen = 0;
}
return idLen;
return result;
}
U_CFUNC int32_t
ulocimp_getScript(const char *localeID,
char *script, int32_t scriptCapacity,
const char **pEnd) {
ErrorCode status;
CharString result = ulocimp_getScript(localeID, pEnd, status);
if (status.isFailure()) {
return 0;
}
int32_t reslen = result.length();
uprv_memcpy(script, result.data(), std::min(reslen, scriptCapacity));
return reslen;
}
static CharString
ulocimp_getCountry(const char *localeID,
char *country, int32_t countryCapacity,
const char **pEnd)
{
const char **pEnd,
UErrorCode &status) {
CharString result;
int32_t idLen=0;
char cnty[ULOC_COUNTRY_CAPACITY]={ 0, 0, 0, 0 };
int32_t offset;
/* copy the country as far as possible and count its length */
while(!_isTerminator(localeID[idLen]) && !_isIDSeparator(localeID[idLen])) {
if(idLen<(ULOC_COUNTRY_CAPACITY-1)) { /*CWB*/
cnty[idLen]=(char)uprv_toupper(localeID[idLen]);
}
result.append((char)uprv_toupper(localeID[idLen]), status);
idLen++;
}
/* the country should be either length 2 or 3 */
if (idLen == 2 || idLen == 3) {
UBool gotCountry = FALSE;
/* convert 3 character code to 2 character code if possible *CWB*/
if(idLen==3) {
offset=_findIndex(COUNTRIES_3, cnty);
int32_t offset = _findIndex(COUNTRIES_3, result.data());
if(offset>=0) {
idLen=_copyCount(country, countryCapacity, COUNTRIES[offset]);
gotCountry = TRUE;
}
}
if (!gotCountry) {
int32_t i = 0;
for (i = 0; i < idLen; i++) {
if (i < countryCapacity) {
country[i]=(char)uprv_toupper(localeID[i]);
}
result.clear();
result.append(COUNTRIES[offset], status);
}
}
localeID+=idLen;
} else {
idLen = 0;
result.clear();
}
if(pEnd!=NULL) {
*pEnd=localeID;
}
return idLen;
return result;
}
U_CFUNC int32_t
ulocimp_getCountry(const char *localeID,
char *country, int32_t countryCapacity,
const char **pEnd) {
ErrorCode status;
CharString result = ulocimp_getCountry(localeID, pEnd, status);
if (status.isFailure()) {
return 0;
}
int32_t reslen = result.length();
uprv_memcpy(country, result.data(), std::min(reslen, countryCapacity));
return reslen;
}
/**
* @param needSeparator if true, then add leading '_' if any variants
* are added to 'variant'
*/
static int32_t
static void
_getVariantEx(const char *localeID,
char prev,
char *variant, int32_t variantCapacity,
ByteSink& sink,
UBool needSeparator) {
int32_t i=0;
UBool hasVariant = FALSE;
/* get one or more variant tags and separate them with '_' */
if(_isIDSeparator(prev)) {
/* get a variant string after a '-' or '_' */
while(!_isTerminator(*localeID)) {
if (needSeparator) {
if (i<variantCapacity) {
variant[i] = '_';
}
++i;
sink.Append("_", 1);
needSeparator = FALSE;
}
if(i<variantCapacity) {
variant[i]=(char)uprv_toupper(*localeID);
if(variant[i]=='-') {
variant[i]='_';
}
}
i++;
char c = (char)uprv_toupper(*localeID);
if (c == '-') c = '_';
sink.Append(&c, 1);
hasVariant = TRUE;
localeID++;
}
}
/* if there is no variant tag after a '-' or '_' then look for '@' */
if(i==0) {
if(!hasVariant) {
if(prev=='@') {
/* keep localeID */
} else if((localeID=locale_getKeywordsStart(localeID))!=NULL) {
++localeID; /* point after the '@' */
} else {
return 0;
return;
}
while(!_isTerminator(*localeID)) {
if (needSeparator) {
if (i<variantCapacity) {
variant[i] = '_';
}
++i;
sink.Append("_", 1);
needSeparator = FALSE;
}
if(i<variantCapacity) {
variant[i]=(char)uprv_toupper(*localeID);
if(variant[i]=='-' || variant[i]==',') {
variant[i]='_';
}
}
i++;
char c = (char)uprv_toupper(*localeID);
if (c == '-' || c == ',') c = '_';
sink.Append(&c, 1);
localeID++;
}
}
}
return i;
static int32_t
_getVariantEx(const char *localeID,
char prev,
char *variant, int32_t variantCapacity,
UBool needSeparator) {
CheckedArrayByteSink sink(variant, variantCapacity);
_getVariantEx(localeID, prev, sink, needSeparator);
return sink.NumberOfBytesAppended();
}
static int32_t
@ -1530,7 +1506,7 @@ uloc_openKeywords(const char* localeID,
/* keywords are located after '@' */
if((tmpLocaleID = locale_getKeywordsStart(tmpLocaleID)) != NULL) {
i=locale_getKeywords(tmpLocaleID+1, '@', keywords, keywordsCapacity, NULL, 0, NULL, FALSE, status);
i=locale_getKeywords(tmpLocaleID+1, '@', keywords, keywordsCapacity, FALSE, status);
}
if(i) {
@ -1557,24 +1533,20 @@ static const char i_default[] = {'i', '-', 'd', 'e', 'f', 'a', 'u', 'l', 't'};
*
* This is the code underlying uloc_getName and uloc_canonicalize.
*/
static int32_t
static void
_canonicalize(const char* localeID,
char* result,
int32_t resultCapacity,
ByteSink& sink,
uint32_t options,
UErrorCode* err) {
int32_t j, len, fieldCount=0, scriptSize=0, variantSize=0, nameCapacity;
char localeBuffer[ULOC_FULLNAME_CAPACITY];
int32_t j, fieldCount=0, scriptSize=0, variantSize=0;
char tempBuffer[ULOC_FULLNAME_CAPACITY];
const char* origLocaleID;
const char* tmpLocaleID;
const char* keywordAssign = NULL;
const char* separatorIndicator = NULL;
char* name;
char* variant = NULL; /* pointer into name, or NULL */
if (U_FAILURE(*err)) {
return 0;
return;
}
if (_hasBCP47Extension(localeID)) {
@ -1588,77 +1560,55 @@ _canonicalize(const char* localeID,
origLocaleID=tmpLocaleID;
/* if we are doing a full canonicalization, then put results in
localeBuffer, if necessary; otherwise send them to result. */
if (/*OPTION_SET(options, _ULOC_CANONICALIZE) &&*/
(result == NULL || resultCapacity < (int32_t)sizeof(localeBuffer))) {
name = localeBuffer;
nameCapacity = (int32_t)sizeof(localeBuffer);
} else {
name = result;
nameCapacity = resultCapacity;
}
/* get all pieces, one after another, and separate with '_' */
len=ulocimp_getLanguage(tmpLocaleID, name, nameCapacity, &tmpLocaleID);
CharString tag = ulocimp_getLanguage(tmpLocaleID, &tmpLocaleID, *err);
if(len == I_DEFAULT_LENGTH && uprv_strncmp(origLocaleID, i_default, len) == 0) {
const char *d = uloc_getDefault();
len = (int32_t)uprv_strlen(d);
if (name != NULL) {
uprv_memcpy(name, d, len);
}
if (tag.length() == I_DEFAULT_LENGTH &&
uprv_strncmp(origLocaleID, i_default, I_DEFAULT_LENGTH) == 0) {
tag.clear();
tag.append(uloc_getDefault(), *err);
} else if(_isIDSeparator(*tmpLocaleID)) {
const char *scriptID;
++fieldCount;
if(len<nameCapacity) {
name[len]='_';
}
++len;
tag.append('_', *err);
scriptSize=ulocimp_getScript(tmpLocaleID+1,
(len<nameCapacity ? name+len : NULL), nameCapacity-len, &scriptID);
CharString script = ulocimp_getScript(tmpLocaleID+1, &scriptID, *err);
tag.append(script, *err);
scriptSize = script.length();
if(scriptSize > 0) {
/* Found optional script */
tmpLocaleID = scriptID;
++fieldCount;
len+=scriptSize;
if (_isIDSeparator(*tmpLocaleID)) {
/* If there is something else, then we add the _ */
if(len<nameCapacity) {
name[len]='_';
}
++len;
tag.append('_', *err);
}
}
if (_isIDSeparator(*tmpLocaleID)) {
const char *cntryID;
int32_t cntrySize = ulocimp_getCountry(tmpLocaleID+1,
(len<nameCapacity ? name+len : NULL), nameCapacity-len, &cntryID);
if (cntrySize > 0) {
CharString country = ulocimp_getCountry(tmpLocaleID+1, &cntryID, *err);
tag.append(country, *err);
if (!country.isEmpty()) {
/* Found optional country */
tmpLocaleID = cntryID;
len+=cntrySize;
}
if(_isIDSeparator(*tmpLocaleID)) {
/* If there is something else, then we add the _ if we found country before. */
if (cntrySize >= 0 && ! _isIDSeparator(*(tmpLocaleID+1)) ) {
if (!_isIDSeparator(*(tmpLocaleID+1))) {
++fieldCount;
if(len<nameCapacity) {
name[len]='_';
}
++len;
tag.append('_', *err);
}
variantSize = _getVariant(tmpLocaleID+1, *tmpLocaleID,
(len<nameCapacity ? name+len : NULL), nameCapacity-len);
variantSize = -tag.length();
{
CharStringByteSink s(&tag);
_getVariantEx(tmpLocaleID+1, *tmpLocaleID, s, FALSE);
}
variantSize += tag.length();
if (variantSize > 0) {
variant = len<nameCapacity ? name+len : NULL;
len += variantSize;
tmpLocaleID += variantSize + 1; /* skip '_' and variant */
}
}
@ -1676,10 +1626,7 @@ _canonicalize(const char* localeID,
done = TRUE;
break;
default:
if (len<nameCapacity) {
name[len] = c;
}
++len;
tag.append(c, *err);
++tmpLocaleID;
break;
}
@ -1701,10 +1648,7 @@ _canonicalize(const char* localeID,
if (c == 0) {
break;
}
if (len<nameCapacity) {
name[len] = c;
}
++len;
tag.append(c, *err);
++tmpLocaleID;
}
}
@ -1712,60 +1656,49 @@ _canonicalize(const char* localeID,
if (OPTION_SET(options, _ULOC_CANONICALIZE)) {
/* Handle @FOO variant if @ is present and not followed by = */
if (tmpLocaleID!=NULL && keywordAssign==NULL) {
int32_t posixVariantSize;
/* Add missing '_' if needed */
if (fieldCount < 2 || (fieldCount < 3 && scriptSize > 0)) {
do {
if(len<nameCapacity) {
name[len]='_';
}
++len;
tag.append('_', *err);
++fieldCount;
} while(fieldCount<2);
}
posixVariantSize = _getVariantEx(tmpLocaleID+1, '@', name+len, nameCapacity-len,
(UBool)(variantSize > 0));
int32_t posixVariantSize = -tag.length();
{
CharStringByteSink s(&tag);
_getVariantEx(tmpLocaleID+1, '@', s, (UBool)(variantSize > 0));
}
posixVariantSize += tag.length();
if (posixVariantSize > 0) {
if (variant == NULL) {
variant = name+len;
}
len += posixVariantSize;
variantSize += posixVariantSize;
}
}
/* Look up the ID in the canonicalization map */
for (j=0; j<UPRV_LENGTHOF(CANONICALIZE_MAP); j++) {
const char* id = CANONICALIZE_MAP[j].id;
int32_t n = (int32_t)uprv_strlen(id);
if (len == n && uprv_strncmp(name, id, n) == 0) {
if (n == 0 && tmpLocaleID != NULL) {
StringPiece id(CANONICALIZE_MAP[j].id);
if (tag == id) {
if (id.empty() && tmpLocaleID != NULL) {
break; /* Don't remap "" if keywords present */
}
len = _copyCount(name, nameCapacity, CANONICALIZE_MAP[j].canonicalID);
tag.clear();
tag.append(CANONICALIZE_MAP[j].canonicalID, *err);
break;
}
}
}
sink.Append(tag.data(), tag.length());
if (!OPTION_SET(options, _ULOC_STRIP_KEYWORDS)) {
if (tmpLocaleID!=NULL && keywordAssign!=NULL &&
(!separatorIndicator || separatorIndicator > keywordAssign)) {
if(len<nameCapacity) {
name[len]='@';
}
++len;
sink.Append("@", 1);
++fieldCount;
len += _getKeywords(tmpLocaleID+1, '@', (len<nameCapacity ? name+len : NULL), nameCapacity-len,
NULL, 0, NULL, TRUE, err);
_getKeywords(tmpLocaleID+1, '@', sink, TRUE, err);
}
}
if (U_SUCCESS(*err) && result != NULL && name == localeBuffer) {
uprv_strncpy(result, localeBuffer, (len > resultCapacity) ? resultCapacity : len);
}
return u_terminateChars(result, resultCapacity, len, err);
}
/* ### ID parsing API **************************************************/
@ -1950,7 +1883,34 @@ uloc_getName(const char* localeID,
int32_t nameCapacity,
UErrorCode* err)
{
return _canonicalize(localeID, name, nameCapacity, 0, err);
if (U_FAILURE(*err)) {
return 0;
}
CheckedArrayByteSink sink(name, nameCapacity);
ulocimp_getName(localeID, sink, err);
int32_t reslen = sink.NumberOfBytesAppended();
if (U_FAILURE(*err)) {
return reslen;
}
if (sink.Overflowed()) {
*err = U_BUFFER_OVERFLOW_ERROR;
} else {
u_terminateChars(name, nameCapacity, reslen, err);
}
return reslen;
}
U_STABLE void U_EXPORT2
ulocimp_getName(const char* localeID,
ByteSink& sink,
UErrorCode* err)
{
_canonicalize(localeID, sink, 0, err);
}
U_CAPI int32_t U_EXPORT2
@ -1959,7 +1919,34 @@ uloc_getBaseName(const char* localeID,
int32_t nameCapacity,
UErrorCode* err)
{
return _canonicalize(localeID, name, nameCapacity, _ULOC_STRIP_KEYWORDS, err);
if (U_FAILURE(*err)) {
return 0;
}
CheckedArrayByteSink sink(name, nameCapacity);
ulocimp_getBaseName(localeID, sink, err);
int32_t reslen = sink.NumberOfBytesAppended();
if (U_FAILURE(*err)) {
return reslen;
}
if (sink.Overflowed()) {
*err = U_BUFFER_OVERFLOW_ERROR;
} else {
u_terminateChars(name, nameCapacity, reslen, err);
}
return reslen;
}
U_STABLE void U_EXPORT2
ulocimp_getBaseName(const char* localeID,
ByteSink& sink,
UErrorCode* err)
{
_canonicalize(localeID, sink, _ULOC_STRIP_KEYWORDS, err);
}
U_CAPI int32_t U_EXPORT2
@ -1968,7 +1955,34 @@ uloc_canonicalize(const char* localeID,
int32_t nameCapacity,
UErrorCode* err)
{
return _canonicalize(localeID, name, nameCapacity, _ULOC_CANONICALIZE, err);
if (U_FAILURE(*err)) {
return 0;
}
CheckedArrayByteSink sink(name, nameCapacity);
ulocimp_canonicalize(localeID, sink, err);
int32_t reslen = sink.NumberOfBytesAppended();
if (U_FAILURE(*err)) {
return reslen;
}
if (sink.Overflowed()) {
*err = U_BUFFER_OVERFLOW_ERROR;
} else {
u_terminateChars(name, nameCapacity, reslen, err);
}
return reslen;
}
U_STABLE void U_EXPORT2
ulocimp_canonicalize(const char* localeID,
ByteSink& sink,
UErrorCode* err)
{
_canonicalize(localeID, sink, _ULOC_CANONICALIZE, err);
}
U_CAPI const char* U_EXPORT2

View file

@ -62,6 +62,21 @@ ulocimp_getCountry(const char *localeID,
char *country, int32_t countryCapacity,
const char **pEnd);
U_STABLE void U_EXPORT2
ulocimp_getName(const char* localeID,
icu::ByteSink& sink,
UErrorCode* err);
U_STABLE void U_EXPORT2
ulocimp_getBaseName(const char* localeID,
icu::ByteSink& sink,
UErrorCode* err);
U_STABLE void U_EXPORT2
ulocimp_canonicalize(const char* localeID,
icu::ByteSink& sink,
UErrorCode* err);
/**
* Writes a well-formed language tag for this locale ID.
*

View file

@ -12,7 +12,6 @@
#include "unicode/stringpiece.h"
#include "unicode/uobject.h"
#ifndef U_HIDE_DRAFT_API
/**
* \file
* \brief C++ API: Builder API for Locale
@ -57,7 +56,7 @@ class CharString;
* UErrorCode, then track the error of the validation of the input parameter
* into the internal UErrorCode.
*
* @draft ICU 64
* @stable ICU 64
*/
class U_COMMON_API LocaleBuilder : public UObject {
public:
@ -66,13 +65,13 @@ public:
* fields, extensions, and private use information is the
* empty string.
*
* @draft ICU 64
* @stable ICU 64
*/
LocaleBuilder();
/**
* Destructor
* @draft ICU 64
* @stable ICU 64
*/
virtual ~LocaleBuilder();
@ -86,7 +85,7 @@ public:
* @param locale the locale
* @return This builder.
*
* @draft ICU 64
* @stable ICU 64
*/
LocaleBuilder& setLocale(const Locale& locale);
@ -104,7 +103,7 @@ public:
* @param tag the language tag, defined as
* [unicode_locale_id](http://www.unicode.org/reports/tr35/tr35.html#unicode_locale_id).
* @return This builder.
* @draft ICU 64
* @stable ICU 64
*/
LocaleBuilder& setLanguageTag(StringPiece tag);
@ -119,7 +118,7 @@ public:
*
* @param language the language
* @return This builder.
* @draft ICU 64
* @stable ICU 64
*/
LocaleBuilder& setLanguage(StringPiece language);
@ -135,7 +134,7 @@ public:
*
* @param script the script
* @return This builder.
* @draft ICU 64
* @stable ICU 64
*/
LocaleBuilder& setScript(StringPiece script);
@ -154,7 +153,7 @@ public:
*
* @param region the region
* @return This builder.
* @draft ICU 64
* @stable ICU 64
*/
LocaleBuilder& setRegion(StringPiece region);
@ -175,7 +174,7 @@ public:
*
* @param variant the variant
* @return This builder.
* @draft ICU 64
* @stable ICU 64
*/
LocaleBuilder& setVariant(StringPiece variant);
@ -196,7 +195,7 @@ public:
* @param key the extension key
* @param value the extension value
* @return This builder.
* @draft ICU 64
* @stable ICU 64
*/
LocaleBuilder& setExtension(char key, StringPiece value);
@ -216,7 +215,7 @@ public:
* @param key the Unicode locale key
* @param type the Unicode locale type
* @return This builder.
* @draft ICU 64
* @stable ICU 64
*/
LocaleBuilder& setUnicodeLocaleKeyword(
StringPiece key, StringPiece type);
@ -229,7 +228,7 @@ public:
*
* @param attribute the attribute
* @return This builder.
* @draft ICU 64
* @stable ICU 64
*/
LocaleBuilder& addUnicodeLocaleAttribute(StringPiece attribute);
@ -242,7 +241,7 @@ public:
*
* @param attribute the attribute
* @return This builder.
* @draft ICU 64
* @stable ICU 64
*/
LocaleBuilder& removeUnicodeLocaleAttribute(StringPiece attribute);
@ -251,7 +250,7 @@ public:
* <p>This method clears the internal UErrorCode.
*
* @return this builder
* @draft ICU 64
* @stable ICU 64
*/
LocaleBuilder& clear();
@ -260,7 +259,7 @@ public:
* Language, script, region and variant are unchanged.
*
* @return this builder
* @draft ICU 64
* @stable ICU 64
*/
LocaleBuilder& clearExtensions();
@ -275,7 +274,7 @@ public:
* the same builder to build more locales.
*
* @return a new Locale
* @draft ICU 64
* @stable ICU 64
*/
Locale build(UErrorCode& status);
@ -308,8 +307,6 @@ private:
U_NAMESPACE_END
#endif // U_HIDE_DRAFT_API
#endif /* U_SHOW_CPLUSPLUS_API */
#endif // __LOCALEBUILDER_H__

View file

@ -20,7 +20,7 @@
* \brief C++ API: Locale matcher: User's desired locales vs. application's supported locales.
*/
#ifndef U_HIDE_DRAFT_API
#ifndef U_FORCE_HIDE_DRAFT_API
/**
* Builder option for whether the language subtag or the script subtag is most important.
@ -218,6 +218,7 @@ public:
*/
Result &operator=(Result &&src) U_NOEXCEPT;
#ifndef U_HIDE_DRAFT_API
/**
* Returns the best-matching desired locale.
* nullptr if the list of desired locales is empty or if none matched well enough.
@ -272,6 +273,7 @@ public:
* @draft ICU 65
*/
Locale makeResolvedLocale(UErrorCode &errorCode) const;
#endif // U_HIDE_DRAFT_API
private:
Result(const Locale *desired, const Locale *supported,
@ -334,6 +336,7 @@ public:
*/
Builder &operator=(Builder &&src) U_NOEXCEPT;
#ifndef U_HIDE_DRAFT_API
/**
* Parses an Accept-Language string
* (<a href="https://tools.ietf.org/html/rfc2616#section-14.4">RFC 2616 Section 14.4</a>),
@ -486,6 +489,7 @@ public:
* @draft ICU 65
*/
LocaleMatcher build(UErrorCode &errorCode) const;
#endif // U_HIDE_DRAFT_API
private:
friend class LocaleMatcher;
@ -531,6 +535,7 @@ public:
*/
LocaleMatcher &operator=(LocaleMatcher &&src) U_NOEXCEPT;
#ifndef U_HIDE_DRAFT_API
/**
* Returns the supported locale which best matches the desired locale.
*
@ -598,6 +603,7 @@ public:
* @draft ICU 65
*/
Result getBestMatchResult(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const;
#endif // U_HIDE_DRAFT_API
#ifndef U_HIDE_INTERNAL_API
/**
@ -654,6 +660,6 @@ private:
U_NAMESPACE_END
#endif // U_HIDE_DRAFT_API
#endif // U_FORCE_HIDE_DRAFT_API
#endif // U_SHOW_CPLUSPLUS_API
#endif // __LOCALEMATCHER_H__

View file

@ -225,7 +225,6 @@ public:
src.ptr=NULL;
}
#ifndef U_HIDE_DRAFT_API
/**
* Constructs a LocalPointer from a C++11 std::unique_ptr.
* The LocalPointer steals the object owned by the std::unique_ptr.
@ -234,11 +233,10 @@ public:
* in a local variable, you must use std::move.
*
* @param p The std::unique_ptr from which the pointer will be stolen.
* @draft ICU 64
* @stable ICU 64
*/
explicit LocalPointer(std::unique_ptr<T> &&p)
: LocalPointerBase<T>(p.release()) {}
#endif /* U_HIDE_DRAFT_API */
/**
* Destructor deletes the object it owns.
@ -261,20 +259,18 @@ public:
return *this;
}
#ifndef U_HIDE_DRAFT_API
/**
* Move-assign from an std::unique_ptr to this LocalPointer.
* Steals the pointer from the std::unique_ptr.
*
* @param p The std::unique_ptr from which the pointer will be stolen.
* @return *this
* @draft ICU 64
* @stable ICU 64
*/
LocalPointer<T> &operator=(std::unique_ptr<T> &&p) U_NOEXCEPT {
adoptInstead(p.release());
return *this;
}
#endif /* U_HIDE_DRAFT_API */
/**
* Swap pointers.
@ -332,7 +328,6 @@ public:
}
}
#ifndef U_HIDE_DRAFT_API
/**
* Conversion operator to a C++11 std::unique_ptr.
* Disowns the object and gives it to the returned std::unique_ptr.
@ -342,12 +337,11 @@ public:
*
* @return An std::unique_ptr owning the pointer previously owned by this
* icu::LocalPointer.
* @draft ICU 64
* @stable ICU 64
*/
operator std::unique_ptr<T> () && {
return std::unique_ptr<T>(LocalPointerBase<T>::orphan());
}
#endif /* U_HIDE_DRAFT_API */
};
/**
@ -406,7 +400,6 @@ public:
src.ptr=NULL;
}
#ifndef U_HIDE_DRAFT_API
/**
* Constructs a LocalArray from a C++11 std::unique_ptr of an array type.
* The LocalPointer steals the array owned by the std::unique_ptr.
@ -415,11 +408,10 @@ public:
* in a local variable, you must use std::move.
*
* @param p The std::unique_ptr from which the array will be stolen.
* @draft ICU 64
* @stable ICU 64
*/
explicit LocalArray(std::unique_ptr<T[]> &&p)
: LocalPointerBase<T>(p.release()) {}
#endif /* U_HIDE_DRAFT_API */
/**
* Destructor deletes the array it owns.
@ -442,20 +434,18 @@ public:
return *this;
}
#ifndef U_HIDE_DRAFT_API
/**
* Move-assign from an std::unique_ptr to this LocalPointer.
* Steals the array from the std::unique_ptr.
*
* @param p The std::unique_ptr from which the array will be stolen.
* @return *this
* @draft ICU 64
* @stable ICU 64
*/
LocalArray<T> &operator=(std::unique_ptr<T[]> &&p) U_NOEXCEPT {
adoptInstead(p.release());
return *this;
}
#endif /* U_HIDE_DRAFT_API */
/**
* Swap pointers.
@ -521,7 +511,6 @@ public:
*/
T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; }
#ifndef U_HIDE_DRAFT_API
/**
* Conversion operator to a C++11 std::unique_ptr.
* Disowns the object and gives it to the returned std::unique_ptr.
@ -531,12 +520,11 @@ public:
*
* @return An std::unique_ptr owning the pointer previously owned by this
* icu::LocalPointer.
* @draft ICU 64
* @stable ICU 64
*/
operator std::unique_ptr<T[]> () && {
return std::unique_ptr<T[]>(LocalPointerBase<T>::orphan());
}
#endif /* U_HIDE_DRAFT_API */
};
/**

View file

@ -828,7 +828,7 @@ namespace std {
# define U_EXPORT
#endif
/* U_CALLCONV is releated to U_EXPORT2 */
/* U_CALLCONV is related to U_EXPORT2 */
#ifdef U_EXPORT2
/* Use the predefined value. */
#elif defined(_MSC_VER)

View file

@ -135,6 +135,7 @@
#define locale_get_default U_ICU_ENTRY_POINT_RENAME(locale_get_default)
#define locale_set_default U_ICU_ENTRY_POINT_RENAME(locale_set_default)
#define numSysCleanup U_ICU_ENTRY_POINT_RENAME(numSysCleanup)
#define rbbi_cleanup U_ICU_ENTRY_POINT_RENAME(rbbi_cleanup)
#define pl_addFontRun U_ICU_ENTRY_POINT_RENAME(pl_addFontRun)
#define pl_addLocaleRun U_ICU_ENTRY_POINT_RENAME(pl_addLocaleRun)
#define pl_addValueRun U_ICU_ENTRY_POINT_RENAME(pl_addValueRun)
@ -203,6 +204,7 @@
#define res_read U_ICU_ENTRY_POINT_RENAME(res_read)
#define res_unload U_ICU_ENTRY_POINT_RENAME(res_unload)
#define u_UCharsToChars U_ICU_ENTRY_POINT_RENAME(u_UCharsToChars)
#define u_asciiToUpper U_ICU_ENTRY_POINT_RENAME(u_asciiToUpper)
#define u_austrcpy U_ICU_ENTRY_POINT_RENAME(u_austrcpy)
#define u_austrncpy U_ICU_ENTRY_POINT_RENAME(u_austrncpy)
#define u_caseInsensitivePrefixMatch U_ICU_ENTRY_POINT_RENAME(u_caseInsensitivePrefixMatch)
@ -896,6 +898,7 @@
#define udatpg_getBestPatternWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPatternWithOptions)
#define udatpg_getDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getDateTimeFormat)
#define udatpg_getDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_getDecimal)
#define udatpg_getDefaultHourCycle U_ICU_ENTRY_POINT_RENAME(udatpg_getDefaultHourCycle)
#define udatpg_getFieldDisplayName U_ICU_ENTRY_POINT_RENAME(udatpg_getFieldDisplayName)
#define udatpg_getPatternForSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getPatternForSkeleton)
#define udatpg_getSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getSkeleton)
@ -913,6 +916,7 @@
#define udtitvfmt_close U_ICU_ENTRY_POINT_RENAME(udtitvfmt_close)
#define udtitvfmt_closeResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_closeResult)
#define udtitvfmt_format U_ICU_ENTRY_POINT_RENAME(udtitvfmt_format)
#define udtitvfmt_formatCalendarToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatCalendarToResult)
#define udtitvfmt_formatToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatToResult)
#define udtitvfmt_open U_ICU_ENTRY_POINT_RENAME(udtitvfmt_open)
#define udtitvfmt_openResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_openResult)
@ -1053,6 +1057,7 @@
#define ulistfmt_format U_ICU_ENTRY_POINT_RENAME(ulistfmt_format)
#define ulistfmt_formatStringsToResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_formatStringsToResult)
#define ulistfmt_open U_ICU_ENTRY_POINT_RENAME(ulistfmt_open)
#define ulistfmt_openForType U_ICU_ENTRY_POINT_RENAME(ulistfmt_openForType)
#define ulistfmt_openResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_openResult)
#define ulistfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ulistfmt_resultAsValue)
#define uloc_acceptLanguage U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguage)
@ -1114,9 +1119,12 @@
#define ulocdata_open U_ICU_ENTRY_POINT_RENAME(ulocdata_open)
#define ulocdata_setNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_setNoSubstitute)
#define ulocimp_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_addLikelySubtags)
#define ulocimp_canonicalize U_ICU_ENTRY_POINT_RENAME(ulocimp_canonicalize)
#define ulocimp_forLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_forLanguageTag)
#define ulocimp_getBaseName U_ICU_ENTRY_POINT_RENAME(ulocimp_getBaseName)
#define ulocimp_getCountry U_ICU_ENTRY_POINT_RENAME(ulocimp_getCountry)
#define ulocimp_getLanguage U_ICU_ENTRY_POINT_RENAME(ulocimp_getLanguage)
#define ulocimp_getName U_ICU_ENTRY_POINT_RENAME(ulocimp_getName)
#define ulocimp_getRegionForSupplementalData U_ICU_ENTRY_POINT_RENAME(ulocimp_getRegionForSupplementalData)
#define ulocimp_getScript U_ICU_ENTRY_POINT_RENAME(ulocimp_getScript)
#define ulocimp_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_minimizeSubtags)
@ -1295,7 +1303,6 @@
#define uprv_convertToPosix U_ICU_ENTRY_POINT_RENAME(uprv_convertToPosix)
#define uprv_copyAscii U_ICU_ENTRY_POINT_RENAME(uprv_copyAscii)
#define uprv_copyEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_copyEbcdic)
#define uprv_currencyLeads U_ICU_ENTRY_POINT_RENAME(uprv_currencyLeads)
#define uprv_decContextClearStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextClearStatus)
#define uprv_decContextDefault U_ICU_ENTRY_POINT_RENAME(uprv_decContextDefault)
#define uprv_decContextGetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetRounding)

View file

@ -60,7 +60,7 @@
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define U_ICU_VERSION_MAJOR_NUM 66
#define U_ICU_VERSION_MAJOR_NUM 67
/** The current ICU minor version as an integer.
* This value will change in the subsequent releases of ICU
@ -86,7 +86,7 @@
* This value will change in the subsequent releases of ICU
* @stable ICU 2.6
*/
#define U_ICU_VERSION_SUFFIX _66
#define U_ICU_VERSION_SUFFIX _67
/**
* \def U_DEF2_ICU_ENTRY_POINT_RENAME
@ -139,7 +139,7 @@
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define U_ICU_VERSION "66.1"
#define U_ICU_VERSION "67.1"
/**
* The current ICU library major version number as a string, for library name suffixes.
@ -152,13 +152,13 @@
*
* @stable ICU 2.6
*/
#define U_ICU_VERSION_SHORT "66"
#define U_ICU_VERSION_SHORT "67"
#ifndef U_HIDE_INTERNAL_API
/** Data version in ICU4C.
* @internal ICU 4.4 Internal Use Only
**/
#define U_ICU_DATA_VERSION "66.1"
#define U_ICU_DATA_VERSION "67.1"
#endif /* U_HIDE_INTERNAL_API */
/*===========================================================================

View file

@ -37,15 +37,27 @@ uprv_strCompare(const UChar *s1, int32_t length1,
const UChar *s2, int32_t length2,
UBool strncmpStyle, UBool codePointOrder);
U_CAPI int32_t U_EXPORT2
U_INTERNAL int32_t U_EXPORT2
ustr_hashUCharsN(const UChar *str, int32_t length);
U_CAPI int32_t U_EXPORT2
U_INTERNAL int32_t U_EXPORT2
ustr_hashCharsN(const char *str, int32_t length);
U_CAPI int32_t U_EXPORT2
U_INTERNAL int32_t U_EXPORT2
ustr_hashICharsN(const char *str, int32_t length);
/**
* Convert an ASCII-range lowercase character to uppercase.
*
* @param c A UChar.
* @return If UChar is a lowercase ASCII character, returns the uppercase version.
* Otherwise, returns the input character.
*/
U_INTERNAL UChar U_EXPORT2
u_asciiToUpper(UChar c);
// TODO: Add u_asciiToLower if/when there is a need for it.
/**
* NUL-terminate a UChar * string if possible.
* If length < destCapacity then NUL-terminate.
@ -58,28 +70,28 @@ ustr_hashICharsN(const char *str, int32_t length);
* @param pErrorCode ICU error code.
* @return length
*/
U_CAPI int32_t U_EXPORT2
U_INTERNAL int32_t U_EXPORT2
u_terminateUChars(UChar *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
/**
* NUL-terminate a char * string if possible.
* Same as u_terminateUChars() but for a different string type.
*/
U_CAPI int32_t U_EXPORT2
U_INTERNAL int32_t U_EXPORT2
u_terminateChars(char *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
/**
* NUL-terminate a UChar32 * string if possible.
* Same as u_terminateUChars() but for a different string type.
*/
U_CAPI int32_t U_EXPORT2
U_INTERNAL int32_t U_EXPORT2
u_terminateUChar32s(UChar32 *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
/**
* NUL-terminate a wchar_t * string if possible.
* Same as u_terminateUChars() but for a different string type.
*/
U_CAPI int32_t U_EXPORT2
U_INTERNAL int32_t U_EXPORT2
u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
/**

View file

@ -1451,6 +1451,14 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) {
} \
} UPRV_BLOCK_MACRO_END
U_CAPI UChar U_EXPORT2
u_asciiToUpper(UChar c) {
if (u'a' <= c && c <= u'z') {
c = c + u'A' - u'a';
}
return c;
}
U_CAPI int32_t U_EXPORT2
u_terminateUChars(UChar *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode) {
__TERMINATE_STRING(dest, destCapacity, length, pErrorCode);

View file

@ -105,7 +105,7 @@ ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR)
#%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
# $(RM) $@ && cp ${<F} $@
%.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO)
$(RM) $(subst cyg,lib,$@).$(A) && ln -s $(subst cyg,lib,${<F}).$(A) $(subst cyg,lib,$@).$(A)
ln -fs $(subst cyg,lib,${<F}).$(A) $(subst cyg,lib,$@).$(A)
## Install libraries as executable
INSTALL-L=$(INSTALL_PROGRAM)

View file

@ -105,7 +105,7 @@ ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR)
#%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
# $(RM) $@ && cp ${<F} $@
%.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO)
$(RM) $(subst cyg,lib,$@).$(A) && ln -s $(subst cyg,lib,${<F}).$(A) $(subst cyg,lib,$@).$(A)
ln -fs $(subst cyg,lib,${<F}).$(A) $(subst cyg,lib,$@).$(A)
## Install libraries as executable
INSTALL-L=$(INSTALL_PROGRAM)

View file

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for ICU 66.1.
# Generated by GNU Autoconf 2.69 for ICU 67.1.
#
# Report bugs to <http://icu-project.org/bugs>.
#
@ -582,8 +582,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ICU'
PACKAGE_TARNAME='International Components for Unicode'
PACKAGE_VERSION='66.1'
PACKAGE_STRING='ICU 66.1'
PACKAGE_VERSION='67.1'
PACKAGE_STRING='ICU 67.1'
PACKAGE_BUGREPORT='http://icu-project.org/bugs'
PACKAGE_URL='http://icu-project.org'
@ -1364,7 +1364,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures ICU 66.1 to adapt to many kinds of systems.
\`configure' configures ICU 67.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1430,7 +1430,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of ICU 66.1:";;
short | recursive ) echo "Configuration of ICU 67.1:";;
esac
cat <<\_ACEOF
@ -1568,7 +1568,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
ICU configure 66.1
ICU configure 67.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -2314,7 +2314,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by ICU $as_me 66.1, which was
It was created by ICU $as_me 67.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -8544,7 +8544,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by ICU $as_me 66.1, which was
This file was extended by ICU $as_me 67.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -8598,7 +8598,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
ICU config.status 66.1
ICU config.status 67.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View file

@ -38,10 +38,6 @@ su{
"$",
"Dolar A.S.",
}
XXX{
"¤",
"-",
}
}
Currencies%narrow{
BRL{"R$"}
@ -82,9 +78,6 @@ su{
USD{
other{"dolar A.S."}
}
XXX{
other{"-"}
}
}
CurrencyUnitPatterns{
other{"{0} {1}"}

View file

@ -12,11 +12,11 @@
##############################################################################
# Keep the following in sync with the version - see common/unicode/uvernum.h
U_ICUDATA_NAME=icudt66
U_ICUDATA_NAME=icudt67
##############################################################################
!IF "$(UWP)" == "UWP"
# Optionally change the name of the data file for the UWP version.
U_ICUDATA_NAME=icudt66
U_ICUDATA_NAME=icudt67
!ENDIF
U_ICUDATA_ENDIAN_SUFFIX=l
UNICODE_VERSION=13.0

View file

@ -8,6 +8,6 @@
// ***************************************************************************
icuver:table(nofallback){
DataVersion { "66.1.0.0" }
ICUVersion { "66.1.0.0" }
DataVersion { "67.1.0.0" }
ICUVersion { "67.1.0.0" }
}

View file

@ -2436,15 +2436,15 @@ f93702e439e53be83d
} // lsrs
} // likely
match{
trie:bin{ // BytesTrie: 2630 bytes
trie:bin{ // BytesTrie: 2627 bytes
00196ec41e74c1b077c0ca77a28078a2
8a79a29a7a036c346daa8ee834f51165
ee5d12ed6df335117ae820022a854834
4c166174ee48616ef34911616e02e99e
f3a245f41248616e01f347f42007b314
b32ab426b536b605b3c8a6b329b429b6
2910b5292a2bb026b122b205b3c892b3
29b429b62905b3c888b329b429b62912
b32ab426b536b605b3c8a3b329b429b6
2910b5292a2bb026b122b205b3c88fb3
29b429b62905b3c885b329b429b62912
48616e01f349f4491348616ef43f0175
2aef1166f25d12f57ae835016d2ae811
65ee5d02eda241f622f7116de7350369
@ -2471,9 +2471,9 @@ f375fa35117ae84971c16171a2ac72a4
4c6174ee2be832e942ee22ef1165ee5d
0262ac2768227310f2291165ee5c012a
855316696ee84c6174ee35702e705272
58735ee1b0ade41165ee5c012a854116
58735ee1b0aae41165ee5c012a854116
7261e24c6174ee3512f66ff23512ef73
e33501e8aef2f91161e1296434674068
e33501e8aeeff91161e1296434674068
486b12e76de73501e322ee1173e33513
e36b6cee3512f561f23504753a769077
a26478a26df51165f35d0cec16f30bf3
@ -2487,9 +2487,9 @@ f5350aef14f409f426f522f71171f535
ef26f022f21171f535e12ee32ae826ec
22ee1171f5351171f5350361a80aed30
eea285f71166f25d1164e5496ea26f6f
a2d370086b4d6bac06735ae168f386f4
1170f4a28007b3c48cb3aa90b4aa8db5
aa8ab601b129b62901e5a2d3f41170f3
a2d370086b4d6bac03735ae168f386f4
1170f4a28007b3c4c2b3aac6b4aac3b5
aac0b601b129b62901e5a2d3f41170f3
351165ee5c012a8547167572f54c6174
ee351165ee5c012a8541167261e24c61
74ee356234633a65406712e161f23512
@ -2500,7 +2500,7 @@ f470f33512ed65ee4912ec6df3350a79
01e4a66eee1165ee5d01642c6e01ee49
ef2310e13161a8756834693a6c427312
ef65ee5d12e467ee3513f16b6cee3513
e56c75f935046b54725ce3acfeeda2dd
e56c75f935046b54725ce3acfbeda2dd
f21165ee5c012a854f167279e14c6174
ee3513e96b6cee3502e3a6c6ee22f311
6df33567c32c6ac2486aa2b56ba40d6c
@ -2512,7 +2512,7 @@ e7a448e9a60aec0165426d10ec20012a
854c166174ee4d6c79ed4910ee5c012a
854d166c79ed4c6174ee3512e66dee35
6e1f6e34713a73407512e96df33512f0
7ae83512e76df33501e8ac69e9116df3
7ae83512e76df33501e8ac66e9116df3
356134653a66406912ee6df33512f86d
f33512ef6df33502e14ae246e51165ee
5d02612ee13af61169e44901eb22f811
@ -2524,7 +2524,7 @@ e10148464a127061ee2b12616ee10148
36ef2ef57cf91172f55d116bef20022a
8548464a12616def01482c4b126f72e5
2b12616ee72b11616e01e722e9134b6f
72e52b1174f25deba89aed6aee016542
72e52b1174f25deba897ed6aee016542
6b10ee20012a854c166174ee4b6e64e1
4910ee5c012a854b166e64e14c6174ee
351165ee5c012a854b16686df24c6174
@ -2540,68 +2540,68 @@ ee350e753ee221e24ee7a29dee4cef11
01e922ed126c75f93513ed6c75f93563
4669526b02e226ef22f3126c75f93512
6c75f93501e522e6116df33512f76df3
35676a68a2816905e40ae4a88fe734f3
35676a68a2816905e40ae4a88ce734f3
1165ee49642e6b36e11165ee5d13e16c
75f93512f469f5350a7531ec1eeca40d
eea40af50167286810e95d10f520012a
854c166174ee47756af249752ee122e4
1165ee4901e922ee1167ee3561386b4c
6e546f5a7312f764e52902e1a257eea4
6ef8116fed3513f06b70e53512f767ee
6bf8116fed3513f06b70e53512f767ee
3513ed6b6feb3507e934e94ef26cf4a6
faf91172f55c012a854116726dee4379
f7f91172f55c012a854116726dee4379
72ec351168e920012a854c166174ee44
6576e1490162287310e82910f3296132
6a4c7352e11165ee5d02e530eba410f7
6a4c7352e11165ee5d02e530eba40df7
1165ee49116fed3512e96df33512ee7a
e83564c0e0648865a248660366327538
e83564c0dd648865a248660366327538
ef6af9116eec4912ed66e63506e80be8
2ae926f122f61166e635e226e522e611
66e6351166e6351164e149027434753a
e1106e01e231ef3112f96ee53512f06d
f33507ef46efa468f32ef496f51165f3
491165f3a28007b30cb342b43eb53ab6
01b129b6292a2bb026b14eb204b029b2
29b329b429b52904b029b229b329b429
b52901b129b6291166e95d6e9879a0e5
a41eee1165eea28007b317b362b430b5
5ab601b229b62904b027b127b327b427
b5272a2bb030b12cb201b229b62904b0
29b129b329b427b52913e26b6cee3513
ef6b6cee3561a25662a482630a6f2c7a
167a30efa4b5f91165ee4901e822ef11
7ae835117ae8356f3070367212f366f2
4912e16df33512f87ae8356438653e68
466a4c6b12e261f25d12ef7ae83513e2
6669ec5d12f265ee4912f97ae8350015
75afe288f275f24af9a26cfa1172f55c
012a854c166174ee437972ec351161f2
20012a5a4c166174ee417261e24807b3
27b364b426b522b605b436b429b529b6
298407b313b33cb426b522b605b422b4
29b529b62910b3292a2bb026b122b205
b40fb429b529b62905b406b429b529b6
29b029b129b2291165f349e22ee632eb
1165ee5d1172f55d116eec4975a41d76
34793a7a4ee1127373f92912ec61f235
03e82aec26ee22f01161f23512e261fa
3566356c1e6c3e70447203f12af326f9
22fa1161f23512ee73f13501e322e411
61f235663069366a12f061f23512e261
f23513e97379f235613e624e635a6490
6501e222e31161f23502e526ef32f411
73f13501e822f61161f23505f709f726
f822f91161f235e82eed22f11161f235
1165ee5d1161f23512e661f2350c7655
e83de83eee42f286f30168287310e829
10f2291168e95d0162426510ee5c012a
854216656ee74c6174ee3510ee20012a
854c166174ee42656ee7491166f24976
2e7a3ae51172f54901e522f5116df335
12e36de7356a1b6a306d447412ea6df3
3501ee2af1116de735116df33512ed6d
e735623065366812f26de73512fa61f2
3512ed65ee5d
f33506ee78ee34efa278f396f51165f3
491165eea28007b317b362b430b55ab6
01b229b62904b027b127b327b427b527
2a2bb030b12cb201b229b62904b029b1
29b329b427b5291165f3a28007b30cb3
42b43eb53ab601b129b6292a2bb026b1
4eb204b029b229b329b429b52904b029
b229b329b429b52901b129b6296e2e79
36e51165ee5d13e26b6cee3513ef6b6c
ee3561a25662a482630a6f2c7a167a30
efa4b5f91165ee4901e822ef117ae835
117ae8356f3070367212f366f24912e1
6df33512f87ae8356438653e68466a4c
6b12e261f25d12ef7ae83513e26669ec
5d12f265ee4912f97ae835001575afe2
88f275f24af9a26cfa1172f55c012a85
4c166174ee437972ec351161f220012a
5a4c166174ee417261e24807b327b364
b426b522b605b436b429b529b6298407
b313b33cb426b522b605b422b429b529
b62910b3292a2bb026b122b205b40fb4
29b529b62905b406b429b529b629b029
b129b2291165f349e22ee632eb1165ee
5d1172f55d116eec4975a41d7634793a
7a4ee1127373f92912ec61f23503e82a
ec26ee22f01161f23512e261fa356635
6c1e6c3e70447203f12af326f922fa11
61f23512ee73f13501e322e41161f235
663069366a12f061f23512e261f23513
e97379f235613e624e635a64906501e2
22e31161f23502e526ef32f41173f135
01e822f61161f23505f709f726f822f9
1161f235e82eed22f11161f2351165ee
5d1161f23512e661f2350c7655e83de8
3eee42f286f30168287310e82910f229
1168e95d0162426510ee5c012a854216
656ee74c6174ee3510ee20012a854c16
6174ee42656ee7491166f249762e7a3a
e51172f54901e522f5116df33512e36d
e7356a1b6a306d447412ea6df33501ee
2af1116de735116df33512ed6de73562
3065366812f26de73512fa61f23512ed
65ee5d
} // trie
regionToPartitions:bin{ // 1677 bytes
000008090a00020000000b0009000201

View file

@ -18393,12 +18393,6 @@ supplementalData:table(nofallback){
"30",
"1",
}
{
"et",
"fi",
"30",
"1",
}
{
"eu",
"es",

View file

@ -16,9 +16,11 @@
#include "unicode/currunit.h"
#include "unicode/ustring.h"
#include "unicode/uchar.h"
#include "cstring.h"
#include "uinvchar.h"
#include "charstr.h"
#include "ustr_imp.h"
#include "measunit_impl.h"
U_NAMESPACE_BEGIN
@ -29,22 +31,25 @@ CurrencyUnit::CurrencyUnit(ConstChar16Ptr _isoCode, UErrorCode& ec) {
// non-NUL-terminated string to be passed as an argument, so it is not possible to check length.
// However, we allow a NUL-terminated empty string, which should have the same behavior as nullptr.
// Consider NUL-terminated strings of length 1 or 2 as invalid.
const char16_t* isoCodeToUse;
bool useDefault = false;
if (U_FAILURE(ec) || _isoCode == nullptr || _isoCode[0] == 0) {
isoCodeToUse = kDefaultCurrency;
useDefault = true;
} else if (_isoCode[1] == 0 || _isoCode[2] == 0) {
isoCodeToUse = kDefaultCurrency;
useDefault = true;
ec = U_ILLEGAL_ARGUMENT_ERROR;
} else if (!uprv_isInvariantUString(_isoCode, 3)) {
// TODO: Perform a more strict ASCII check like in ICU4J isAlpha3Code?
isoCodeToUse = kDefaultCurrency;
useDefault = true;
ec = U_INVARIANT_CONVERSION_ERROR;
} else {
isoCodeToUse = _isoCode;
for (int32_t i=0; i<3; i++) {
isoCode[i] = u_asciiToUpper(_isoCode[i]);
}
isoCode[3] = 0;
}
if (useDefault) {
uprv_memcpy(isoCode, kDefaultCurrency, sizeof(UChar) * 4);
}
// TODO: Perform uppercasing here like in ICU4J Currency.getInstance()?
uprv_memcpy(isoCode, isoCodeToUse, sizeof(UChar) * 3);
isoCode[3] = 0;
char simpleIsoCode[4];
u_UCharsToChars(isoCode, simpleIsoCode, 4);
initCurrency(simpleIsoCode);
@ -64,13 +69,13 @@ CurrencyUnit::CurrencyUnit(StringPiece _isoCode, UErrorCode& ec) {
ec = U_INVARIANT_CONVERSION_ERROR;
} else {
// Have to use isoCodeBuffer to ensure the string is NUL-terminated
uprv_strncpy(isoCodeBuffer, _isoCode.data(), 3);
for (int32_t i=0; i<3; i++) {
isoCodeBuffer[i] = uprv_toupper(_isoCode.data()[i]);
}
isoCodeBuffer[3] = 0;
isoCodeToUse = isoCodeBuffer;
}
// TODO: Perform uppercasing here like in ICU4J Currency.getInstance()?
u_charsToUChars(isoCodeToUse, isoCode, 3);
isoCode[3] = 0;
u_charsToUChars(isoCodeToUse, isoCode, 4);
initCurrency(isoCodeToUse);
}

View file

@ -519,7 +519,9 @@ UnicodeString& DecimalFormat::format(double number, UnicodeString& appendTo, Fie
return appendTo;
}
UErrorCode localStatus = U_ZERO_ERROR;
FormattedNumber output = fields->formatter.formatDouble(number, localStatus);
UFormattedNumberData output;
output.quantity.setToDouble(number);
fields->formatter.formatImpl(&output, localStatus);
fieldPositionHelper(output, pos, appendTo.length(), localStatus);
auto appendable = UnicodeStringAppendable(appendTo);
output.appendTo(appendable, localStatus);
@ -540,7 +542,9 @@ UnicodeString& DecimalFormat::format(double number, UnicodeString& appendTo, Fie
if (pos.getField() == FieldPosition::DONT_CARE && fastFormatDouble(number, appendTo)) {
return appendTo;
}
FormattedNumber output = fields->formatter.formatDouble(number, status);
UFormattedNumberData output;
output.quantity.setToDouble(number);
fields->formatter.formatImpl(&output, status);
fieldPositionHelper(output, pos, appendTo.length(), status);
auto appendable = UnicodeStringAppendable(appendTo);
output.appendTo(appendable, status);
@ -562,7 +566,9 @@ DecimalFormat::format(double number, UnicodeString& appendTo, FieldPositionItera
if (posIter == nullptr && fastFormatDouble(number, appendTo)) {
return appendTo;
}
FormattedNumber output = fields->formatter.formatDouble(number, status);
UFormattedNumberData output;
output.quantity.setToDouble(number);
fields->formatter.formatImpl(&output, status);
fieldPositionIteratorHelper(output, posIter, appendTo.length(), status);
auto appendable = UnicodeStringAppendable(appendTo);
output.appendTo(appendable, status);
@ -593,7 +599,9 @@ UnicodeString& DecimalFormat::format(int64_t number, UnicodeString& appendTo, Fi
return appendTo;
}
UErrorCode localStatus = U_ZERO_ERROR;
FormattedNumber output = fields->formatter.formatInt(number, localStatus);
UFormattedNumberData output;
output.quantity.setToLong(number);
fields->formatter.formatImpl(&output, localStatus);
fieldPositionHelper(output, pos, appendTo.length(), localStatus);
auto appendable = UnicodeStringAppendable(appendTo);
output.appendTo(appendable, localStatus);
@ -614,7 +622,9 @@ UnicodeString& DecimalFormat::format(int64_t number, UnicodeString& appendTo, Fi
if (pos.getField() == FieldPosition::DONT_CARE && fastFormatInt64(number, appendTo)) {
return appendTo;
}
FormattedNumber output = fields->formatter.formatInt(number, status);
UFormattedNumberData output;
output.quantity.setToLong(number);
fields->formatter.formatImpl(&output, status);
fieldPositionHelper(output, pos, appendTo.length(), status);
auto appendable = UnicodeStringAppendable(appendTo);
output.appendTo(appendable, status);
@ -636,7 +646,9 @@ DecimalFormat::format(int64_t number, UnicodeString& appendTo, FieldPositionIter
if (posIter == nullptr && fastFormatInt64(number, appendTo)) {
return appendTo;
}
FormattedNumber output = fields->formatter.formatInt(number, status);
UFormattedNumberData output;
output.quantity.setToLong(number);
fields->formatter.formatImpl(&output, status);
fieldPositionIteratorHelper(output, posIter, appendTo.length(), status);
auto appendable = UnicodeStringAppendable(appendTo);
output.appendTo(appendable, status);
@ -655,7 +667,9 @@ DecimalFormat::format(StringPiece number, UnicodeString& appendTo, FieldPosition
appendTo.setToBogus();
return appendTo;
}
FormattedNumber output = fields->formatter.formatDecimal(number, status);
UFormattedNumberData output;
output.quantity.setToDecNumber(number, status);
fields->formatter.formatImpl(&output, status);
fieldPositionIteratorHelper(output, posIter, appendTo.length(), status);
auto appendable = UnicodeStringAppendable(appendTo);
output.appendTo(appendable, status);
@ -673,7 +687,9 @@ UnicodeString& DecimalFormat::format(const DecimalQuantity& number, UnicodeStrin
appendTo.setToBogus();
return appendTo;
}
FormattedNumber output = fields->formatter.formatDecimalQuantity(number, status);
UFormattedNumberData output;
output.quantity = number;
fields->formatter.formatImpl(&output, status);
fieldPositionIteratorHelper(output, posIter, appendTo.length(), status);
auto appendable = UnicodeStringAppendable(appendTo);
output.appendTo(appendable, status);
@ -692,7 +708,9 @@ DecimalFormat::format(const DecimalQuantity& number, UnicodeString& appendTo, Fi
appendTo.setToBogus();
return appendTo;
}
FormattedNumber output = fields->formatter.formatDecimalQuantity(number, status);
UFormattedNumberData output;
output.quantity = number;
fields->formatter.formatImpl(&output, status);
fieldPositionHelper(output, pos, appendTo.length(), status);
auto appendable = UnicodeStringAppendable(appendTo);
output.appendTo(appendable, status);
@ -1703,8 +1721,11 @@ const numparse::impl::NumberParserImpl* DecimalFormat::getCurrencyParser(UErrorC
}
void
DecimalFormat::fieldPositionHelper(const number::FormattedNumber& formatted, FieldPosition& fieldPosition,
int32_t offset, UErrorCode& status) {
DecimalFormat::fieldPositionHelper(
const UFormattedNumberData& formatted,
FieldPosition& fieldPosition,
int32_t offset,
UErrorCode& status) {
if (U_FAILURE(status)) { return; }
// always return first occurrence:
fieldPosition.setBeginIndex(0);
@ -1717,12 +1738,15 @@ DecimalFormat::fieldPositionHelper(const number::FormattedNumber& formatted, Fie
}
void
DecimalFormat::fieldPositionIteratorHelper(const number::FormattedNumber& formatted, FieldPositionIterator* fpi,
int32_t offset, UErrorCode& status) {
DecimalFormat::fieldPositionIteratorHelper(
const UFormattedNumberData& formatted,
FieldPositionIterator* fpi,
int32_t offset,
UErrorCode& status) {
if (U_SUCCESS(status) && (fpi != nullptr)) {
FieldPositionIteratorHandler fpih(fpi, status);
fpih.setShift(offset);
formatted.getAllFieldPositionsImpl(fpih, status);
formatted.getAllFieldPositions(fpih, status);
}
}

View file

@ -59,6 +59,7 @@ class Double {
static const uint64_t kExponentMask = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF00000, 00000000);
static const uint64_t kSignificandMask = DOUBLE_CONVERSION_UINT64_2PART_C(0x000FFFFF, FFFFFFFF);
static const uint64_t kHiddenBit = DOUBLE_CONVERSION_UINT64_2PART_C(0x00100000, 00000000);
static const uint64_t kQuietNanBit = DOUBLE_CONVERSION_UINT64_2PART_C(0x00080000, 00000000);
static const int kPhysicalSignificandSize = 52; // Excludes the hidden bit.
static const int kSignificandSize = 53;
static const int kExponentBias = 0x3FF + kPhysicalSignificandSize;
@ -162,6 +163,15 @@ class Double {
((d64 & kSignificandMask) != 0);
}
bool IsQuietNan() const {
return IsNan() && ((AsUint64() & kQuietNanBit) != 0);
}
bool IsSignalingNan() const {
return IsNan() && ((AsUint64() & kQuietNanBit) == 0);
}
bool IsInfinite() const {
uint64_t d64 = AsUint64();
return ((d64 & kExponentMask) == kExponentMask) &&
@ -280,6 +290,7 @@ class Single {
static const uint32_t kExponentMask = 0x7F800000;
static const uint32_t kSignificandMask = 0x007FFFFF;
static const uint32_t kHiddenBit = 0x00800000;
static const uint32_t kQuietNanBit = 0x00400000;
static const int kPhysicalSignificandSize = 23; // Excludes the hidden bit.
static const int kSignificandSize = 24;
@ -338,6 +349,15 @@ class Single {
((d32 & kSignificandMask) != 0);
}
bool IsQuietNan() const {
return IsNan() && ((AsUint32() & kQuietNanBit) != 0);
}
bool IsSignalingNan() const {
return IsNan() && ((AsUint32() & kQuietNanBit) == 0);
}
bool IsInfinite() const {
uint32_t d32 = AsUint32();
return ((d32 & kExponentMask) == kExponentMask) &&

View file

@ -462,11 +462,6 @@ double StringToDoubleConverter::StringToIeee(
}
}
// The longest form of simplified number is: "-<significant digits>.1eXXX\0".
const int kBufferSize = kMaxSignificantDigits + 10;
char buffer[kBufferSize]; // NOLINT: size is known at compile time.
int buffer_pos = 0;
// Exponent will be adjusted if insignificant digits of the integer part
// or insignificant leading zeros of the fractional part are dropped.
int exponent = 0;
@ -501,7 +496,6 @@ double StringToDoubleConverter::StringToIeee(
return junk_string_value_;
}
DOUBLE_CONVERSION_ASSERT(buffer_pos == 0);
*processed_characters_count = static_cast<int>(current - input);
return sign ? -Double::Infinity() : Double::Infinity();
}
@ -520,7 +514,6 @@ double StringToDoubleConverter::StringToIeee(
return junk_string_value_;
}
DOUBLE_CONVERSION_ASSERT(buffer_pos == 0);
*processed_characters_count = static_cast<int>(current - input);
return sign ? -Double::NaN() : Double::NaN();
}
@ -577,6 +570,12 @@ double StringToDoubleConverter::StringToIeee(
bool octal = leading_zero && (flags_ & ALLOW_OCTALS) != 0;
// The longest form of simplified number is: "-<significant digits>.1eXXX\0".
const int kBufferSize = kMaxSignificantDigits + 10;
DOUBLE_CONVERSION_STACK_UNINITIALIZED char
buffer[kBufferSize]; // NOLINT: size is known at compile time.
int buffer_pos = 0;
// Copy significant digits of the integer part (if any) to the buffer.
while (*current >= '0' && *current <= '9') {
if (significant_digits < kMaxSignificantDigits) {

View file

@ -49,10 +49,12 @@ U_NAMESPACE_BEGIN
namespace double_conversion {
#if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
// 2^53 = 9007199254740992.
// Any integer with at most 15 decimal digits will hence fit into a double
// (which has a 53bit significand) without loss of precision.
static const int kMaxExactDoubleIntegerDecimalDigits = 15;
#endif // #if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
// 2^64 = 18446744073709551616 > 10^19
static const int kMaxUint64DecimalDigits = 19;
@ -69,6 +71,7 @@ static const int kMinDecimalPower = -324;
static const uint64_t kMaxUint64 = DOUBLE_CONVERSION_UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF);
#if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
static const double exact_powers_of_ten[] = {
1.0, // 10^0
10.0,
@ -96,6 +99,7 @@ static const double exact_powers_of_ten[] = {
10000000000000000000000.0
};
static const int kExactPowersOfTenSize = DOUBLE_CONVERSION_ARRAY_SIZE(exact_powers_of_ten);
#endif // #if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
// Maximum number of significant digits in the decimal representation.
// In fact the value is 772 (see conversions.cc), but to give us some margin

View file

@ -74,6 +74,12 @@ inline void abort_noreturn() { abort(); }
#endif
#endif
#if defined(__clang__) && __has_attribute(uninitialized)
#define DOUBLE_CONVERSION_STACK_UNINITIALIZED __attribute__((uninitialized))
#else
#define DOUBLE_CONVERSION_STACK_UNINITIALIZED
#endif
// Double operations detection based on target architecture.
// Linux uses a 80bit wide floating point stack on x86. This induces double
// rounding, which in turn leads to wrong results.
@ -104,6 +110,7 @@ int main(int argc, char** argv) {
defined(__ARMEL__) || defined(__avr32__) || defined(_M_ARM) || defined(_M_ARM64) || \
defined(__hppa__) || defined(__ia64__) || \
defined(__mips__) || \
defined(__nios2__) || \
defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \
defined(_POWER) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \
defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
@ -112,7 +119,8 @@ int main(int argc, char** argv) {
defined(__AARCH64EL__) || defined(__aarch64__) || defined(__AARCH64EB__) || \
defined(__riscv) || defined(__e2k__) || \
defined(__or1k__) || defined(__arc__) || \
defined(__EMSCRIPTEN__)
defined(__microblaze__) || defined(__XTENSA__) || \
defined(__EMSCRIPTEN__) || defined(__wasm32__)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(__mc68000__) || \
defined(__pnacl__) || defined(__native_client__)

View file

@ -2197,6 +2197,11 @@ DateTimeMatcher::DateTimeMatcher(const DateTimeMatcher& other) {
copyFrom(other.skeleton);
}
DateTimeMatcher& DateTimeMatcher::operator=(const DateTimeMatcher& other) {
copyFrom(other.skeleton);
return *this;
}
void
DateTimeMatcher::set(const UnicodeString& pattern, FormatParser* fp) {

View file

@ -238,6 +238,7 @@ public:
int32_t getDistance(const DateTimeMatcher& other, int32_t includeMask, DistanceInfo& distanceInfo) const;
DateTimeMatcher();
DateTimeMatcher(const DateTimeMatcher& other);
DateTimeMatcher& operator=(const DateTimeMatcher& other);
virtual ~DateTimeMatcher();
int32_t getFieldMask() const;
};

View file

@ -62,8 +62,9 @@ class FieldPositionOnlyHandler : public FieldPositionHandler {
// utility subclass FieldPositionIteratorHandler
// exported as U_I18N_API for tests
class FieldPositionIteratorHandler : public FieldPositionHandler {
class U_I18N_API FieldPositionIteratorHandler : public FieldPositionHandler {
FieldPositionIterator* iter; // can be NULL
UVector32* vec;
UErrorCode status;

View file

@ -76,7 +76,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>icuucd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\$(IcuBinOutputDir)\icuin66d.dll</OutputFile>
<OutputFile>..\..\$(IcuBinOutputDir)\icuin67d.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\$(IcuLibOutputDir)\icuind.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\$(IcuLibOutputDir)\icuind.lib</ImportLibrary>
</Link>
@ -89,7 +89,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>icuuc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\$(IcuBinOutputDir)\icuin66.dll</OutputFile>
<OutputFile>..\..\$(IcuBinOutputDir)\icuin67.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\$(IcuLibOutputDir)\icuin.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\$(IcuLibOutputDir)\icuin.lib</ImportLibrary>
</Link>

View file

@ -190,7 +190,7 @@
<ProgramDataBaseFileName>.\x86\ReleaseUWP/</ProgramDataBaseFileName>
</ClCompile>
<Link>
<OutputFile>..\..\bin32uwp\icuin66.dll</OutputFile>
<OutputFile>..\..\bin32uwp\icuin67.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\lib32uwp\icuin.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\lib32uwp\icuin.lib</ImportLibrary>
<AdditionalDependencies>..\..\lib32uwp\icuuc.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -207,7 +207,7 @@
<ProgramDataBaseFileName>.\x86\DebugUWP/</ProgramDataBaseFileName>
</ClCompile>
<Link>
<OutputFile>..\..\bin32uwp\icuin66d.dll</OutputFile>
<OutputFile>..\..\bin32uwp\icuin67d.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\lib32uwp\icuind.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\lib32uwp\icuind.lib</ImportLibrary>
<AdditionalDependencies>..\..\lib32uwp\icuucd.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -224,7 +224,7 @@
<ProgramDataBaseFileName>.\x64\ReleaseUWP/</ProgramDataBaseFileName>
</ClCompile>
<Link>
<OutputFile>..\..\bin64uwp\icuin66.dll</OutputFile>
<OutputFile>..\..\bin64uwp\icuin67.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\lib64uwp\icuin.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\lib64uwp\icuin.lib</ImportLibrary>
<AdditionalDependencies>..\..\lib64uwp\icuuc.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -241,7 +241,7 @@
<ProgramDataBaseFileName>.\x64\DebugUWP/</ProgramDataBaseFileName>
</ClCompile>
<Link>
<OutputFile>..\..\bin64uwp\icuin66d.dll</OutputFile>
<OutputFile>..\..\bin64uwp\icuin67d.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\lib64uwp\icuind.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\lib64uwp\icuind.lib</ImportLibrary>
<AdditionalDependencies>..\..\lib64uwp\icuucd.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -258,7 +258,7 @@
<ProgramDataBaseFileName>.\ARM\ReleaseUWP/</ProgramDataBaseFileName>
</ClCompile>
<Link>
<OutputFile>..\..\binARMuwp\icuin66.dll</OutputFile>
<OutputFile>..\..\binARMuwp\icuin67.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\libARMuwp\icuin.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\libARMuwp\icuin.lib</ImportLibrary>
<AdditionalDependencies>..\..\libARMuwp\icuuc.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -275,7 +275,7 @@
<ProgramDataBaseFileName>.\ARM\DebugUWP/</ProgramDataBaseFileName>
</ClCompile>
<Link>
<OutputFile>..\..\binARMuwp\icuin66d.dll</OutputFile>
<OutputFile>..\..\binARMuwp\icuin67d.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\libARMuwp\icuind.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\libARMuwp\icuind.lib</ImportLibrary>
<AdditionalDependencies>..\..\libARMuwp\icuucd.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -292,7 +292,7 @@
<ProgramDataBaseFileName>.\ARM64\ReleaseUWP/</ProgramDataBaseFileName>
</ClCompile>
<Link>
<OutputFile>..\..\binARM64uwp\icuin66.dll</OutputFile>
<OutputFile>..\..\binARM64uwp\icuin67.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\libARM64uwp\icuin.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\libARM64uwp\icuin.lib</ImportLibrary>
<AdditionalDependencies>..\..\libARM64uwp\icuuc.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -309,7 +309,7 @@
<ProgramDataBaseFileName>.\ARM64\DebugUWP/</ProgramDataBaseFileName>
</ClCompile>
<Link>
<OutputFile>..\..\binARM64uwp\icuin66d.dll</OutputFile>
<OutputFile>..\..\binARM64uwp\icuin67d.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\libARM64uwp\icuind.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\libARM64uwp\icuind.lib</ImportLibrary>
<AdditionalDependencies>..\..\libARM64uwp\icuucd.lib;%(AdditionalDependencies)</AdditionalDependencies>

View file

@ -38,6 +38,7 @@
#include "uassert.h"
#include "unicode/numberformatter.h"
#include "number_longnames.h"
#include "number_utypes.h"
#include "sharednumberformat.h"
#include "sharedpluralrules.h"
@ -47,6 +48,8 @@
U_NAMESPACE_BEGIN
using number::impl::UFormattedNumberData;
static constexpr int32_t WIDTH_INDEX_COUNT = UMEASFMT_WIDTH_NARROW + 1;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(MeasureFormat)
@ -504,12 +507,13 @@ UnicodeString &MeasureFormat::formatMeasurePerUnit(
status = U_UNSUPPORTED_ERROR;
return appendTo;
}
number::FormattedNumber result;
UFormattedNumberData result;
if (auto* lnf = df->toNumberFormatter(status)) {
result = lnf->unit(measure.getUnit())
result.quantity.setToDouble(measure.getNumber().getDouble(status));
lnf->unit(measure.getUnit())
.perUnit(perUnit)
.unitWidth(getUnitWidth(fWidth))
.formatDouble(measure.getNumber().getDouble(status), status);
.formatImpl(&result, status);
}
DecimalFormat::fieldPositionHelper(result, pos, appendTo.length(), status);
appendTo.append(result.toTempString(status));
@ -699,11 +703,12 @@ UnicodeString &MeasureFormat::formatMeasure(
SimpleFormatter formatter(pattern, 0, 1, status);
return QuantityFormatter::format(formatter, formattedNumber, appendTo, pos, status);
}
number::FormattedNumber result;
UFormattedNumberData result;
if (auto* lnf = df->toNumberFormatter(status)) {
result = lnf->unit(amtUnit)
result.quantity.setToDouble(amtNumber.getDouble(status));
lnf->unit(amtUnit)
.unitWidth(getUnitWidth(fWidth))
.formatDouble(amtNumber.getDouble(status), status);
.formatImpl(&result, status);
}
DecimalFormat::fieldPositionHelper(result, pos, appendTo.length(), status);
appendTo.append(result.toTempString(status));

View file

@ -92,7 +92,7 @@ const struct SIPrefixStrings {
{ "yocto", UMEASURE_SI_PREFIX_YOCTO },
};
// TODO(ICU-20920): Get this list from data
// TODO(ICU-21059): Get this list from data
const char16_t* const gSimpleUnits[] = {
u"one", // note: expected to be index 0
u"candela",
@ -496,19 +496,19 @@ private:
}
bool added = result.append(singleUnit, status);
if (sawPlus && !added) {
// Two similar units are not allowed in a sequence unit
// Two similar units are not allowed in a mixed unit
status = kUnitIdentifierSyntaxError;
return;
}
if ((++unitNum) >= 2) {
UMeasureUnitComplexity complexity = sawPlus
? UMEASURE_UNIT_SEQUENCE
? UMEASURE_UNIT_MIXED
: UMEASURE_UNIT_COMPOUND;
if (unitNum == 2) {
U_ASSERT(result.complexity == UMEASURE_UNIT_SINGLE);
result.complexity = complexity;
} else if (result.complexity != complexity) {
// Mixed sequence and compound units
// Can't have mixed compound units
status = kUnitIdentifierSyntaxError;
return;
}
@ -589,7 +589,7 @@ void serialize(MeasureUnitImpl& impl, UErrorCode& status) {
return;
}
if (impl.complexity == UMEASURE_UNIT_COMPOUND) {
// Note: don't sort a SEQUENCE unit
// Note: don't sort a MIXED unit
uprv_sortArray(
impl.units.getAlias(),
impl.units.length(),
@ -609,7 +609,7 @@ void serialize(MeasureUnitImpl& impl, UErrorCode& status) {
for (int32_t i = 1; i < impl.units.length(); i++) {
const SingleUnitImpl& prev = *impl.units[i-1];
const SingleUnitImpl& curr = *impl.units[i];
if (impl.complexity == UMEASURE_UNIT_SEQUENCE) {
if (impl.complexity == UMEASURE_UNIT_MIXED) {
impl.identifier.append("-and-", status);
serializeSingle(curr, true, impl.identifier, status);
} else {
@ -753,7 +753,7 @@ MeasureUnit MeasureUnit::product(const MeasureUnit& other, UErrorCode& status) c
MeasureUnitImpl impl = MeasureUnitImpl::forMeasureUnitMaybeCopy(*this, status);
MeasureUnitImpl temp;
const MeasureUnitImpl& otherImpl = MeasureUnitImpl::forMeasureUnit(other, temp, status);
if (impl.complexity == UMEASURE_UNIT_SEQUENCE || otherImpl.complexity == UMEASURE_UNIT_SEQUENCE) {
if (impl.complexity == UMEASURE_UNIT_MIXED || otherImpl.complexity == UMEASURE_UNIT_MIXED) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return {};
}

View file

@ -82,7 +82,7 @@ struct SingleUnitImpl : public UMemory {
/**
* Internal representation of measurement units. Capable of representing all complexities of units,
* including sequence and compound units.
* including mixed and compound units.
*/
struct MeasureUnitImpl : public UMemory {
/** Extract the MeasureUnitImpl from a MeasureUnit. */
@ -151,7 +151,7 @@ struct MeasureUnitImpl : public UMemory {
/** Mutates this MeasureUnitImpl to append a single unit. */
bool append(const SingleUnitImpl& singleUnit, UErrorCode& status);
/** The complexity, either SINGLE, COMPOUND, or SEQUENCE. */
/** The complexity, either SINGLE, COMPOUND, or MIXED. */
UMeasureUnitComplexity complexity = UMEASURE_UNIT_SINGLE;
/**

View file

@ -156,7 +156,7 @@ unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t buf
return 0;
}
return result->fImpl.toTempString(*ec).extract(buffer, bufferCapacity, *ec);
return result->fData.toTempString(*ec).extract(buffer, bufferCapacity, *ec);
}
U_CAPI UBool U_EXPORT2
@ -173,7 +173,7 @@ unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* u
fp.setField(ufpos->field);
fp.setBeginIndex(ufpos->beginIndex);
fp.setEndIndex(ufpos->endIndex);
bool retval = result->fImpl.nextFieldPosition(fp, *ec);
bool retval = result->fData.nextFieldPosition(fp, *ec);
ufpos->beginIndex = fp.getBeginIndex();
ufpos->endIndex = fp.getEndIndex();
// NOTE: MSVC sometimes complains when implicitly converting between bool and UBool
@ -192,7 +192,8 @@ unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPosition
}
auto* fpi = reinterpret_cast<FieldPositionIterator*>(ufpositer);
result->fImpl.getAllFieldPositions(*fpi, *ec);
FieldPositionIteratorHandler fpih(fpi, *ec);
result->fData.getAllFieldPositions(fpih, *ec);
}
U_CAPI void U_EXPORT2

View file

@ -19,16 +19,6 @@ UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumber)
#define UPRV_NOARG
UBool FormattedNumber::nextFieldPosition(FieldPosition& fieldPosition, UErrorCode& status) const {
UPRV_FORMATTED_VALUE_METHOD_GUARD(FALSE)
return fData->nextFieldPosition(fieldPosition, status);
}
void FormattedNumber::getAllFieldPositions(FieldPositionIterator& iterator, UErrorCode& status) const {
FieldPositionIteratorHandler fpih(&iterator, status);
getAllFieldPositionsImpl(fpih, status);
}
void FormattedNumber::toDecimalNumber(ByteSink& sink, UErrorCode& status) const {
UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
impl::DecNum decnum;

View file

@ -897,7 +897,7 @@ void GeneratorHelpers::generateSkeleton(const MacroProps& macros, UnicodeString&
bool blueprint_helpers::parseExponentWidthOption(const StringSegment& segment, MacroProps& macros,
UErrorCode&) {
if (segment.charAt(0) != u'+') {
if (!isWildcardChar(segment.charAt(0))) {
return false;
}
int32_t offset = 1;
@ -919,7 +919,7 @@ bool blueprint_helpers::parseExponentWidthOption(const StringSegment& segment, M
void
blueprint_helpers::generateExponentWidthOption(int32_t minExponentDigits, UnicodeString& sb, UErrorCode&) {
sb.append(u'+');
sb.append(kWildcardChar);
appendMultiple(sb, u'e', minExponentDigits);
}
@ -1071,7 +1071,7 @@ void blueprint_helpers::parseFractionStem(const StringSegment& segment, MacroPro
}
}
if (offset < segment.length()) {
if (segment.charAt(offset) == u'+') {
if (isWildcardChar(segment.charAt(offset))) {
maxFrac = -1;
offset++;
} else {
@ -1113,7 +1113,7 @@ blueprint_helpers::generateFractionStem(int32_t minFrac, int32_t maxFrac, Unicod
sb.append(u'.');
appendMultiple(sb, u'0', minFrac);
if (maxFrac == -1) {
sb.append(u'+');
sb.append(kWildcardChar);
} else {
appendMultiple(sb, u'#', maxFrac - minFrac);
}
@ -1133,7 +1133,7 @@ blueprint_helpers::parseDigitsStem(const StringSegment& segment, MacroProps& mac
}
}
if (offset < segment.length()) {
if (segment.charAt(offset) == u'+') {
if (isWildcardChar(segment.charAt(offset))) {
maxSig = -1;
offset++;
} else {
@ -1166,7 +1166,7 @@ void
blueprint_helpers::generateDigitsStem(int32_t minSig, int32_t maxSig, UnicodeString& sb, UErrorCode&) {
appendMultiple(sb, u'@', minSig);
if (maxSig == -1) {
sb.append(u'+');
sb.append(kWildcardChar);
} else {
appendMultiple(sb, u'#', maxSig - minSig);
}
@ -1262,7 +1262,7 @@ bool blueprint_helpers::parseFracSigOption(const StringSegment& segment, MacroPr
// Invalid: @, @@, @@@
// Invalid: @@#, @@##, @@@#
if (offset < segment.length()) {
if (segment.charAt(offset) == u'+') {
if (isWildcardChar(segment.charAt(offset))) {
maxSig = -1;
offset++;
} else if (minSig > 1) {
@ -1351,7 +1351,7 @@ void blueprint_helpers::parseIntegerWidthOption(const StringSegment& segment, Ma
int32_t offset = 0;
int32_t minInt = 0;
int32_t maxInt;
if (segment.charAt(0) == u'+') {
if (isWildcardChar(segment.charAt(0))) {
maxInt = -1;
offset++;
} else {
@ -1392,7 +1392,7 @@ void blueprint_helpers::parseIntegerWidthOption(const StringSegment& segment, Ma
void blueprint_helpers::generateIntegerWidthOption(int32_t minInt, int32_t maxInt, UnicodeString& sb,
UErrorCode&) {
if (maxInt == -1) {
sb.append(u'+');
sb.append(kWildcardChar);
} else {
appendMultiple(sb, u'#', maxInt - minInt);
}

View file

@ -118,6 +118,17 @@ enum StemEnum {
STEM_SCALE,
};
/** Default wildcard char, accepted on input and printed in output */
constexpr char16_t kWildcardChar = u'*';
/** Alternative wildcard char, accept on input but not printed in output */
constexpr char16_t kAltWildcardChar = u'+';
/** Checks whether the char is a wildcard on input */
inline bool isWildcardChar(char16_t c) {
return c == kWildcardChar || c == kAltWildcardChar;
}
/**
* Creates a NumberFormatter corresponding to the given skeleton string.
*

View file

@ -30,8 +30,10 @@ const DecimalQuantity* validateUFormattedNumberToDecimalQuantity(
*
* The DecimalQuantity is not currently being used by FormattedNumber, but at some point it could be used
* to add a toDecNumber() or similar method.
*
* Exported as U_I18N_API for tests
*/
class UFormattedNumberData : public FormattedValueStringBuilderImpl {
class U_I18N_API UFormattedNumberData : public FormattedValueStringBuilderImpl {
public:
UFormattedNumberData() : FormattedValueStringBuilderImpl(kUndefinedField) {}
virtual ~UFormattedNumberData();

View file

@ -379,23 +379,6 @@ UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumberRange)
#define UPRV_NOARG
UBool FormattedNumberRange::nextFieldPosition(FieldPosition& fieldPosition, UErrorCode& status) const {
UPRV_FORMATTED_VALUE_METHOD_GUARD(FALSE)
// NOTE: MSVC sometimes complains when implicitly converting between bool and UBool
return fData->nextFieldPosition(fieldPosition, status);
}
void FormattedNumberRange::getAllFieldPositions(FieldPositionIterator& iterator, UErrorCode& status) const {
FieldPositionIteratorHandler fpih(&iterator, status);
getAllFieldPositionsImpl(fpih, status);
}
void FormattedNumberRange::getAllFieldPositionsImpl(
FieldPositionIteratorHandler& fpih, UErrorCode& status) const {
UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG)
fData->getAllFieldPositions(fpih, status);
}
UnicodeString FormattedNumberRange::getFirstDecimal(UErrorCode& status) const {
UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString())
return fData->quantity1.toScientificString();

View file

@ -583,11 +583,14 @@ SimpleDateFormat& SimpleDateFormat::operator=(const SimpleDateFormat& other)
fHasMinute = other.fHasMinute;
fHasSecond = other.fHasSecond;
// TimeZoneFormat in ICU4C only depends on a locale for now
if (fLocale != other.fLocale) {
delete fTimeZoneFormat;
fTimeZoneFormat = NULL; // forces lazy instantiation with the other locale
fLocale = other.fLocale;
fLocale = other.fLocale;
// TimeZoneFormat can now be set independently via setter.
// If it is NULL, it will be lazily initialized from locale
delete fTimeZoneFormat;
fTimeZoneFormat = NULL;
if (other.fTimeZoneFormat) {
fTimeZoneFormat = new TimeZoneFormat(*other.fTimeZoneFormat);
}
#if !UCONFIG_NO_BREAK_ITERATION

View file

@ -193,7 +193,7 @@ _processRFC3066Locale(CollatorSpec *spec, uint32_t, const char* string,
*status = U_BUFFER_OVERFLOW_ERROR;
return string;
} else {
spec->locale.copyFrom(CharString(string, end-string, *status), *status);
spec->locale.copyFrom(CharString(string, static_cast<int32_t>(end-string), *status), *status);
return end+1;
}
}

View file

@ -206,6 +206,12 @@ protected:
*/
BasicTimeZone(const BasicTimeZone& source);
/**
* Copy assignment.
* @stable ICU 3.8
*/
BasicTimeZone& operator=(const BasicTimeZone&) = default;
/**
* Gets the set of TimeZoneRule instances applicable to the specified time and after.
* @param start The start date used for extracting time zone rules

View file

@ -56,7 +56,6 @@ class U_I18N_API CurrencyUnit: public MeasureUnit {
*/
CurrencyUnit(ConstChar16Ptr isoCode, UErrorCode &ec);
#ifndef U_HIDE_DRAFT_API
/**
* Construct an object with the given ISO currency code.
*
@ -64,10 +63,9 @@ class U_I18N_API CurrencyUnit: public MeasureUnit {
* length 3. If invalid, the currency is initialized to XXX.
* @param ec input-output error code. If the isoCode is invalid,
* then this will be set to a failing value.
* @draft ICU 64
* @stable ICU 64
*/
CurrencyUnit(StringPiece isoCode, UErrorCode &ec);
#endif /* U_HIDE_DRAFT_API */
/**
* Copy constructor

View file

@ -53,10 +53,10 @@ class CompactDecimalFormat;
namespace number {
class LocalizedNumberFormatter;
class FormattedNumber;
namespace impl {
class DecimalQuantity;
struct DecimalFormatFields;
class UFormattedNumberData;
}
}
@ -1283,14 +1283,13 @@ class U_I18N_API DecimalFormat : public NumberFormat {
*/
virtual void setNegativeSuffix(const UnicodeString& newValue);
#ifndef U_HIDE_DRAFT_API
/**
* Whether to show the plus sign on positive (non-negative) numbers; for example, "+12"
*
* For more control over sign display, use NumberFormatter.
*
* @return Whether the sign is shown on positive numbers and zero.
* @draft ICU 64
* @stable ICU 64
*/
UBool isSignAlwaysShown() const;
@ -1300,10 +1299,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* For more control over sign display, use NumberFormatter.
*
* @param value true to always show a sign; false to hide the sign on positive numbers and zero.
* @draft ICU 64
* @stable ICU 64
*/
void setSignAlwaysShown(UBool value);
#endif /* U_HIDE_DRAFT_API */
/**
* Get the multiplier for use in percent, permill, etc.
@ -1650,7 +1648,6 @@ class U_I18N_API DecimalFormat : public NumberFormat {
*/
virtual void setSecondaryGroupingSize(int32_t newValue);
#ifndef U_HIDE_DRAFT_API
/**
* Returns the minimum number of grouping digits.
* Grouping separators are output if there are at least this many
@ -1672,7 +1669,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
*
* @see setMinimumGroupingDigits
* @see getGroupingSize
* @draft ICU 64
* @stable ICU 64
*/
int32_t getMinimumGroupingDigits() const;
@ -1684,11 +1681,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
*
* @param newValue the new value of minimum grouping digits.
* @see getMinimumGroupingDigits
* @draft ICU 64
* @stable ICU 64
*/
void setMinimumGroupingDigits(int32_t newValue);
#endif /* U_HIDE_DRAFT_API */
/**
* Allows you to get the behavior of the decimal separator with integers.
@ -1729,13 +1724,12 @@ class U_I18N_API DecimalFormat : public NumberFormat {
*/
virtual void setDecimalPatternMatchRequired(UBool newValue);
#ifndef U_HIDE_DRAFT_API
/**
* Returns whether to ignore exponents when parsing.
*
* @return Whether to ignore exponents when parsing.
* @see #setParseNoExponent
* @draft ICU 64
* @stable ICU 64
*/
UBool isParseNoExponent() const;
@ -1745,7 +1739,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* 5).
*
* @param value true to prevent exponents from being parsed; false to allow them to be parsed.
* @draft ICU 64
* @stable ICU 64
*/
void setParseNoExponent(UBool value);
@ -1754,7 +1748,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
*
* @return Whether parsing is case-sensitive.
* @see #setParseCaseSensitive
* @draft ICU 64
* @stable ICU 64
*/
UBool isParseCaseSensitive() const;
@ -1767,7 +1761,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
*
* @param value true to enable case-sensitive parsing (the default); false to force
* case-sensitive parsing behavior.
* @draft ICU 64
* @stable ICU 64
*/
void setParseCaseSensitive(UBool value);
@ -1777,7 +1771,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
*
* @return Whether an error code is set if high-order digits are truncated.
* @see setFormatFailIfMoreThanMaxDigits
* @draft ICU 64
* @stable ICU 64
*/
UBool isFormatFailIfMoreThanMaxDigits() const;
@ -1786,11 +1780,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* By default, setMaximumIntegerDigits truncates high-order digits silently.
*
* @param value Whether to set an error code if high-order digits are truncated.
* @draft ICU 64
* @stable ICU 64
*/
void setFormatFailIfMoreThanMaxDigits(UBool value);
#endif /* U_HIDE_DRAFT_API */
/**
* Synthesizes a pattern string that represents the current state
@ -2067,7 +2059,6 @@ class U_I18N_API DecimalFormat : public NumberFormat {
#endif /* U_HIDE_INTERNAL_API */
#ifndef U_HIDE_DRAFT_API
/**
* Converts this DecimalFormat to a (Localized)NumberFormatter. Starting
* in ICU 60, NumberFormatter is the recommended way to format numbers.
@ -2111,10 +2102,9 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @param status Set on failure, like U_MEMORY_ALLOCATION_ERROR.
* @return A pointer to an internal object, or nullptr on failure.
* Do not delete the return value!
* @draft ICU 64
* @stable ICU 64
*/
const number::LocalizedNumberFormatter* toNumberFormatter(UErrorCode& status) const;
#endif /* U_HIDE_DRAFT_API */
/**
* Return the class ID for this class. This is useful only for
@ -2168,11 +2158,17 @@ class U_I18N_API DecimalFormat : public NumberFormat {
const numparse::impl::NumberParserImpl* getCurrencyParser(UErrorCode& status) const;
static void fieldPositionHelper(const number::FormattedNumber& formatted, FieldPosition& fieldPosition,
int32_t offset, UErrorCode& status);
static void fieldPositionHelper(
const number::impl::UFormattedNumberData& formatted,
FieldPosition& fieldPosition,
int32_t offset,
UErrorCode& status);
static void fieldPositionIteratorHelper(const number::FormattedNumber& formatted,
FieldPositionIterator* fpi, int32_t offset, UErrorCode& status);
static void fieldPositionIteratorHelper(
const number::impl::UFormattedNumberData& formatted,
FieldPositionIterator* fpi,
int32_t offset,
UErrorCode& status);
void setupFastFormat();

View file

@ -38,7 +38,6 @@ U_NAMESPACE_BEGIN
class FormattedDateIntervalData;
class DateIntervalFormat;
#ifndef U_HIDE_DRAFT_API
/**
* An immutable class containing the result of a date interval formatting operation.
*
@ -54,25 +53,25 @@ class DateIntervalFormat;
*
* Not intended for public subclassing.
*
* @draft ICU 64
* @stable ICU 64
*/
class U_I18N_API FormattedDateInterval : public UMemory, public FormattedValue {
public:
/**
* Default constructor; makes an empty FormattedDateInterval.
* @draft ICU 64
* @stable ICU 64
*/
FormattedDateInterval() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
/**
* Move constructor: Leaves the source FormattedDateInterval in an undefined state.
* @draft ICU 64
* @stable ICU 64
*/
FormattedDateInterval(FormattedDateInterval&& src) U_NOEXCEPT;
/**
* Destruct an instance of FormattedDateInterval.
* @draft ICU 64
* @stable ICU 64
*/
virtual ~FormattedDateInterval() U_OVERRIDE;
@ -84,7 +83,7 @@ class U_I18N_API FormattedDateInterval : public UMemory, public FormattedValue {
/**
* Move assignment: Leaves the source FormattedDateInterval in an undefined state.
* @draft ICU 64
* @stable ICU 64
*/
FormattedDateInterval& operator=(FormattedDateInterval&& src) U_NOEXCEPT;
@ -109,7 +108,6 @@ class U_I18N_API FormattedDateInterval : public UMemory, public FormattedValue {
: fData(nullptr), fErrorCode(errorCode) {}
friend class DateIntervalFormat;
};
#endif /* U_HIDE_DRAFT_API */
/**
@ -504,7 +502,6 @@ public:
FieldPosition& fieldPosition,
UErrorCode& status) const ;
#ifndef U_HIDE_DRAFT_API
/**
* Format a DateInterval to produce a FormattedDateInterval.
*
@ -513,12 +510,11 @@ public:
* @param dtInterval DateInterval to be formatted.
* @param status Set if an error occurs.
* @return A FormattedDateInterval containing the format result.
* @draft ICU 64
* @stable ICU 64
*/
FormattedDateInterval formatToValue(
const DateInterval& dtInterval,
UErrorCode& status) const;
#endif /* U_HIDE_DRAFT_API */
/**
* Format 2 Calendars to produce a string.
@ -549,7 +545,6 @@ public:
FieldPosition& fieldPosition,
UErrorCode& status) const ;
#ifndef U_HIDE_DRAFT_API
/**
* Format 2 Calendars to produce a FormattedDateInterval.
*
@ -564,13 +559,12 @@ public:
* to be formatted into date interval string
* @param status Set if an error occurs.
* @return A FormattedDateInterval containing the format result.
* @draft ICU 64
* @stable ICU 64
*/
FormattedDateInterval formatToValue(
Calendar& fromCalendar,
Calendar& toCalendar,
UErrorCode& status) const;
#endif /* U_HIDE_DRAFT_API */
/**
* Date interval parsing is not supported. Please do not use.

View file

@ -25,11 +25,6 @@ U_NAMESPACE_BEGIN
* of APIs throughout ICU use these classes for expressing their localized output.
*/
// The following cannot have #ifndef U_HIDE_DRAFT_API because
// class FormattedValue depends on it, and FormattedValue cannot be
// hidden becauseclass FormattedNumber (stable ICU 60) depends on it.
#ifndef U_FORCE_HIDE_DRAFT_API
/**
* Represents a span of a string containing a given field.
*
@ -41,7 +36,7 @@ U_NAMESPACE_BEGIN
*
* This class is not intended for public subclassing.
*
* @draft ICU 64
* @stable ICU 64
*/
class U_I18N_API ConstrainedFieldPosition : public UMemory {
public:
@ -51,21 +46,20 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory {
*
* By default, the ConstrainedFieldPosition has no iteration constraints.
*
* @draft ICU 64
* @stable ICU 64
*/
ConstrainedFieldPosition();
/** @draft ICU 64 */
/** @stable ICU 64 */
~ConstrainedFieldPosition();
#ifndef U_HIDE_DRAFT_API
/**
* Resets this ConstrainedFieldPosition to its initial state, as if it were newly created:
*
* - Removes any constraints that may have been set on the instance.
* - Resets the iteration position.
*
* @draft ICU 64
* @stable ICU 64
*/
void reset();
@ -89,7 +83,7 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory {
* does not generally have well-defined behavior.
*
* @param category The field category to fix when iterating.
* @draft ICU 64
* @stable ICU 64
*/
void constrainCategory(int32_t category);
@ -114,7 +108,7 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory {
*
* @param category The field category to fix when iterating.
* @param field The field to fix when iterating.
* @draft ICU 64
* @stable ICU 64
*/
void constrainField(int32_t category, int32_t field);
@ -125,7 +119,7 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory {
* FormattedValue#nextPosition returns TRUE.
*
* @return The field category saved in the instance.
* @draft ICU 64
* @stable ICU 64
*/
inline int32_t getCategory() const {
return fCategory;
@ -138,7 +132,7 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory {
* FormattedValue#nextPosition returns TRUE.
*
* @return The field saved in the instance.
* @draft ICU 64
* @stable ICU 64
*/
inline int32_t getField() const {
return fField;
@ -150,7 +144,7 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory {
* The return value is well-defined only after FormattedValue#nextPosition returns TRUE.
*
* @return The start index saved in the instance.
* @draft ICU 64
* @stable ICU 64
*/
inline int32_t getStart() const {
return fStart;
@ -162,7 +156,7 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory {
* The return value is well-defined only after FormattedValue#nextPosition returns TRUE.
*
* @return The end index saved in the instance.
* @draft ICU 64
* @stable ICU 64
*/
inline int32_t getLimit() const {
return fLimit;
@ -181,7 +175,7 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory {
* Users of FormattedValue should not need to call this method.
*
* @return The current iteration context from {@link #setInt64IterationContext}.
* @draft ICU 64
* @stable ICU 64
*/
inline int64_t getInt64IterationContext() const {
return fContext;
@ -193,7 +187,7 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory {
* Intended to be used by FormattedValue implementations.
*
* @param context The new iteration context.
* @draft ICU 64
* @stable ICU 64
*/
void setInt64IterationContext(int64_t context);
@ -205,7 +199,7 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory {
*
* @param category The category to test.
* @param field The field to test.
* @draft ICU 64
* @stable ICU 64
*/
UBool matchesField(int32_t category, int32_t field) const;
@ -221,39 +215,32 @@ class U_I18N_API ConstrainedFieldPosition : public UMemory {
* @param field The new field.
* @param start The new inclusive start index.
* @param limit The new exclusive end index.
* @draft ICU 64
* @stable ICU 64
*/
void setState(
int32_t category,
int32_t field,
int32_t start,
int32_t limit);
#endif /* U_HIDE_DRAFT_API */
private:
int64_t fContext = 0LL;
int32_t fField = 0;
int32_t fStart = 0;
int32_t fLimit = 0;
#ifndef U_HIDE_DRAFT_API
int32_t fCategory = UFIELD_CATEGORY_UNDEFINED;
#else /* U_HIDE_DRAFT_API */
int32_t fCategory = 0;
#endif /* U_HIDE_DRAFT_API */
int8_t fConstraint = 0;
};
// The following cannot have #ifndef U_HIDE_DRAFT_API because
// class FormattedNumber (stable ICU 60) depends on it.
/**
* An abstract formatted value: a string with associated field attributes.
* Many formatters format to classes implementing FormattedValue.
*
* @draft ICU 64
* @stable ICU 64
*/
class U_I18N_API FormattedValue /* not : public UObject because this is an interface/mixin class */ {
public:
/** @draft ICU 64 */
/** @stable ICU 64 */
virtual ~FormattedValue();
/**
@ -264,7 +251,7 @@ class U_I18N_API FormattedValue /* not : public UObject because this is an inter
* @param status Set if an error occurs.
* @return a UnicodeString containing the formatted string.
*
* @draft ICU 64
* @stable ICU 64
*/
virtual UnicodeString toString(UErrorCode& status) const = 0;
@ -280,7 +267,7 @@ class U_I18N_API FormattedValue /* not : public UObject because this is an inter
* @param status Set if an error occurs.
* @return a temporary UnicodeString containing the formatted string.
*
* @draft ICU 64
* @stable ICU 64
*/
virtual UnicodeString toTempString(UErrorCode& status) const = 0;
@ -292,7 +279,7 @@ class U_I18N_API FormattedValue /* not : public UObject because this is an inter
* @param status Set if an error occurs.
* @return The same Appendable, for chaining.
*
* @draft ICU 64
* @stable ICU 64
* @see Appendable
*/
virtual Appendable& appendTo(Appendable& appendable, UErrorCode& status) const = 0;
@ -317,11 +304,10 @@ class U_I18N_API FormattedValue /* not : public UObject because this is an inter
* @return TRUE if a new occurrence of the field was found;
* FALSE otherwise or if an error was set.
*
* @draft ICU 64
* @stable ICU 64
*/
virtual UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const = 0;
};
#endif // U_FORCE_HIDE_DRAFT_API
U_NAMESPACE_END

View file

@ -66,7 +66,6 @@ struct ListFormatData : public UMemory {
#if !UCONFIG_NO_FORMATTING
#ifndef U_HIDE_DRAFT_API
/**
* An immutable class containing the result of a list formatting operation.
*
@ -81,25 +80,25 @@ struct ListFormatData : public UMemory {
*
* Not intended for public subclassing.
*
* @draft ICU 64
* @stable ICU 64
*/
class U_I18N_API FormattedList : public UMemory, public FormattedValue {
public:
/**
* Default constructor; makes an empty FormattedList.
* @draft ICU 64
* @stable ICU 64
*/
FormattedList() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
/**
* Move constructor: Leaves the source FormattedList in an undefined state.
* @draft ICU 64
* @stable ICU 64
*/
FormattedList(FormattedList&& src) U_NOEXCEPT;
/**
* Destruct an instance of FormattedList.
* @draft ICU 64
* @stable ICU 64
*/
virtual ~FormattedList() U_OVERRIDE;
@ -111,7 +110,7 @@ class U_I18N_API FormattedList : public UMemory, public FormattedValue {
/**
* Move assignment: Leaves the source FormattedList in an undefined state.
* @draft ICU 64
* @stable ICU 64
*/
FormattedList& operator=(FormattedList&& src) U_NOEXCEPT;
@ -136,7 +135,6 @@ class U_I18N_API FormattedList : public UMemory, public FormattedValue {
: fData(nullptr), fErrorCode(errorCode) {}
friend class ListFormatter;
};
#endif /* U_HIDE_DRAFT_API */
#endif // !UCONFIG_NO_FORMATTING
@ -240,7 +238,6 @@ class U_I18N_API ListFormatter : public UObject{
UnicodeString& appendTo, UErrorCode& errorCode) const;
#if !UCONFIG_NO_FORMATTING
#ifndef U_HIDE_DRAFT_API
/**
* Formats a list of strings to a FormattedList, which exposes field
* position information. The FormattedList contains more information than
@ -250,13 +247,12 @@ class U_I18N_API ListFormatter : public UObject{
* @param n_items Length of the array items.
* @param errorCode ICU error code returned here.
* @return A FormattedList containing field information.
* @draft ICU 64
* @stable ICU 64
*/
FormattedList formatStringsToValue(
const UnicodeString items[],
int32_t n_items,
UErrorCode& errorCode) const;
#endif /* U_HIDE_DRAFT_API */
#endif // !UCONFIG_NO_FORMATTING
#ifndef U_HIDE_INTERNAL_API

File diff suppressed because it is too large Load diff

View file

@ -2095,7 +2095,6 @@ class U_I18N_API NumberFormatterSettings {
*/
UnicodeString toSkeleton(UErrorCode& status) const;
#ifndef U_HIDE_DRAFT_API
/**
* Returns the current (Un)LocalizedNumberFormatter as a LocalPointer
* wrapping a heap-allocated copy of the current object.
@ -2105,7 +2104,7 @@ class U_I18N_API NumberFormatterSettings {
*
* @return A wrapped (Un)LocalizedNumberFormatter pointer, or a wrapped
* nullptr on failure.
* @draft ICU 64
* @stable ICU 64
*/
LocalPointer<Derived> clone() const &;
@ -2114,10 +2113,9 @@ class U_I18N_API NumberFormatterSettings {
*
* @return A wrapped (Un)LocalizedNumberFormatter pointer, or a wrapped
* nullptr on failure.
* @draft ICU 64
* @stable ICU 64
*/
LocalPointer<Derived> clone() &&;
#endif /* U_HIDE_DRAFT_API */
/**
* Sets the UErrorCode if an error occurred in the fluent chain.
@ -2428,15 +2426,12 @@ class U_I18N_API LocalizedNumberFormatter
class U_I18N_API FormattedNumber : public UMemory, public FormattedValue {
public:
// Default constructor cannot have #ifndef U_HIDE_DRAFT_API
#ifndef U_FORCE_HIDE_DRAFT_API
/**
* Default constructor; makes an empty FormattedNumber.
* @draft ICU 64
* @stable ICU 64
*/
FormattedNumber()
: fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
#endif // U_FORCE_HIDE_DRAFT_API
/**
* Move constructor: Leaves the source FormattedNumber in an undefined state.
@ -2490,60 +2485,6 @@ class U_I18N_API FormattedNumber : public UMemory, public FormattedValue {
/** @copydoc FormattedValue::nextPosition() */
UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
#ifndef U_HIDE_DRAFT_API
/**
* Determines the start (inclusive) and end (exclusive) indices of the next occurrence of the given
* <em>field</em> in the output string. This allows you to determine the locations of, for example,
* the integer part, fraction part, or symbols.
*
* This is a simpler but less powerful alternative to {@link #nextPosition}.
*
* If a field occurs just once, calling this method will find that occurrence and return it. If a
* field occurs multiple times, this method may be called repeatedly with the following pattern:
*
* <pre>
* FieldPosition fpos(UNUM_GROUPING_SEPARATOR_FIELD);
* while (formattedNumber.nextFieldPosition(fpos, status)) {
* // do something with fpos.
* }
* </pre>
*
* This method is useful if you know which field to query. If you want all available field position
* information, use {@link #nextPosition} or {@link #getAllFieldPositions}.
*
* @param fieldPosition
* Input+output variable. On input, the "field" property determines which field to look
* up, and the "beginIndex" and "endIndex" properties determine where to begin the search.
* On output, the "beginIndex" is set to the beginning of the first occurrence of the
* field with either begin or end indices after the input indices; "endIndex" is set to
* the end of that occurrence of the field (exclusive index). If a field position is not
* found, the method returns FALSE and the FieldPosition may or may not be changed.
* @param status
* Set if an error occurs while populating the FieldPosition.
* @return TRUE if a new occurrence of the field was found; FALSE otherwise.
* @draft ICU 62
* @see UNumberFormatFields
*/
UBool nextFieldPosition(FieldPosition& fieldPosition, UErrorCode& status) const;
/**
* Export the formatted number to a FieldPositionIterator. This allows you to determine which characters in
* the output string correspond to which <em>fields</em>, such as the integer part, fraction part, and sign.
*
* This is an alternative to the more powerful #nextPosition() API.
*
* If information on only one field is needed, use #nextPosition() or #nextFieldPosition() instead.
*
* @param iterator
* The FieldPositionIterator to populate with all of the fields present in the formatted number.
* @param status
* Set if an error occurs while populating the FieldPositionIterator.
* @draft ICU 62
* @see UNumberFormatFields
*/
void getAllFieldPositions(FieldPositionIterator &iterator, UErrorCode &status) const;
#endif /* U_HIDE_DRAFT_API */
#ifndef U_HIDE_DRAFT_API
/**
* Export the formatted number as a "numeric string" conforming to the
@ -2664,7 +2605,6 @@ class U_I18N_API NumberFormatter final {
*/
static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, UErrorCode& status);
#ifndef U_HIDE_DRAFT_API
/**
* Call this method at the beginning of a NumberFormatter fluent chain to create an instance based
* on a given number skeleton string.
@ -2680,11 +2620,10 @@ class U_I18N_API NumberFormatter final {
* @param status
* Set to U_NUMBER_SKELETON_SYNTAX_ERROR if the skeleton was invalid.
* @return An UnlocalizedNumberFormatter, to be used for chaining.
* @draft ICU 64
* @stable ICU 64
*/
static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton,
UParseError& perror, UErrorCode& status);
#endif
/**
* Use factory methods instead of the constructor to create a NumberFormatter.

View file

@ -449,7 +449,6 @@ class U_I18N_API NumberRangeFormatterSettings {
*/
Derived identityFallback(UNumberRangeIdentityFallback identityFallback) &&;
#ifndef U_HIDE_DRAFT_API
/**
* Returns the current (Un)LocalizedNumberRangeFormatter as a LocalPointer
* wrapping a heap-allocated copy of the current object.
@ -459,7 +458,7 @@ class U_I18N_API NumberRangeFormatterSettings {
*
* @return A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped
* nullptr on failure.
* @draft ICU 64
* @stable ICU 64
*/
LocalPointer<Derived> clone() const &;
@ -468,10 +467,9 @@ class U_I18N_API NumberRangeFormatterSettings {
*
* @return A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped
* nullptr on failure.
* @draft ICU 64
* @stable ICU 64
*/
LocalPointer<Derived> clone() &&;
#endif /* U_HIDE_DRAFT_API */
/**
* Sets the UErrorCode if an error occurred in the fluent chain.
@ -728,52 +726,6 @@ class U_I18N_API FormattedNumberRange : public UMemory, public FormattedValue {
UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
#ifndef U_HIDE_DRAFT_API
/**
* Determines the start (inclusive) and end (exclusive) indices of the next occurrence of the given
* <em>field</em> in the output string. This allows you to determine the locations of, for example,
* the integer part, fraction part, or symbols.
*
* If both sides of the range have the same field, the field will occur twice, once before the
* range separator and once after the range separator, if applicable.
*
* If a field occurs just once, calling this method will find that occurrence and return it. If a
* field occurs multiple times, this method may be called repeatedly with the following pattern:
*
* <pre>
* FieldPosition fpos(UNUM_INTEGER_FIELD);
* while (formattedNumberRange.nextFieldPosition(fpos, status)) {
* // do something with fpos.
* }
* </pre>
*
* This method is useful if you know which field to query. If you want all available field position
* information, use #getAllFieldPositions().
*
* @param fieldPosition
* Input+output variable. See {@link FormattedNumber#nextFieldPosition}.
* @param status
* Set if an error occurs while populating the FieldPosition.
* @return TRUE if a new occurrence of the field was found; FALSE otherwise.
* @draft ICU 63
* @see UNumberFormatFields
*/
UBool nextFieldPosition(FieldPosition& fieldPosition, UErrorCode& status) const;
/**
* Export the formatted number range to a FieldPositionIterator. This allows you to determine which characters in
* the output string correspond to which <em>fields</em>, such as the integer part, fraction part, and sign.
*
* If information on only one field is needed, use #nextFieldPosition() instead.
*
* @param iterator
* The FieldPositionIterator to populate with all of the fields present in the formatted number.
* @param status
* Set if an error occurs while populating the FieldPositionIterator.
* @draft ICU 63
* @see UNumberFormatFields
*/
void getAllFieldPositions(FieldPositionIterator &iterator, UErrorCode &status) const;
/**
* Export the first formatted number as a decimal number. This endpoint
* is useful for obtaining the exact number being printed after scaling

View file

@ -239,12 +239,10 @@ public:
kPermillField = UNUM_PERMILL_FIELD,
/** @stable ICU 2.0 */
kSignField = UNUM_SIGN_FIELD,
#ifndef U_HIDE_DRAFT_API
/** @draft ICU 64 */
/** @stable ICU 64 */
kMeasureUnitField = UNUM_MEASURE_UNIT_FIELD,
/** @draft ICU 64 */
/** @stable ICU 64 */
kCompactField = UNUM_COMPACT_FIELD,
#endif // U_HIDE_DRAFT_API
/**
* These constants are provided for backwards compatibility only.

View file

@ -73,6 +73,12 @@ public:
*/
NumberingSystem(const NumberingSystem& other);
/**
* Copy assignment.
* @stable ICU 4.2
*/
NumberingSystem& operator=(const NumberingSystem& other) = default;
/**
* Destructor.
* @stable ICU 4.2

View file

@ -350,7 +350,6 @@ public:
*/
UnicodeString select(double number) const;
#ifndef U_HIDE_DRAFT_API
/**
* Given a formatted number, returns the keyword of the first rule
* that applies to the number. This function can be used with
@ -364,10 +363,9 @@ public:
* @param status Set if an error occurs while selecting plural keyword.
* This could happen if the FormattedNumber is invalid.
* @return The keyword of the selected rule.
* @draft ICU 64
* @stable ICU 64
*/
UnicodeString select(const number::FormattedNumber& number, UErrorCode& status) const;
#endif /* U_HIDE_DRAFT_API */
#ifndef U_HIDE_INTERNAL_API
/**

View file

@ -264,7 +264,6 @@ class UnicodeString;
class FormattedRelativeDateTime;
class FormattedRelativeDateTimeData;
#ifndef U_HIDE_DRAFT_API
/**
* An immutable class containing the result of a relative datetime formatting operation.
*
@ -272,25 +271,25 @@ class FormattedRelativeDateTimeData;
*
* Not intended for public subclassing.
*
* @draft ICU 64
* @stable ICU 64
*/
class U_I18N_API FormattedRelativeDateTime : public UMemory, public FormattedValue {
public:
/**
* Default constructor; makes an empty FormattedRelativeDateTime.
* @draft ICU 64
* @stable ICU 64
*/
FormattedRelativeDateTime() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
/**
* Move constructor: Leaves the source FormattedRelativeDateTime in an undefined state.
* @draft ICU 64
* @stable ICU 64
*/
FormattedRelativeDateTime(FormattedRelativeDateTime&& src) U_NOEXCEPT;
/**
* Destruct an instance of FormattedRelativeDateTime.
* @draft ICU 64
* @stable ICU 64
*/
virtual ~FormattedRelativeDateTime() U_OVERRIDE;
@ -302,7 +301,7 @@ class U_I18N_API FormattedRelativeDateTime : public UMemory, public FormattedVal
/**
* Move assignment: Leaves the source FormattedRelativeDateTime in an undefined state.
* @draft ICU 64
* @stable ICU 64
*/
FormattedRelativeDateTime& operator=(FormattedRelativeDateTime&& src) U_NOEXCEPT;
@ -327,7 +326,6 @@ class U_I18N_API FormattedRelativeDateTime : public UMemory, public FormattedVal
: fData(nullptr), fErrorCode(errorCode) {}
friend class RelativeDateTimeFormatter;
};
#endif /* U_HIDE_DRAFT_API */
/**
* Formats simple relative dates. There are two types of relative dates that
@ -492,7 +490,6 @@ public:
UnicodeString& appendTo,
UErrorCode& status) const;
#ifndef U_HIDE_DRAFT_API
/**
* Formats a relative date with a quantity such as "in 5 days" or
* "3 months ago"
@ -508,14 +505,13 @@ public:
* @param unit the unit e.g day? month? year?
* @param status ICU error code returned here.
* @return The formatted relative datetime
* @draft ICU 64
* @stable ICU 64
*/
FormattedRelativeDateTime formatToValue(
double quantity,
UDateDirection direction,
UDateRelativeUnit unit,
UErrorCode& status) const;
#endif /* U_HIDE_DRAFT_API */
/**
* Formats a relative date without a quantity.
@ -539,7 +535,6 @@ public:
UnicodeString& appendTo,
UErrorCode& status) const;
#ifndef U_HIDE_DRAFT_API
/**
* Formats a relative date without a quantity.
*
@ -553,13 +548,12 @@ public:
* @param unit e.g SATURDAY, DAY, MONTH
* @param status ICU error code returned here.
* @return The formatted relative datetime
* @draft ICU 64
* @stable ICU 64
*/
FormattedRelativeDateTime formatToValue(
UDateDirection direction,
UDateAbsoluteUnit unit,
UErrorCode& status) const;
#endif /* U_HIDE_DRAFT_API */
/**
* Format a combination of URelativeDateTimeUnit and numeric offset
@ -587,7 +581,6 @@ public:
UnicodeString& appendTo,
UErrorCode& status) const;
#ifndef U_HIDE_DRAFT_API
/**
* Format a combination of URelativeDateTimeUnit and numeric offset
* using a numeric style, e.g. "1 week ago", "in 1 week",
@ -604,13 +597,12 @@ public:
* UDAT_REL_UNIT_FRIDAY.
* @param status ICU error code returned here.
* @return The formatted relative datetime
* @draft ICU 64
* @stable ICU 64
*/
FormattedRelativeDateTime formatNumericToValue(
double offset,
URelativeDateTimeUnit unit,
UErrorCode& status) const;
#endif /* U_HIDE_DRAFT_API */
/**
* Format a combination of URelativeDateTimeUnit and numeric offset
@ -638,7 +630,6 @@ public:
UnicodeString& appendTo,
UErrorCode& status) const;
#ifndef U_HIDE_DRAFT_API
/**
* Format a combination of URelativeDateTimeUnit and numeric offset
* using a text style if possible, e.g. "last week", "this week",
@ -655,13 +646,12 @@ public:
* UDAT_REL_UNIT_FRIDAY.
* @param status ICU error code returned here.
* @return The formatted relative datetime
* @draft ICU 64
* @stable ICU 64
*/
FormattedRelativeDateTime formatToValue(
double offset,
URelativeDateTimeUnit unit,
UErrorCode& status) const;
#endif /* U_HIDE_DRAFT_API */
/**
* Combines a relative date string and a time string in this object's
@ -724,13 +714,11 @@ private:
UErrorCode& status,
Args... args) const;
#ifndef U_HIDE_DRAFT_API // for FormattedRelativeDateTime
template<typename F, typename... Args>
FormattedRelativeDateTime doFormatToValue(
F callback,
UErrorCode& status,
Args... args) const;
#endif // U_HIDE_DRAFT_API
void formatImpl(
double quantity,

View file

@ -83,14 +83,12 @@
struct UDateIntervalFormat;
typedef struct UDateIntervalFormat UDateIntervalFormat; /**< C typedef for struct UDateIntervalFormat. @stable ICU 4.8 */
#ifndef U_HIDE_DRAFT_API
struct UFormattedDateInterval;
/**
* Opaque struct to contain the results of a UDateIntervalFormat operation.
* @draft ICU 64
* @stable ICU 64
*/
typedef struct UFormattedDateInterval UFormattedDateInterval;
#endif /* U_HIDE_DRAFT_API */
/**
* Open a new UDateIntervalFormat object using the predefined rules for a
@ -133,8 +131,6 @@ udtitvfmt_open(const char* locale,
U_STABLE void U_EXPORT2
udtitvfmt_close(UDateIntervalFormat *formatter);
#ifndef U_HIDE_DRAFT_API
/**
* Creates an object to hold the result of a UDateIntervalFormat
* operation. The object can be used repeatedly; it is cleared whenever
@ -142,7 +138,7 @@ udtitvfmt_close(UDateIntervalFormat *formatter);
*
* @param ec Set if an error occurs.
* @return A pointer needing ownership.
* @draft ICU 64
* @stable ICU 64
*/
U_CAPI UFormattedDateInterval* U_EXPORT2
udtitvfmt_openResult(UErrorCode* ec);
@ -167,7 +163,7 @@ udtitvfmt_openResult(UErrorCode* ec);
* @param uresult The object containing the formatted string.
* @param ec Set if an error occurs.
* @return A UFormattedValue owned by the input object.
* @draft ICU 64
* @stable ICU 64
*/
U_CAPI const UFormattedValue* U_EXPORT2
udtitvfmt_resultAsValue(const UFormattedDateInterval* uresult, UErrorCode* ec);
@ -176,11 +172,10 @@ udtitvfmt_resultAsValue(const UFormattedDateInterval* uresult, UErrorCode* ec);
* Releases the UFormattedDateInterval created by udtitvfmt_openResult().
*
* @param uresult The object to release.
* @draft ICU 64
* @stable ICU 64
*/
U_CAPI void U_EXPORT2
udtitvfmt_closeResult(UFormattedDateInterval* uresult);
#endif /* U_HIDE_DRAFT_API */
#if U_SHOW_CPLUSPLUS_API
@ -198,7 +193,6 @@ U_NAMESPACE_BEGIN
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateIntervalFormatPointer, UDateIntervalFormat, udtitvfmt_close);
#ifndef U_HIDE_DRAFT_API
/**
* \class LocalUFormattedDateIntervalPointer
* "Smart pointer" class, closes a UFormattedDateInterval via udtitvfmt_close().
@ -206,10 +200,9 @@ U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateIntervalFormatPointer, UDateIntervalFormat
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 64
* @stable ICU 64
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedDateIntervalPointer, UFormattedDateInterval, udtitvfmt_closeResult);
#endif /* U_HIDE_DRAFT_API */
U_NAMESPACE_END

View file

@ -10,8 +10,6 @@
#include "unicode/ufieldpositer.h"
#ifndef U_HIDE_DRAFT_API
/**
* \file
* \brief C API: Abstract operations for localized strings.
@ -31,41 +29,41 @@
* categories 2^28 and higher or below zero (with the highest bit turned on)
* are private-use and will not be used by ICU in the future.
*
* @draft ICU 64
* @stable ICU 64
*/
typedef enum UFieldCategory {
/**
* For an undefined field category.
*
* @draft ICU 64
* @stable ICU 64
*/
UFIELD_CATEGORY_UNDEFINED = 0,
/**
* For fields in UDateFormatField (udat.h), from ICU 3.0.
*
* @draft ICU 64
* @stable ICU 64
*/
UFIELD_CATEGORY_DATE,
/**
* For fields in UNumberFormatFields (unum.h), from ICU 49.
*
* @draft ICU 64
* @stable ICU 64
*/
UFIELD_CATEGORY_NUMBER,
/**
* For fields in UListFormatterField (ulistformatter.h), from ICU 63.
*
* @draft ICU 64
* @stable ICU 64
*/
UFIELD_CATEGORY_LIST,
/**
* For fields in URelativeDateTimeFormatterField (ureldatefmt.h), from ICU 64.
*
* @draft ICU 64
* @stable ICU 64
*/
UFIELD_CATEGORY_RELATIVE_DATETIME,
@ -84,14 +82,14 @@ typedef enum UFieldCategory {
/**
* Category for spans in a list.
*
* @draft ICU 64
* @stable ICU 64
*/
UFIELD_CATEGORY_LIST_SPAN = 0x1000 + UFIELD_CATEGORY_LIST,
/**
* Category for spans in a date interval.
*
* @draft ICU 64
* @stable ICU 64
*/
UFIELD_CATEGORY_DATE_INTERVAL_SPAN = 0x1000 + UFIELD_CATEGORY_DATE_INTERVAL,
@ -108,7 +106,7 @@ struct UConstrainedFieldPosition;
* 2. It allows you to set constraints to use when iterating over field positions.
* 3. It is used for the newer FormattedValue APIs.
*
* @draft ICU 64
* @stable ICU 64
*/
typedef struct UConstrainedFieldPosition UConstrainedFieldPosition;
@ -120,9 +118,9 @@ typedef struct UConstrainedFieldPosition UConstrainedFieldPosition;
*
* @param ec Set if an error occurs.
* @return The new object, or NULL if an error occurs.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT UConstrainedFieldPosition* U_EXPORT2
U_STABLE UConstrainedFieldPosition* U_EXPORT2
ucfpos_open(UErrorCode* ec);
@ -133,9 +131,9 @@ ucfpos_open(UErrorCode* ec);
*
* @param ucfpos The instance of UConstrainedFieldPosition.
* @param ec Set if an error occurs.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
ucfpos_reset(
UConstrainedFieldPosition* ucfpos,
UErrorCode* ec);
@ -145,9 +143,9 @@ ucfpos_reset(
* Destroys a UConstrainedFieldPosition and releases its memory.
*
* @param ucfpos The instance of UConstrainedFieldPosition.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
ucfpos_close(UConstrainedFieldPosition* ucfpos);
@ -174,9 +172,9 @@ ucfpos_close(UConstrainedFieldPosition* ucfpos);
* @param ucfpos The instance of UConstrainedFieldPosition.
* @param category The field category to fix when iterating.
* @param ec Set if an error occurs.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
ucfpos_constrainCategory(
UConstrainedFieldPosition* ucfpos,
int32_t category,
@ -207,9 +205,9 @@ ucfpos_constrainCategory(
* @param category The field category to fix when iterating.
* @param field The field to fix when iterating.
* @param ec Set if an error occurs.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
ucfpos_constrainField(
UConstrainedFieldPosition* ucfpos,
int32_t category,
@ -227,9 +225,9 @@ ucfpos_constrainField(
* @param ucfpos The instance of UConstrainedFieldPosition.
* @param ec Set if an error occurs.
* @return The field category saved in the instance.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ucfpos_getCategory(
const UConstrainedFieldPosition* ucfpos,
UErrorCode* ec);
@ -245,9 +243,9 @@ ucfpos_getCategory(
* @param ucfpos The instance of UConstrainedFieldPosition.
* @param ec Set if an error occurs.
* @return The field saved in the instance.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ucfpos_getField(
const UConstrainedFieldPosition* ucfpos,
UErrorCode* ec);
@ -262,9 +260,9 @@ ucfpos_getField(
* @param pStart Set to the start index saved in the instance. Ignored if nullptr.
* @param pLimit Set to the end index saved in the instance. Ignored if nullptr.
* @param ec Set if an error occurs.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
ucfpos_getIndexes(
const UConstrainedFieldPosition* ucfpos,
int32_t* pStart,
@ -282,9 +280,9 @@ ucfpos_getIndexes(
* @param ucfpos The instance of UConstrainedFieldPosition.
* @param ec Set if an error occurs.
* @return The current iteration context from ucfpos_setInt64IterationContext.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT int64_t U_EXPORT2
U_STABLE int64_t U_EXPORT2
ucfpos_getInt64IterationContext(
const UConstrainedFieldPosition* ucfpos,
UErrorCode* ec);
@ -298,9 +296,9 @@ ucfpos_getInt64IterationContext(
* @param ucfpos The instance of UConstrainedFieldPosition.
* @param context The new iteration context.
* @param ec Set if an error occurs.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
ucfpos_setInt64IterationContext(
UConstrainedFieldPosition* ucfpos,
int64_t context,
@ -317,9 +315,9 @@ ucfpos_setInt64IterationContext(
* @param category The category to test.
* @param field The field to test.
* @param ec Set if an error occurs.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT UBool U_EXPORT2
U_STABLE UBool U_EXPORT2
ucfpos_matchesField(
const UConstrainedFieldPosition* ucfpos,
int32_t category,
@ -341,9 +339,9 @@ ucfpos_matchesField(
* @param start The new inclusive start index.
* @param limit The new exclusive end index.
* @param ec Set if an error occurs.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
ucfpos_setState(
UConstrainedFieldPosition* ucfpos,
int32_t category,
@ -358,7 +356,7 @@ struct UFormattedValue;
* An abstract formatted value: a string with associated field attributes.
* Many formatters format to types compatible with UFormattedValue.
*
* @draft ICU 64
* @stable ICU 64
*/
typedef struct UFormattedValue UFormattedValue;
@ -374,9 +372,9 @@ typedef struct UFormattedValue UFormattedValue;
* @param pLength Output variable for the length of the string. Ignored if NULL.
* @param ec Set if an error occurs.
* @return A NUL-terminated char16 string owned by the UFormattedValue.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT const UChar* U_EXPORT2
U_STABLE const UChar* U_EXPORT2
ufmtval_getString(
const UFormattedValue* ufmtval,
int32_t* pLength,
@ -404,9 +402,9 @@ ufmtval_getString(
* and ucfpos_constrainField.
* @param ec Set if an error occurs.
* @return TRUE if another position was found; FALSE otherwise.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT UBool U_EXPORT2
U_STABLE UBool U_EXPORT2
ufmtval_nextPosition(
const UFormattedValue* ufmtval,
UConstrainedFieldPosition* ucfpos,
@ -426,7 +424,7 @@ U_NAMESPACE_BEGIN
* LocalUConstrainedFieldPositionPointer ucfpos(ucfpos_open(ec));
* // no need to explicitly call ucfpos_close()
*
* @draft ICU 64
* @stable ICU 64
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUConstrainedFieldPositionPointer,
UConstrainedFieldPosition,
@ -436,6 +434,5 @@ U_NAMESPACE_END
#endif // U_SHOW_CPLUSPLUS_API
#endif /* U_HIDE_DRAFT_API */
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif // __UFORMATTEDVALUE_H__

View file

@ -34,34 +34,32 @@
struct UListFormatter;
typedef struct UListFormatter UListFormatter; /**< C typedef for struct UListFormatter. @stable ICU 55 */
#ifndef U_HIDE_DRAFT_API
struct UFormattedList;
/**
* Opaque struct to contain the results of a UListFormatter operation.
* @draft ICU 64
* @stable ICU 64
*/
typedef struct UFormattedList UFormattedList;
#endif /* U_HIDE_DRAFT_API */
#ifndef U_HIDE_DRAFT_API
/**
* FieldPosition and UFieldPosition selectors for format fields
* defined by ListFormatter.
* @draft ICU 63
* @stable ICU 63
*/
typedef enum UListFormatterField {
/**
* The literal text in the result which came from the resources.
* @draft ICU 63
* @stable ICU 63
*/
ULISTFMT_LITERAL_FIELD,
/**
* The element text in the result which came from the input strings.
* @draft ICU 63
* @stable ICU 63
*/
ULISTFMT_ELEMENT_FIELD
} UListFormatterField;
#ifndef U_HIDE_DRAFT_API
/**
* Type of meaning expressed by the list.
*
@ -163,7 +161,7 @@ ulistfmt_open(const char* locale,
* or NULL if an error occurred.
* @draft ICU 67
*/
U_CAPI UListFormatter* U_EXPORT2
U_DRAFT UListFormatter* U_EXPORT2
ulistfmt_openForType(const char* locale, UListFormatterType type,
UListFormatterWidth width, UErrorCode* status);
#endif /* U_HIDE_DRAFT_API */
@ -177,7 +175,6 @@ ulistfmt_openForType(const char* locale, UListFormatterType type,
U_CAPI void U_EXPORT2
ulistfmt_close(UListFormatter *listfmt);
#ifndef U_HIDE_DRAFT_API
/**
* Creates an object to hold the result of a UListFormatter
* operation. The object can be used repeatedly; it is cleared whenever
@ -185,7 +182,7 @@ ulistfmt_close(UListFormatter *listfmt);
*
* @param ec Set if an error occurs.
* @return A pointer needing ownership.
* @draft ICU 64
* @stable ICU 64
*/
U_CAPI UFormattedList* U_EXPORT2
ulistfmt_openResult(UErrorCode* ec);
@ -209,7 +206,7 @@ ulistfmt_openResult(UErrorCode* ec);
* @param uresult The object containing the formatted string.
* @param ec Set if an error occurs.
* @return A UFormattedValue owned by the input object.
* @draft ICU 64
* @stable ICU 64
*/
U_CAPI const UFormattedValue* U_EXPORT2
ulistfmt_resultAsValue(const UFormattedList* uresult, UErrorCode* ec);
@ -218,11 +215,10 @@ ulistfmt_resultAsValue(const UFormattedList* uresult, UErrorCode* ec);
* Releases the UFormattedList created by ulistfmt_openResult().
*
* @param uresult The object to release.
* @draft ICU 64
* @stable ICU 64
*/
U_CAPI void U_EXPORT2
ulistfmt_closeResult(UFormattedList* uresult);
#endif /* U_HIDE_DRAFT_API */
#if U_SHOW_CPLUSPLUS_API
@ -240,7 +236,6 @@ U_NAMESPACE_BEGIN
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUListFormatterPointer, UListFormatter, ulistfmt_close);
#ifndef U_HIDE_DRAFT_API
/**
* \class LocalUFormattedListPointer
* "Smart pointer" class, closes a UFormattedList via ulistfmt_closeResult().
@ -248,10 +243,9 @@ U_DEFINE_LOCAL_OPEN_POINTER(LocalUListFormatterPointer, UListFormatter, ulistfmt
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 64
* @stable ICU 64
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedListPointer, UFormattedList, ulistfmt_closeResult);
#endif /* U_HIDE_DRAFT_API */
U_NAMESPACE_END
@ -300,7 +294,6 @@ ulistfmt_format(const UListFormatter* listfmt,
int32_t resultCapacity,
UErrorCode* status);
#ifndef U_HIDE_DRAFT_API
/**
* Formats a list of strings to a UFormattedList, which exposes more
* information than the string exported by ulistfmt_format().
@ -325,7 +318,7 @@ ulistfmt_format(const UListFormatter* listfmt,
* operation. See ulistfmt_openResult().
* @param status
* Error code set if an error occurred during formatting.
* @draft ICU 64
* @stable ICU 64
*/
U_CAPI void U_EXPORT2
ulistfmt_formatStringsToResult(
@ -335,7 +328,6 @@ ulistfmt_formatStringsToResult(
int32_t stringCount,
UFormattedList* uresult,
UErrorCode* status);
#endif /* U_HIDE_DRAFT_API */
#endif /* #if !UCONFIG_NO_FORMATTING */

View file

@ -377,12 +377,10 @@ typedef enum UNumberFormatFields {
UNUM_PERMILL_FIELD,
/** @stable ICU 49 */
UNUM_SIGN_FIELD,
#ifndef U_HIDE_DRAFT_API
/** @draft ICU 64 */
/** @stable ICU 64 */
UNUM_MEASURE_UNIT_FIELD,
/** @draft ICU 64 */
/** @stable ICU 64 */
UNUM_COMPACT_FIELD,
#endif /* U_HIDE_DRAFT_API */
#ifndef U_HIDE_DEPRECATED_API
/**
@ -1032,17 +1030,15 @@ typedef enum UNumberFormatAttribute {
* @stable ICU 51 */
UNUM_SCALE = 21,
#ifndef U_HIDE_DRAFT_API
/**
* Minimum grouping digits; most commonly set to 2 to print "1000" instead of "1,000".
* See DecimalFormat::getMinimumGroupingDigits().
*
* For better control over grouping strategies, use UNumberFormatter.
*
* @draft ICU 64
* @stable ICU 64
*/
UNUM_MINIMUM_GROUPING_DIGITS = 22,
#endif /* U_HIDE_DRAFT_API */
/**
* if this attribute is set to 0, it is set to UNUM_CURRENCY_STANDARD purpose,
@ -1083,12 +1079,10 @@ typedef enum UNumberFormatAttribute {
*/
UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002,
#ifndef U_HIDE_DRAFT_API
/**
* Parsing: if set to 1, parsing is sensitive to case (lowercase/uppercase).
*
* @draft ICU 64
* @stable ICU 64
*/
UNUM_PARSE_CASE_SENSITIVE = 0x1003,
@ -1097,12 +1091,10 @@ typedef enum UNumberFormatAttribute {
*
* For better control over sign display, use UNumberFormatter.
*
* @draft ICU 64
* @stable ICU 64
*/
UNUM_SIGN_ALWAYS_SHOWN = 0x1004,
#endif /* U_HIDE_DRAFT_API */
#ifndef U_HIDE_INTERNAL_API
/** Limit of boolean attributes. (value should
* not depend on U_HIDE conditionals)

View file

@ -427,7 +427,7 @@ typedef struct UFormattedNumber UFormattedNumber;
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
*
* @param skeleton The skeleton string, like u"percent precision-integer"
* @param skeletonLen The number of UChars in the skeleton string, or -1 it it is NUL-terminated.
* @param skeletonLen The number of UChars in the skeleton string, or -1 if it is NUL-terminated.
* @param locale The NUL-terminated locale ID.
* @param ec Set if an error occurs.
* @stable ICU 62
@ -437,23 +437,21 @@ unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const
UErrorCode* ec);
#ifndef U_HIDE_DRAFT_API
/**
* Like unumf_openForSkeletonAndLocale, but accepts a UParseError, which will be populated with the
* location of a skeleton syntax error if such a syntax error exists.
*
* @param skeleton The skeleton string, like u"percent precision-integer"
* @param skeletonLen The number of UChars in the skeleton string, or -1 it it is NUL-terminated.
* @param skeletonLen The number of UChars in the skeleton string, or -1 if it is NUL-terminated.
* @param locale The NUL-terminated locale ID.
* @param perror A parse error struct populated if an error occurs when parsing. Can be NULL.
* If no error occurs, perror->offset will be set to -1.
* @param ec Set if an error occurs.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT UNumberFormatter* U_EXPORT2
U_STABLE UNumberFormatter* U_EXPORT2
unumf_openForSkeletonAndLocaleWithError(
const UChar* skeleton, int32_t skeletonLen, const char* locale, UParseError* perror, UErrorCode* ec);
#endif // U_HIDE_DRAFT_API
/**
@ -531,7 +529,6 @@ U_STABLE void U_EXPORT2
unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen,
UFormattedNumber* uresult, UErrorCode* ec);
#ifndef U_HIDE_DRAFT_API
/**
* Returns a representation of a UFormattedNumber as a UFormattedValue,
* which can be subsequently passed to any API requiring that type.
@ -544,11 +541,10 @@ unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32
* @param uresult The object containing the formatted string.
* @param ec Set if an error occurs.
* @return A UFormattedValue owned by the input object.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT const UFormattedValue* U_EXPORT2
U_STABLE const UFormattedValue* U_EXPORT2
unumf_resultAsValue(const UFormattedNumber* uresult, UErrorCode* ec);
#endif /* U_HIDE_DRAFT_API */
/**

View file

@ -152,7 +152,6 @@ uplrules_select(const UPluralRules *uplrules,
UChar *keyword, int32_t capacity,
UErrorCode *status);
#ifndef U_HIDE_DRAFT_API
/**
* Given a formatted number, returns the keyword of the first rule
* that applies to the number, according to the supplied UPluralRules object.
@ -168,14 +167,13 @@ uplrules_select(const UPluralRules *uplrules,
* @param capacity The capacity of the keyword buffer.
* @param status A pointer to a UErrorCode to receive any errors.
* @return The length of the keyword.
* @draft ICU 64
* @stable ICU 64
*/
U_CAPI int32_t U_EXPORT2
uplrules_selectFormatted(const UPluralRules *uplrules,
const struct UFormattedNumber* number,
UChar *keyword, int32_t capacity,
UErrorCode *status);
#endif /* U_HIDE_DRAFT_API */
#ifndef U_HIDE_INTERNAL_API
/**

View file

@ -175,25 +175,23 @@ typedef enum URelativeDateTimeUnit {
#endif /* U_HIDE_DEPRECATED_API */
} URelativeDateTimeUnit;
#ifndef U_HIDE_DRAFT_API
/**
* FieldPosition and UFieldPosition selectors for format fields
* defined by RelativeDateTimeFormatter.
* @draft ICU 64
* @stable ICU 64
*/
typedef enum URelativeDateTimeFormatterField {
/**
* Represents a literal text string, like "tomorrow" or "days ago".
* @draft ICU 64
* @stable ICU 64
*/
UDAT_REL_LITERAL_FIELD,
/**
* Represents a number quantity, like "3" in "3 days ago".
* @draft ICU 64
* @stable ICU 64
*/
UDAT_REL_NUMERIC_FIELD,
} URelativeDateTimeFormatterField;
#endif // U_HIDE_DRAFT_API
/**
@ -252,11 +250,10 @@ ureldatefmt_open( const char* locale,
U_STABLE void U_EXPORT2
ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt);
#ifndef U_HIDE_DRAFT_API
struct UFormattedRelativeDateTime;
/**
* Opaque struct to contain the results of a URelativeDateTimeFormatter operation.
* @draft ICU 64
* @stable ICU 64
*/
typedef struct UFormattedRelativeDateTime UFormattedRelativeDateTime;
@ -267,9 +264,9 @@ typedef struct UFormattedRelativeDateTime UFormattedRelativeDateTime;
*
* @param ec Set if an error occurs.
* @return A pointer needing ownership.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT UFormattedRelativeDateTime* U_EXPORT2
U_STABLE UFormattedRelativeDateTime* U_EXPORT2
ureldatefmt_openResult(UErrorCode* ec);
/**
@ -284,20 +281,19 @@ ureldatefmt_openResult(UErrorCode* ec);
* @param ufrdt The object containing the formatted string.
* @param ec Set if an error occurs.
* @return A UFormattedValue owned by the input object.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT const UFormattedValue* U_EXPORT2
U_STABLE const UFormattedValue* U_EXPORT2
ureldatefmt_resultAsValue(const UFormattedRelativeDateTime* ufrdt, UErrorCode* ec);
/**
* Releases the UFormattedRelativeDateTime created by ureldatefmt_openResult.
*
* @param ufrdt The object to release.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
ureldatefmt_closeResult(UFormattedRelativeDateTime* ufrdt);
#endif /* U_HIDE_DRAFT_API */
#if U_SHOW_CPLUSPLUS_API
@ -315,7 +311,6 @@ U_NAMESPACE_BEGIN
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalURelativeDateTimeFormatterPointer, URelativeDateTimeFormatter, ureldatefmt_close);
#ifndef U_HIDE_DRAFT_API
/**
* \class LocalUFormattedRelativeDateTimePointer
* "Smart pointer" class, closes a UFormattedRelativeDateTime via ureldatefmt_closeResult().
@ -323,10 +318,9 @@ U_DEFINE_LOCAL_OPEN_POINTER(LocalURelativeDateTimeFormatterPointer, URelativeDat
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 64
* @stable ICU 64
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedRelativeDateTimePointer, UFormattedRelativeDateTime, ureldatefmt_closeResult);
#endif /* U_HIDE_DRAFT_API */
U_NAMESPACE_END
@ -368,7 +362,6 @@ ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt,
int32_t resultCapacity,
UErrorCode* status);
#ifndef U_HIDE_DRAFT_API
/**
* Format a combination of URelativeDateTimeUnit and numeric
* offset using a numeric style, e.g. "1 week ago", "in 1 week",
@ -390,16 +383,15 @@ ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt,
* A pointer to a UErrorCode to receive any errors. In
* case of error status, the contents of result are
* undefined.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
ureldatefmt_formatNumericToResult(
const URelativeDateTimeFormatter* reldatefmt,
double offset,
URelativeDateTimeUnit unit,
UFormattedRelativeDateTime* result,
UErrorCode* status);
#endif /* U_HIDE_DRAFT_API */
/**
* Format a combination of URelativeDateTimeUnit and numeric offset
@ -437,7 +429,6 @@ ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt,
int32_t resultCapacity,
UErrorCode* status);
#ifndef U_HIDE_DRAFT_API
/**
* Format a combination of URelativeDateTimeUnit and numeric offset
* using a text style if possible, e.g. "last week", "this week",
@ -462,16 +453,15 @@ ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt,
* A pointer to a UErrorCode to receive any errors. In
* case of error status, the contents of result are
* undefined.
* @draft ICU 64
* @stable ICU 64
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
ureldatefmt_formatToResult(
const URelativeDateTimeFormatter* reldatefmt,
double offset,
URelativeDateTimeUnit unit,
UFormattedRelativeDateTime* result,
UErrorCode* status);
#endif /* U_HIDE_DRAFT_API */
/**
* Combines a relative date string and a time string in this object's

View file

@ -76,7 +76,7 @@
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>..\..\$(IcuBinOutputDir)\icuio66d.dll</OutputFile>
<OutputFile>..\..\$(IcuBinOutputDir)\icuio67d.dll</OutputFile>
<ProgramDatabaseFile>..\..\$(IcuLibOutputDir)\icuiod.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\$(IcuLibOutputDir)\icuiod.lib</ImportLibrary>
<AdditionalDependencies>icuucd.lib;icuind.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -89,7 +89,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
</ClCompile>
<Link>
<OutputFile>..\..\$(IcuBinOutputDir)\icuio66.dll</OutputFile>
<OutputFile>..\..\$(IcuBinOutputDir)\icuio67.dll</OutputFile>
<ProgramDatabaseFile>..\..\$(IcuLibOutputDir)\icuio.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\$(IcuLibOutputDir)\icuio.lib</ImportLibrary>
<AdditionalDependencies>icuuc.lib;icuin.lib;%(AdditionalDependencies)</AdditionalDependencies>

View file

@ -70,7 +70,7 @@
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<OutputFile>..\..\bin\iculx66.dll</OutputFile>
<OutputFile>..\..\bin\iculx67.dll</OutputFile>
<AdditionalDependencies>icuuc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>.\..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>.\..\..\lib\iculx.pdb</ProgramDatabaseFile>
@ -95,7 +95,7 @@
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<OutputFile>..\..\bin\iculx66d.dll</OutputFile>
<OutputFile>..\..\bin\iculx67d.dll</OutputFile>
<AdditionalDependencies>icuucd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>.\..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -120,7 +120,7 @@
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<OutputFile>..\..\bin64\iculx66.dll</OutputFile>
<OutputFile>..\..\bin64\iculx67.dll</OutputFile>
<AdditionalDependencies>icuuc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>.\..\..\lib64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>.\..\..\lib64\iculx.pdb</ProgramDatabaseFile>
@ -143,7 +143,7 @@
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<OutputFile>..\..\bin64\iculx66d.dll</OutputFile>
<OutputFile>..\..\bin64\iculx67d.dll</OutputFile>
<AdditionalDependencies>icuucd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>.\..\..\lib64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>

View file

@ -72,7 +72,7 @@
<SetChecksum>true</SetChecksum>
<TurnOffAssemblyGeneration>true</TurnOffAssemblyGeneration>
<!-- Note: stubdata is somewhat odd in that it doesn't suffix the Debug output DLL/LIB with a "d" like common/i18n/etc. -->
<OutputFile>..\..\$(IcuBinOutputDir)\icudt66.dll</OutputFile>
<OutputFile>..\..\$(IcuBinOutputDir)\icudt67.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\$(IcuLibOutputDir)\icudt.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\$(IcuLibOutputDir)\icudt.lib</ImportLibrary>
</Link>

View file

@ -3035,7 +3035,7 @@ static void TestJ1968(void) {
err = U_ZERO_ERROR;
myConvName[UCNV_MAX_CONVERTER_NAME_LENGTH-1] = ',';
strncpy(myConvName + UCNV_MAX_CONVERTER_NAME_LENGTH, "locale=", 7);
memcpy(myConvName + UCNV_MAX_CONVERTER_NAME_LENGTH, "locale=", 7);
cnv = ucnv_open(myConvName, &err);
if (cnv || err != U_ILLEGAL_ARGUMENT_ERROR) {
log_err("4) Didn't get U_ILLEGAL_ARGUMENT_ERROR as expected %s\n", u_errorName(err));

View file

@ -958,7 +958,7 @@ group: double_conversion
group: number_representation
number_decimalquantity.o string_segment.o number_utils.o
# TODO(ICU-20429) Move formatted_string_builder to its own unit.
# TODO(ICU-21058) Move formatted_string_builder to its own unit.
formatted_string_builder.o
deps
decnumber double_conversion

View file

@ -1185,9 +1185,13 @@ ConversionTest::ToUnicodeCase(ConversionCase &cc, UConverterToUCallback callback
cc.offsets=NULL;
}
else {
memset(resultOffsets, -1, UPRV_LENGTHOF(resultOffsets));
for (int32_t i = 0; i < UPRV_LENGTHOF(resultOffsets); i++) {
resultOffsets[i] = -1;
}
}
for (int32_t i = 0; i < UPRV_LENGTHOF(result); i++) {
result[i] = -1;
}
memset(result, -1, UPRV_LENGTHOF(result));
errorCode.reset();
resultLength=stepToUnicode(cc, cnv.getAlias(),
result, UPRV_LENGTHOF(result),
@ -1615,8 +1619,12 @@ ConversionTest::FromUnicodeCase(ConversionCase &cc, UConverterFromUCallback call
ok=TRUE;
for(i=0; i<UPRV_LENGTHOF(steps) && ok; ++i) {
step=steps[i].step;
memset(resultOffsets, -1, UPRV_LENGTHOF(resultOffsets));
memset(result, -1, UPRV_LENGTHOF(result));
for (int32_t i = 0; i < UPRV_LENGTHOF(resultOffsets); i++) {
resultOffsets[i] = -1;
}
for (int32_t i = 0; i < UPRV_LENGTHOF(result); i++) {
result[i] = -1;
}
errorCode=U_ZERO_ERROR;
resultLength=stepFromUnicode(cc, cnv,
result, UPRV_LENGTHOF(result),

View file

@ -63,8 +63,9 @@ DateFormatRegressionTest::runIndexedTest( int32_t index, UBool exec, const char*
CASE(30,TestT10334)
CASE(31,TestT10619)
CASE(32,TestT10855)
CASE(33,TestT10906)
CASE(34,TestT13380)
CASE(33,TestT10858)
CASE(34,TestT10906)
CASE(35,TestT13380)
default: name = ""; break;
}
}
@ -1762,6 +1763,45 @@ void DateFormatRegressionTest::TestT13380(void) {
}
}
void DateFormatRegressionTest::TestT10858(void) {
// test for assignment operator on instances with the same locale but different TimeZoneFormat
UErrorCode status = U_ZERO_ERROR;
UnicodeString pattern("VVVV");
Locale loc("en_US");
// Make two identical Formats
SimpleDateFormat fmt_rhs(pattern, loc, status);
SimpleDateFormat fmt_lhs(pattern, loc, status);
// Setup a custom TimeZoneFormat
TimeZoneFormat* tzFmt = TimeZoneFormat::createInstance(Locale("de_DE"), status);
tzFmt->setGMTPattern(UnicodeString("UTC{0}"), status);
tzFmt->setGMTZeroFormat(UnicodeString("UTC"), status);
// Set custom TimeZoneFormat in fmt1 before assignment. Use
// adoptTimeZoneFormat instead of setTimeZoneFormat to delegate
// cleanup of tzFmt to SimpleDateFormat
fmt_rhs.adoptTimeZoneFormat(tzFmt);
// Make sure TimeZoneFormat is DIFFERENT between fmt_lhs & fmt_rhs at this point.
// Direct comparison with TimeZoneFormat::operator== does not suffice as it only
// checks for 'semantically equal' rather than 'identical' -- compare results of
// SimpleDateFormat::format() instead
UnicodeString res_rhs; fmt_rhs.format(0.0, res_rhs);
UnicodeString res_lhs_pre_assign; fmt_lhs.format(0.0, res_lhs_pre_assign);
if (res_lhs_pre_assign == res_rhs) {
errln(UnicodeString("Error: adoptTimeZoneFormat failed to set custom TimeZoneFormat into 'fmt_rhs'"));
}
// Invoke assignment operator and make sure formatted outputs from both objects are
// now identical (i.e. TimeZoneFormat, among other members, is correctly copied to LHS)
fmt_lhs = fmt_rhs;
UnicodeString res_lhs_post_assign; fmt_lhs.format(0.0, res_lhs_post_assign);
if (res_lhs_post_assign != res_rhs) {
errln(UnicodeString("Error: assigned instance did not take up TimeZoneFormat from original"));
}
}
#endif /* #if !UCONFIG_NO_FORMATTING */
//eof

View file

@ -59,6 +59,7 @@ public:
void TestT10334(void);
void TestT10619(void);
void TestT10855(void);
void TestT10858(void);
void TestT10906(void);
void TestT13380(void);
};

View file

@ -470,7 +470,14 @@ void DateFormatRoundTripTest::test(DateFormat *fmt, const Locale &origLocale, UB
} else if(!strcmp(type,"hebrew")) {
maxSmatch = 3;
maxDmatch = 3;
}
} else if (timeOnly && uprv_strcmp(origLocale.getName(),"ar_JO@calendar=islamic-civil")==0 &&
logKnownIssue("21049", "ar_JO@calendar=islamic-civil timeOnly roundtrip converges too slowly")) {
// For some reason, for time-only tests, ar_JO@calendar=islamic-civil is no
// longer converging to a match as fast as expected above. Investigate with
// ICU-21022, but meanwhile allow more cycles for convergence.
maxSmatch = 2;
maxDmatch = 3;
}
}
// Use @v to see verbose results on successful cases
@ -478,7 +485,9 @@ void DateFormatRoundTripTest::test(DateFormat *fmt, const Locale &origLocale, UB
if (optionv || fail) {
if (fail) {
errln(UnicodeString("\nFAIL: Pattern: ") + pat +
" in Locale: " + origLocale.getName());
" in Locale: " + origLocale.getName() +
"\nget dmatch: " + dmatch + " (expected max " + maxDmatch +
"), smatch: " + smatch + " (expected max " + maxSmatch + ")");
} else {
errln(UnicodeString("\nOk: Pattern: ") + pat +
" in Locale: " + origLocale.getName());

View file

@ -152,7 +152,7 @@ private:
const char* identifier,
const char** subIdentifiers,
int32_t subIdentifierCount);
void verifySequenceUnit(
void verifyMixedUnit(
const MeasureUnit& unit,
const char* identifier,
const char** subIdentifiers,
@ -3368,10 +3368,10 @@ void MeasureFormatTest::TestCompoundUnitOperations() {
MeasureUnit inchFoot = MeasureUnit::forIdentifier("inch-and-foot", status);
const char* footInchSub[] = {"foot", "inch"};
verifySequenceUnit(footInch, "foot-and-inch",
verifyMixedUnit(footInch, "foot-and-inch",
footInchSub, UPRV_LENGTHOF(footInchSub));
const char* inchFootSub[] = {"inch", "foot"};
verifySequenceUnit(inchFoot, "inch-and-foot",
verifyMixedUnit(inchFoot, "inch-and-foot",
inchFootSub, UPRV_LENGTHOF(inchFootSub));
assertTrue("order matters inequality", footInch != inchFoot);
@ -3575,12 +3575,12 @@ void MeasureFormatTest::verifyCompoundUnit(
}
}
void MeasureFormatTest::verifySequenceUnit(
void MeasureFormatTest::verifyMixedUnit(
const MeasureUnit& unit,
const char* identifier,
const char** subIdentifiers,
int32_t subIdentifierCount) {
IcuTestErrorCode status(*this, "verifySequenceUnit");
IcuTestErrorCode status(*this, "verifyMixedUnit");
UnicodeString uid(identifier, -1, US_INV);
assertEquals(uid + ": Identifier",
identifier,
@ -3590,7 +3590,7 @@ void MeasureFormatTest::verifySequenceUnit(
unit == MeasureUnit::forIdentifier(identifier, status));
status.errIfFailureAndReset("%s: Constructor", identifier);
assertEquals(uid + ": Complexity",
UMEASURE_UNIT_SEQUENCE,
UMEASURE_UNIT_MIXED,
unit.getComplexity(status));
status.errIfFailureAndReset("%s: Complexity", identifier);

File diff suppressed because it is too large Load diff

View file

@ -257,6 +257,7 @@ class NumberSkeletonTest : public IntlTest {
void stemsRequiringOption();
void defaultTokens();
void flexibleSeparators();
void wildcardCharacters();
void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par = 0);

View file

@ -16,6 +16,9 @@
#include "number_utils.h"
#include "numbertest.h"
#include "unicode/utypes.h"
#include "number_utypes.h"
using number::impl::UFormattedNumberData;
// Horrible workaround for the lack of a status code in the constructor...
// (Also affects numbertest_range.cpp)
@ -206,7 +209,7 @@ void NumberFormatterApiTest::notationScientific() {
assertFormatDescending(
u"Scientific min exponent digits",
u"scientific/+ee",
u"scientific/*ee",
u"E00",
NumberFormatter::with().notation(Notation::scientific().withMinExponentDigits(2)),
Locale::getEnglish(),
@ -1036,7 +1039,7 @@ void NumberFormatterApiTest::roundingFraction() {
assertFormatDescending(
u"Min Fraction",
u".0+",
u".0*",
u".0+",
NumberFormatter::with().precision(Precision::minFraction(1)),
Locale::getEnglish(),
@ -1113,7 +1116,7 @@ void NumberFormatterApiTest::roundingFigures() {
assertFormatSingle(
u"Min Significant",
u"@@+",
u"@@*",
u"@@+",
NumberFormatter::with().precision(Precision::minSignificantDigits(2)),
Locale::getEnglish(),
@ -1150,7 +1153,7 @@ void NumberFormatterApiTest::roundingFigures() {
assertFormatSingle(
u"Fixed Significant on zero with zero integer width",
u"@ integer-width/+",
u"@ integer-width/*",
u"@ integer-width/+",
NumberFormatter::with().precision(Precision::fixedSignificantDigits(1))
.integerWidth(IntegerWidth::zeroFillTo(0)),
@ -1178,7 +1181,7 @@ void NumberFormatterApiTest::roundingFractionFigures() {
assertFormatDescending(
u"FracSig minMaxFrac minSig",
u".0#/@@@+",
u".0#/@@@*",
u".0#/@@@+",
NumberFormatter::with().precision(Precision::minMaxFraction(1, 2).withMinDigits(3)),
Locale::getEnglish(),
@ -1226,7 +1229,7 @@ void NumberFormatterApiTest::roundingFractionFigures() {
assertFormatSingle(
u"FracSig with trailing zeros A",
u".00/@@@+",
u".00/@@@*",
u".00/@@@+",
NumberFormatter::with().precision(Precision::fixedFraction(2).withMinDigits(3)),
Locale::getEnglish(),
@ -1235,7 +1238,7 @@ void NumberFormatterApiTest::roundingFractionFigures() {
assertFormatSingle(
u"FracSig with trailing zeros B",
u".00/@@@+",
u".00/@@@*",
u".00/@@@+",
NumberFormatter::with().precision(Precision::fixedFraction(2).withMinDigits(3)),
Locale::getEnglish(),
@ -1804,7 +1807,7 @@ void NumberFormatterApiTest::integerWidth() {
assertFormatDescending(
u"Integer Width Zero Fill 0",
u"integer-width/+",
u"integer-width/*",
u"integer-width/+",
NumberFormatter::with().integerWidth(IntegerWidth::zeroFillTo(0)),
Locale::getEnglish(),
@ -2730,9 +2733,10 @@ void NumberFormatterApiTest::fieldPositionLogic() {
UPRV_LENGTHOF(expectedFieldPositions));
// Test the iteration functionality of nextFieldPosition
FieldPosition actual = {UNUM_GROUPING_SEPARATOR_FIELD};
ConstrainedFieldPosition actual;
actual.constrainField(UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD);
int32_t i = 1;
while (fmtd.nextFieldPosition(actual, status)) {
while (fmtd.nextPosition(actual, status)) {
UFieldPosition expected = expectedFieldPositions[i++];
assertEquals(
UnicodeString(u"Next for grouping, field, case #") + Int64ToUnicodeString(i),
@ -2741,18 +2745,19 @@ void NumberFormatterApiTest::fieldPositionLogic() {
assertEquals(
UnicodeString(u"Next for grouping, begin index, case #") + Int64ToUnicodeString(i),
expected.beginIndex,
actual.getBeginIndex());
actual.getStart());
assertEquals(
UnicodeString(u"Next for grouping, end index, case #") + Int64ToUnicodeString(i),
expected.endIndex,
actual.getEndIndex());
actual.getLimit());
}
assertEquals(u"Should have seen all grouping separators", 4, i);
// Make sure strings without fraction do not contain fraction field
actual = {UNUM_FRACTION_FIELD};
actual.reset();
actual.constrainField(UFIELD_CATEGORY_NUMBER, UNUM_FRACTION_FIELD);
fmtd = NumberFormatter::withLocale("en").formatInt(5, status);
assertFalse(u"No fraction part in an integer", fmtd.nextFieldPosition(actual, status));
assertFalse(u"No fraction part in an integer", fmtd.nextPosition(actual, status));
}
void NumberFormatterApiTest::fieldPositionCoverage() {
@ -3064,10 +3069,18 @@ void NumberFormatterApiTest::toFormat() {
dynamic_cast<LocalizedNumberFormatterAsFormat*>(format.getAlias())->getNumberFormatter()
.toSkeleton(status));
UFormattedNumberData result;
result.quantity.setToDouble(514.23);
lnf.formatImpl(&result, status);
FieldPositionIterator fpi1;
lnf.formatDouble(514.23, status).getAllFieldPositions(fpi1, status);
{
FieldPositionIteratorHandler fpih(&fpi1, status);
result.getAllFieldPositions(fpih, status);
}
FieldPositionIterator fpi2;
format->format(514.23, sb.remove(), &fpi2, status);
assertTrue("Should produce same field position iterator", fpi1 == fpi2);
}
@ -3119,19 +3132,20 @@ void NumberFormatterApiTest::errors() {
"Terminal toSkeleton on error object should be bogus",
output.isBogus());
// FieldPosition
// FieldPosition (constrained category)
status = U_ZERO_ERROR;
FieldPosition fp;
fn.nextFieldPosition(fp, status);
ConstrainedFieldPosition fp;
fp.constrainCategory(UFIELD_CATEGORY_NUMBER);
fn.nextPosition(fp, status);
assertEquals(
"Should fail on FieldPosition terminal method with correct error code",
U_NUMBER_ARG_OUTOFBOUNDS_ERROR,
status);
// FieldPositionIterator
// FieldPositionIterator (no constraints)
status = U_ZERO_ERROR;
FieldPositionIterator fpi;
fn.getAllFieldPositions(fpi, status);
fp.reset();
fn.nextPosition(fp, status);
assertEquals(
"Should fail on FieldPositoinIterator terminal method with correct error code",
U_NUMBER_ARG_OUTOFBOUNDS_ERROR,
@ -3592,64 +3606,6 @@ void NumberFormatterApiTest::assertNumberFieldPositions(
UFIELD_CATEGORY_NUMBER,
expectedFieldPositions,
length);
// Check FormattedNumber-specific functions
UnicodeString baseMessage = UnicodeString(message) + u": " + formattedNumber.toString(status) + u": ";
FieldPositionIterator fpi;
formattedNumber.getAllFieldPositions(fpi, status);
int32_t i = 0;
FieldPosition actual;
while (fpi.next(actual)) {
UFieldPosition expected = expectedFieldPositions[i++];
assertEquals(
baseMessage + UnicodeString(u"Field, case #") + Int64ToUnicodeString(i),
expected.field,
actual.getField());
assertEquals(
baseMessage + UnicodeString(u"Iterator, begin, case #") + Int64ToUnicodeString(i),
expected.beginIndex,
actual.getBeginIndex());
assertEquals(
baseMessage + UnicodeString(u"Iterator, end, case #") + Int64ToUnicodeString(i),
expected.endIndex,
actual.getEndIndex());
// Check for the first location of the field
FieldPosition actual2(expected.field);
// Fast-forward the field to skip previous occurrences of the field:
actual2.setBeginIndex(expected.beginIndex);
actual2.setEndIndex(expected.beginIndex);
UBool found = formattedNumber.nextFieldPosition(actual2, status);
assertEquals(
baseMessage + UnicodeString(u"Next, found first, case #") + Int64ToUnicodeString(i),
(UBool) TRUE,
found);
assertEquals(
baseMessage + UnicodeString(u"Next, begin, case #") + Int64ToUnicodeString(i),
expected.beginIndex,
actual2.getBeginIndex());
assertEquals(
baseMessage + UnicodeString(u"Next, end, case #") + Int64ToUnicodeString(i),
expected.endIndex,
actual2.getEndIndex());
// The next position should be empty unless the field occurs again
UBool occursAgain = false;
for (int32_t j=i; j<length; j++) {
if (expectedFieldPositions[j].field == expected.field) {
occursAgain = true;
break;
}
}
if (!occursAgain) {
found = formattedNumber.nextFieldPosition(actual2, status);
assertEquals(
baseMessage + UnicodeString(u"Next, found second, case #") + Int64ToUnicodeString(i),
(UBool) FALSE,
found);
}
}
assertEquals(baseMessage + u"Should have seen every field position", length, i);
}

View file

@ -29,6 +29,7 @@ void NumberSkeletonTest::runIndexedTest(int32_t index, UBool exec, const char*&
TESTCASE_AUTO(stemsRequiringOption);
TESTCASE_AUTO(defaultTokens);
TESTCASE_AUTO(flexibleSeparators);
TESTCASE_AUTO(wildcardCharacters);
TESTCASE_AUTO_END;
}
@ -41,26 +42,35 @@ void NumberSkeletonTest::validTokens() {
u"precision-integer",
u"precision-unlimited",
u"@@@##",
u"@@*",
u"@@+",
u".000##",
u".00*",
u".00+",
u".",
u".*",
u".+",
u".######",
u".00/@@*",
u".00/@@+",
u".00/@##",
u"precision-increment/3.14",
u"precision-currency-standard",
u"precision-integer rounding-mode-half-up",
u".00# rounding-mode-ceiling",
u".00/@@* rounding-mode-floor",
u".00/@@+ rounding-mode-floor",
u"scientific",
u"scientific/*ee",
u"scientific/+ee",
u"scientific/sign-always",
u"scientific/*ee/sign-always",
u"scientific/+ee/sign-always",
u"scientific/sign-always/*ee",
u"scientific/sign-always/+ee",
u"scientific/sign-except-zero",
u"engineering",
u"engineering/*eee",
u"engineering/+eee",
u"compact-short",
u"compact-long",
@ -81,6 +91,7 @@ void NumberSkeletonTest::validTokens() {
u"group-thousands",
u"integer-width/00",
u"integer-width/#0",
u"integer-width/*00",
u"integer-width/+00",
u"sign-always",
u"sign-auto",
@ -136,16 +147,22 @@ void NumberSkeletonTest::invalidTokens() {
static const char16_t* cases[] = {
u".00x",
u".00##0",
u".##*",
u".00##*",
u".0#*",
u"@#*",
u".##+",
u".00##+",
u".0#+",
u"@#+",
u"@@x",
u"@@##0",
u"@#+",
u".00/@",
u".00/@@",
u".00/@@x",
u".00/@@#",
u".00/@@#*",
u".00/floor/@@*", // wrong order
u".00/@@#+",
u".00/floor/@@+", // wrong order
u"precision-increment/français", // non-invariant characters for C++
@ -161,6 +178,10 @@ void NumberSkeletonTest::invalidTokens() {
u"currency/ççç", // three characters but not ASCII
u"measure-unit/foo",
u"integer-width/xxx",
u"integer-width/0*",
u"integer-width/*0#",
u"integer-width/*#",
u"integer-width/*#0",
u"integer-width/0+",
u"integer-width/+0#",
u"integer-width/+#",
@ -177,6 +198,7 @@ void NumberSkeletonTest::invalidTokens() {
u"EEE",
u"EEE0",
u"001",
u"00*",
u"00+",
};
@ -304,6 +326,32 @@ void NumberSkeletonTest::flexibleSeparators() {
}
}
void NumberSkeletonTest::wildcardCharacters() {
IcuTestErrorCode status(*this, "wildcardCharacters");
struct TestCase {
const char16_t* star;
const char16_t* plus;
} cases[] = {
{ u".00*", u".00+" },
{ u"@@*", u"@@+" },
{ u".00/@@*", u".00/@@+" },
{ u"scientific/*ee", u"scientific/+ee" },
{ u"integer-width/*00", u"integer-width/+00" },
};
for (const auto& cas : cases) {
UnicodeString star(cas.star);
UnicodeString plus(cas.plus);
status.setScope(star);
UnicodeString normalized = NumberFormatter::forSkeleton(plus, status)
.toSkeleton(status);
assertEquals("Plus should normalize to star", star, normalized);
status.errIfFailureAndReset();
}
}
// In C++, there is no distinguishing between "invalid", "unknown", and "unexpected" tokens.
void NumberSkeletonTest::expectedErrorSkeleton(const char16_t** cases, int32_t casesLen) {
for (int32_t i = 0; i < casesLen; i++) {

View file

@ -2172,6 +2172,10 @@ void NumberFormatTest::TestCurrencyUnit(void){
static const char INV8[] = "{$%";
static const UChar ZZZ[] = u"zz";
static const char ZZZ8[] = "zz";
static const UChar JPY[] = u"JPY";
static const char JPY8[] = "JPY";
static const UChar jpy[] = u"jpy";
static const char jpy8[] = "jpy";
UChar* EUR = (UChar*) malloc(6);
EUR[0] = u'E';
@ -2289,6 +2293,27 @@ void NumberFormatTest::TestCurrencyUnit(void){
assertEquals("Copying from meter should fail", ec, U_ILLEGAL_ARGUMENT_ERROR);
assertEquals("Copying should not give uninitialized ISO code", u"", failure.getISOCurrency());
// Test equality
ec = U_ZERO_ERROR;
assertFalse("FAIL: USD == JPY", CurrencyUnit(USD, ec) == CurrencyUnit(JPY, ec));
assertTrue("FAIL: USD != USD", CurrencyUnit(USD, ec) == CurrencyUnit(USD, ec));
assertTrue("FAIL: JPY != jpy", CurrencyUnit(JPY, ec) == CurrencyUnit(jpy, ec));
assertTrue("FAIL: jpy != JPY", CurrencyUnit(jpy, ec) == CurrencyUnit(JPY, ec));
// Test equality with system charset instances
assertFalse("FAIL: USD8 == JPY8", CurrencyUnit(USD8, ec) == CurrencyUnit(JPY8, ec));
assertTrue("FAIL: USD8 != USD8", CurrencyUnit(USD8, ec) == CurrencyUnit(USD8, ec));
assertTrue("FAIL: JPY8 != jpy8", CurrencyUnit(JPY8, ec) == CurrencyUnit(jpy8, ec));
assertTrue("FAIL: jpy8 != JPY8", CurrencyUnit(jpy8, ec) == CurrencyUnit(JPY8, ec));
// Test equality between UTF-16 and system charset instances
assertTrue("FAIL: USD != USD8", CurrencyUnit(USD, ec) == CurrencyUnit(USD8, ec));
assertTrue("FAIL: USD8 != USD", CurrencyUnit(USD8, ec) == CurrencyUnit(USD, ec));
assertTrue("FAIL: JPY != jpy8", CurrencyUnit(JPY, ec) == CurrencyUnit(jpy8, ec));
assertTrue("FAIL: JPY8 != jpy", CurrencyUnit(JPY8, ec) == CurrencyUnit(jpy, ec));
assertTrue("FAIL: jpy != JPY8", CurrencyUnit(jpy, ec) == CurrencyUnit(JPY8, ec));
assertTrue("FAIL: jpy8 != JPY", CurrencyUnit(jpy8, ec) == CurrencyUnit(JPY, ec));
free(EUR);
free(EUR8);
}

View file

@ -1639,8 +1639,9 @@ std::string RBBIMonkeyKind::classNameFromCodepoint(const UChar32 c) {
unsigned int RBBIMonkeyKind::maxClassNameSize() {
unsigned int maxSize = 0;
for (int aClassNum = 0; aClassNum < charClasses()->size(); aClassNum++) {
if (classNames[aClassNum].size() > maxSize) {
maxSize = classNames[aClassNum].size();
auto aClassNumSize = static_cast<unsigned int>(classNames[aClassNum].size());
if (aClassNumSize > maxSize) {
maxSize = aClassNumSize;
}
}
return maxSize;
@ -4284,7 +4285,7 @@ void RBBITest::RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, const char *name
u_charName(c, U_EXTENDED_CHAR_NAME, cName, sizeof(cName), &status);
char buffer[200];
snprintf(buffer, 200,
auto ret = snprintf(buffer, UPRV_LENGTHOF(buffer),
"%4s %3i : %1s %1s %10s %-*s %-40s %-40s",
currentLineFlag.c_str(),
ci,
@ -4294,6 +4295,8 @@ void RBBITest::RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, const char *name
classNameSize,
mk.classNameFromCodepoint(c).c_str(),
mk.getAppliedRule(ci).c_str(), cName);
(void)ret;
U_ASSERT(0 <= ret && ret < UPRV_LENGTHOF(buffer));
// Output the error
if (ci == i) {

View file

@ -166,7 +166,7 @@ void
StringTest::TestUpperOrdinal() {
for (int32_t i = 0;; ++i) {
char ic = nativeInvChars[i];
uint8_t ac = asciiInvChars[i];
uint8_t ac = static_cast<uint8_t>(asciiInvChars[i]);
int32_t expected = ac - 'A';
int32_t actual = uprv_upperOrdinal(ic);
if (0 <= expected && expected <= 25) {
@ -188,7 +188,7 @@ void
StringTest::TestLowerOrdinal() {
for (int32_t i = 0;; ++i) {
char ic = nativeInvChars[i];
uint8_t ac = asciiInvChars[i];
uint8_t ac = static_cast<uint8_t>(asciiInvChars[i]);
int32_t expected = ac - 'a';
int32_t actual = uprv_lowerOrdinal(ic);
if (0 <= expected && expected <= 25) {
@ -506,7 +506,7 @@ StringTest::TestStringPieceOther() {
Other other;
StringPiece piece(other);
assertEquals("size()", piece.size(), other.size());
assertEquals("size()", piece.size(), static_cast<int32_t>(other.size()));
assertEquals("data()", piece.data(), other.data());
}

View file

@ -2540,3 +2540,46 @@
# Before ICU 55, the following reordered together with Gothic.
<1 𐌈 # Old Italic
<1 𐑐 # Shavian
# Check for presence of certain chars 乛冂刂卜又小彑艹日月爫牛辶 in
# zh pinyin and stroke, ICU-13790
# (bracket pinyin test with 卬..作, stroke test with 一..乾)
** test: DataDrivenCollationTest/VerifyCertainCharsInPinyin
@ locale zh-u-co-pinyin
* compare
< 卬
< 卜
< 艹
< 辶
< 刂
< 彑
< 冂
< 牛
< 日
< 小
< 乛
< 又
< 月
< 爫
< 作
** test: DataDrivenCollationTest/VerifyCertainCharsInStroke
@ locale zh-u-co-stroke
* compare
< 一
< 乛
< 冂
< 刂
< 卜
< 又
< 小
< 彑
< 艹
< 日
< 月
< 爫
< 牛
< 辶
< 乾

View file

@ -69,7 +69,7 @@
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
<OutputFile>..\..\..\$(IcuBinOutputDir)\icutest66d.exe</OutputFile>
<OutputFile>..\..\..\$(IcuBinOutputDir)\icutest67d.exe</OutputFile>
<ProgramDatabaseFile>.\..\..\..\$(IcuLibOutputDir)\icutestd.pdb</ProgramDatabaseFile>
<ImportLibrary>.\..\..\..\$(IcuLibOutputDir)\icutestd.lib</ImportLibrary>
<AdditionalDependencies>icuucd.lib;icutud.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -82,7 +82,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
</ClCompile>
<Link>
<OutputFile>..\..\..\$(IcuBinOutputDir)\icutest66.exe</OutputFile>
<OutputFile>..\..\..\$(IcuBinOutputDir)\icutest67.exe</OutputFile>
<ProgramDatabaseFile>.\..\..\..\$(IcuLibOutputDir)\icutest.pdb</ProgramDatabaseFile>
<ImportLibrary>.\..\..\..\$(IcuLibOutputDir)\icutest.lib</ImportLibrary>
<AdditionalDependencies>icuuc.lib;icutu.lib;%(AdditionalDependencies)</AdditionalDependencies>

View file

@ -412,7 +412,8 @@ storeMapping(uint32_t codepoint, uint32_t* mapping,int32_t length,
int16_t delta = (int16_t)((int32_t)codepoint - (int16_t) mapping[0]);
if(delta >= SPREP_DELTA_RANGE_NEGATIVE_LIMIT && delta <= SPREP_DELTA_RANGE_POSITIVE_LIMIT){
trieWord = delta << 2;
trieWord = delta;
trieWord <<= 2;
/* make sure that the second bit is OFF */

View file

@ -46,6 +46,7 @@
#include "flagparser.h"
#include "filetools.h"
#include "charstr.h"
#include "uassert.h"
#if U_HAVE_POPEN
# include <unistd.h>
@ -1132,12 +1133,15 @@ static int32_t pkg_installLibrary(const char *installDir, const char *targetDir,
int32_t result = 0;
char cmd[SMALL_BUFFER_MAX_SIZE];
sprintf(cmd, "cd %s && %s %s %s%s%s",
auto ret = snprintf(cmd,
SMALL_BUFFER_MAX_SIZE,
"cd %s && %s %s %s%s%s",
targetDir,
pkgDataFlags[INSTALL_CMD],
libFileNames[LIB_FILE_VERSION],
installDir, PKGDATA_FILE_SEP_STRING, libFileNames[LIB_FILE_VERSION]
);
installDir, PKGDATA_FILE_SEP_STRING, libFileNames[LIB_FILE_VERSION]);
(void)ret;
U_ASSERT(0 <= ret && ret < SMALL_BUFFER_MAX_SIZE);
result = runCommand(cmd);
@ -1255,10 +1259,14 @@ static int32_t pkg_installFileMode(const char *installDir, const char *srcDir, c
buffer[bufferLength-1] = 0;
}
sprintf(cmd, "%s %s%s%s %s%s%s",
auto ret = snprintf(cmd,
SMALL_BUFFER_MAX_SIZE,
"%s %s%s%s %s%s%s",
pkgDataFlags[INSTALL_CMD],
srcDir, PKGDATA_FILE_SEP_STRING, buffer,
installDir, PKGDATA_FILE_SEP_STRING, buffer);
(void)ret;
U_ASSERT(0 <= ret && ret < SMALL_BUFFER_MAX_SIZE);
result = runCommand(cmd);
if (result != 0) {
@ -1690,12 +1698,20 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
break;
}
}
sprintf(newName, "%s_%s",
auto ret = snprintf(newName,
SMALL_BUFFER_MAX_SIZE,
"%s_%s",
DATA_PREFIX[n],
newNameTmp);
sprintf(dataName, "%s_%s",
(void)ret;
U_ASSERT(0 <= ret && ret < SMALL_BUFFER_MAX_SIZE);
ret = snprintf(dataName,
SMALL_BUFFER_MAX_SIZE,
"%s_%s",
o->shortName,
DATA_PREFIX[n]);
(void)ret;
U_ASSERT(0 <= ret && ret < SMALL_BUFFER_MAX_SIZE);
}
if (newName[0] != 0) {
break;

View file

@ -421,9 +421,9 @@ writeCCode(
filename,
destdir,
buffer,
sizeof(buffer),
static_cast<int32_t>(sizeof(buffer)),
entry + uprv_strlen(entry),
sizeof(entry) - uprv_strlen(entry),
static_cast<int32_t>(sizeof(entry) - uprv_strlen(entry)),
".c",
optFilename);
@ -682,7 +682,7 @@ getOutFilename(
outFilenameBuilder.append(destdir, status);
outFilenameBuilder.ensureEndsWithFileSeparator(status);
} else {
outFilenameBuilder.append(inFilename, basename - inFilename, status);
outFilenameBuilder.append(inFilename, static_cast<int32_t>(basename - inFilename), status);
}
inFilename=basename;

View file

@ -90,7 +90,7 @@
<TypeLibraryName>.\..\..\..\lib\icutu.tlb</TypeLibraryName>
</Midl>
<Link>
<OutputFile>..\..\..\bin\icutu66.dll</OutputFile>
<OutputFile>..\..\..\bin\icutu67.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\..\lib\icutu.pdb</ProgramDatabaseFile>
<DataExecutionPrevention>
</DataExecutionPrevention>
@ -102,7 +102,7 @@
<TypeLibraryName>.\..\..\..\lib\icutud.tlb</TypeLibraryName>
</Midl>
<Link>
<OutputFile>..\..\..\bin\icutu66d.dll</OutputFile>
<OutputFile>..\..\..\bin\icutu67d.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\..\lib\icutud.pdb</ProgramDatabaseFile>
<DataExecutionPrevention>
</DataExecutionPrevention>
@ -129,7 +129,7 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
</ClCompile>
<Link>
<OutputFile>..\..\..\bin64\icutu66.dll</OutputFile>
<OutputFile>..\..\..\bin64\icutu67.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\..\lib64\icutu.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\..\lib64\icutu.lib</ImportLibrary>
</Link>
@ -139,7 +139,7 @@
<TypeLibraryName>.\..\..\..\lib64\icutud.tlb</TypeLibraryName>
</Midl>
<Link>
<OutputFile>..\..\..\bin64\icutu66d.dll</OutputFile>
<OutputFile>..\..\..\bin64\icutu67d.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\..\lib64\icutud.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\..\lib64\icutud.lib</ImportLibrary>
</Link>
@ -160,7 +160,7 @@
<TypeLibraryName>..\..\..\libARM\icutu.tlb</TypeLibraryName>
</Midl>
<Link>
<OutputFile>..\..\..\binARM\icutu66.dll</OutputFile>
<OutputFile>..\..\..\binARM\icutu67.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\..\libARM\icutu.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\..\libARM\icutu.lib</ImportLibrary>
</Link>
@ -173,7 +173,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>..\..\..\binARM\icutu66d.dll</OutputFile>
<OutputFile>..\..\..\binARM\icutu67d.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\..\libARM\icutud.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\..\libARM\icutud.lib</ImportLibrary>
</Link>
@ -194,7 +194,7 @@
<TypeLibraryName>.\..\..\..\libARM64\icutu.tlb</TypeLibraryName>
</Midl>
<Link>
<OutputFile>..\..\..\binARM64\icutu66.dll</OutputFile>
<OutputFile>..\..\..\binARM64\icutu67.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\..\libARM64\icutu.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\..\libARM64\icutu.lib</ImportLibrary>
</Link>
@ -207,7 +207,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>..\..\..\binARM64\icutu66d.dll</OutputFile>
<OutputFile>..\..\..\binARM64\icutu67d.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\..\libARM64\icutud.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\..\libARM64\icutud.lib</ImportLibrary>
</Link>

View file

@ -2,75 +2,257 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- © 2019 and later: Unicode, Inc. and others. -->
<!-- © 2020 and later: Unicode, Inc. and others. -->
<!-- License & terms of use: http://www.unicode.org/copyright.html#License -->
<title>ICU4J API Comparison: ICU4J 65.1 with ICU4J 66.0.1</title>
<title>ICU4J API Comparison: ICU4J 66.1 with ICU4J 67.1</title>
</head>
<body>
<h1>ICU4J API Comparison: ICU4J 65.1 with ICU4J 66.0.1</h1>
<h1>ICU4J API Comparison: ICU4J 66.1 with ICU4J 67.1</h1>
<hr/>
<h2>Removed from ICU4J 65.1</h2>
<p>(no API removed)</p>
<h2>Removed from ICU4J 66.1</h2>
<h3>Package com.ibm.icu.number</h3>
<ul>
FormattedNumber
<ul>
<li><span style='color:orange'>(draft)</span> public boolean <i>equals</i>(java.lang.Object)</li>
<li><span style='color:orange'>(draft)</span> public int <i>hashCode</i>()</li>
<li><span style='color:orange'>(draft)</span> public boolean <i>nextFieldPosition</i>(java.text.FieldPosition)</li>
</ul>
FormattedNumberRange
<ul>
<li><span style='color:orange'>(draft)</span> public boolean <i>nextFieldPosition</i>(java.text.FieldPosition)</li>
</ul>
Precision
<ul>
<li><span style='color:orange'>(draft)</span> public java.lang.Object <i>clone</i>()</li>
</ul>
ScientificNotation
<ul>
<li><span style='color:orange'>(draft)</span> public java.lang.Object <i>clone</i>()</li>
</ul>
</ul>
<hr/>
<h2>Deprecated or Obsoleted in ICU4J 66.0.1</h2>
<h2>Deprecated or Obsoleted in ICU4J 67.1</h2>
<p>(no API obsoleted)</p>
<hr/>
<h2>Changed in ICU4J 66.0.1 (old, new)</h2>
<p>(no API changed)</p>
<h2>Changed in ICU4J 67.1 (old, new)</h2>
<h3>Package com.ibm.icu.number</h3>
<ul>
<li> <span style='color:green'>(stable)</span> public abstract class <i>Precision</i> extends java.lang.Object implements java.lang.Cloneable</br>
<span style='color:green'>(stable)</span> public abstract class <i>Precision</i> extends java.lang.Object</li>
<li> <span style='color:green'>(stable)</span> public class <i>ScientificNotation</i> extends com.ibm.icu.number.Notation implements java.lang.Cloneable</br>
<span style='color:green'>(stable)</span> public class <i>ScientificNotation</i> extends com.ibm.icu.number.Notation</li>
</ul>
<hr/>
<h2>Promoted to stable in ICU4J 66.0.1</h2>
<p>(no API promoted to stable)</p>
<h2>Promoted to stable in ICU4J 67.1</h2>
<hr/>
<h2>Added in ICU4J 66.0.1</h2>
<h3>Package com.ibm.icu.number</h3>
<ul>
FormattedNumber
<ul>
<li><span style='color:green'>(stable)</span> public char <i>charAt</i>(int)</li>
<li><span style='color:green'>(stable)</span> public int <i>length</i>()</li>
<li><span style='color:green'>(stable)</span> public boolean <i>nextPosition</i>(ConstrainedFieldPosition)</li>
<li><span style='color:green'>(stable)</span> public java.lang.CharSequence <i>subSequence</i>(int, int)</li>
</ul>
FormattedNumberRange
<ul>
<li><span style='color:green'>(stable)</span> public char <i>charAt</i>(int)</li>
<li><span style='color:green'>(stable)</span> public boolean <i>equals</i>(java.lang.Object)</li>
<li><span style='color:green'>(stable)</span> public int <i>hashCode</i>()</li>
<li><span style='color:green'>(stable)</span> public int <i>length</i>()</li>
<li><span style='color:green'>(stable)</span> public boolean <i>nextPosition</i>(ConstrainedFieldPosition)</li>
<li><span style='color:green'>(stable)</span> public java.lang.CharSequence <i>subSequence</i>(int, int)</li>
</ul>
</ul>
<h3>Package com.ibm.icu.lang</h3>
<h3>Package com.ibm.icu.text</h3>
<ul>
UCharacter.IndicPositionalCategory
<li><span style='color:green'>(stable)</span> public class <i>ConstrainedFieldPosition</i></li>
<li><span style='color:green'>(stable)</span> public static final class <i>DateIntervalFormat.FormattedDateInterval</i></li>
<li><span style='color:green'>(stable)</span> public static final class <i>DateIntervalFormat.SpanField</i></li>
<li><span style='color:green'>(stable)</span> public interface <i>FormattedValue</i></li>
<li><span style='color:green'>(stable)</span> public static class <i>RelativeDateTimeFormatter.Field</i></li>
<li><span style='color:green'>(stable)</span> public static class <i>RelativeDateTimeFormatter.FormattedRelativeDateTime</i></li>
<li><span style='color:green'>(stable)</span> public static abstract class <i>UFormat.SpanField</i></li>
DateFormatSymbols
<ul>
<li><span style='color:green'>(stable)</span> public static final int TOP_AND_BOTTOM_AND_LEFT</li>
<li><span style='color:green'>(stable)</span> public java.lang.String[] <i>getNarrowEras</i>()</li>
<li><span style='color:green'>(stable)</span> public void <i>setNarrowEras</i>(java.lang.String[])</li>
</ul>
UCharacter.UnicodeBlock
DateIntervalFormat
<ul>
<li><span style='color:green'>(stable)</span> public static final UCharacter.UnicodeBlock CHORASMIAN</li>
<li><span style='color:green'>(stable)</span> public static final int CHORASMIAN_ID</li>
<li><span style='color:green'>(stable)</span> public static final UCharacter.UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_G</li>
<li><span style='color:green'>(stable)</span> public static final int CJK_UNIFIED_IDEOGRAPHS_EXTENSION_G_ID</li>
<li><span style='color:green'>(stable)</span> public static final UCharacter.UnicodeBlock DIVES_AKURU</li>
<li><span style='color:green'>(stable)</span> public static final int DIVES_AKURU_ID</li>
<li><span style='color:green'>(stable)</span> public static final UCharacter.UnicodeBlock KHITAN_SMALL_SCRIPT</li>
<li><span style='color:green'>(stable)</span> public static final int KHITAN_SMALL_SCRIPT_ID</li>
<li><span style='color:green'>(stable)</span> public static final UCharacter.UnicodeBlock LISU_SUPPLEMENT</li>
<li><span style='color:green'>(stable)</span> public static final int LISU_SUPPLEMENT_ID</li>
<li><span style='color:green'>(stable)</span> public static final UCharacter.UnicodeBlock SYMBOLS_FOR_LEGACY_COMPUTING</li>
<li><span style='color:green'>(stable)</span> public static final int SYMBOLS_FOR_LEGACY_COMPUTING_ID</li>
<li><span style='color:green'>(stable)</span> public static final UCharacter.UnicodeBlock TANGUT_SUPPLEMENT</li>
<li><span style='color:green'>(stable)</span> public static final int TANGUT_SUPPLEMENT_ID</li>
<li><span style='color:green'>(stable)</span> public static final UCharacter.UnicodeBlock YEZIDI</li>
<li><span style='color:green'>(stable)</span> public static final int YEZIDI_ID</li>
<li><span style='color:green'>(stable)</span> public DateIntervalFormat.FormattedDateInterval <i>formatToValue</i>(Calendar, Calendar)</li>
<li><span style='color:green'>(stable)</span> public DateIntervalFormat.FormattedDateInterval <i>formatToValue</i>(DateInterval)</li>
</ul>
UScript
DecimalFormat
<ul>
<li><span style='color:green'>(stable)</span> public static final int CHORASMIAN</li>
<li><span style='color:green'>(stable)</span> public static final int DIVES_AKURU</li>
<li><span style='color:green'>(stable)</span> public static final int KHITAN_SMALL_SCRIPT</li>
<li><span style='color:green'>(stable)</span> public static final int YEZIDI</li>
<li><span style='color:green'>(stable)</span> public synchronized int <i>getMinimumGroupingDigits</i>()</li>
<li><span style='color:green'>(stable)</span> public synchronized boolean <i>isParseCaseSensitive</i>()</li>
<li><span style='color:green'>(stable)</span> public synchronized boolean <i>isParseNoExponent</i>()</li>
<li><span style='color:green'>(stable)</span> public synchronized boolean <i>isSignAlwaysShown</i>()</li>
<li><span style='color:green'>(stable)</span> public synchronized void <i>setMinimumGroupingDigits</i>(int)</li>
<li><span style='color:green'>(stable)</span> public synchronized void <i>setParseCaseSensitive</i>(boolean)</li>
<li><span style='color:green'>(stable)</span> public synchronized void <i>setParseNoExponent</i>(boolean)</li>
<li><span style='color:green'>(stable)</span> public synchronized void <i>setSignAlwaysShown</i>(boolean)</li>
</ul>
NumberFormat.Field
<ul>
<li><span style='color:green'>(stable)</span> public static final NumberFormat.Field COMPACT</li>
<li><span style='color:green'>(stable)</span> public static final NumberFormat.Field MEASURE_UNIT</li>
</ul>
PluralRules
<ul>
<li><span style='color:green'>(stable)</span> public java.lang.String <i>select</i>(FormattedNumber)</li>
</ul>
RelativeDateTimeFormatter
<ul>
<li><span style='color:green'>(stable)</span> public RelativeDateTimeFormatter.FormattedRelativeDateTime <i>formatNumericToValue</i>(double, RelativeDateTimeFormatter.RelativeDateTimeUnit)</li>
<li><span style='color:green'>(stable)</span> public RelativeDateTimeFormatter.FormattedRelativeDateTime <i>formatToValue</i>(RelativeDateTimeFormatter.Direction, RelativeDateTimeFormatter.AbsoluteUnit)</li>
<li><span style='color:green'>(stable)</span> public RelativeDateTimeFormatter.FormattedRelativeDateTime <i>formatToValue</i>(double, RelativeDateTimeFormatter.Direction, RelativeDateTimeFormatter.RelativeUnit)</li>
<li><span style='color:green'>(stable)</span> public RelativeDateTimeFormatter.FormattedRelativeDateTime <i>formatToValue</i>(double, RelativeDateTimeFormatter.RelativeDateTimeUnit)</li>
</ul>
RelativeDateTimeFormatter.AbsoluteUnit
<ul>
<li><span style='color:green'>(stable)</span> public static final RelativeDateTimeFormatter.AbsoluteUnit QUARTER</li>
</ul>
</ul>
<h3>Package com.ibm.icu.util</h3>
<ul>
VersionInfo
BytesTrie
<ul>
<li><span style='color:green'>(stable)</span> public static final VersionInfo UNICODE_13_0</li>
<li><span style='color:green'>(stable)</span> public <i>BytesTrie</i>(BytesTrie)</li>
<li><span style='color:green'>(stable)</span> public long <i>getState64</i>()</li>
<li><span style='color:green'>(stable)</span> public BytesTrie <i>resetToState64</i>(long)</li>
</ul>
CharsTrie
<ul>
<li><span style='color:green'>(stable)</span> public <i>CharsTrie</i>(CharsTrie)</li>
<li><span style='color:green'>(stable)</span> public long <i>getState64</i>()</li>
<li><span style='color:green'>(stable)</span> public CharsTrie <i>resetToState64</i>(long)</li>
</ul>
MeasureUnit
<ul>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit BARREL</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit BRITISH_THERMAL_UNIT</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit DALTON</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit DAY_PERSON</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit DUNAM</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit EARTH_MASS</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit ELECTRONVOLT</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit FLUID_OUNCE_IMPERIAL</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit KILOPASCAL</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit MEGAPASCAL</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit MOLE</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit MONTH_PERSON</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit NEWTON</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit NEWTON_METER</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit PERMYRIAD</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit POUND_FOOT</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit POUND_FORCE</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit SOLAR_LUMINOSITY</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit SOLAR_MASS</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit SOLAR_RADIUS</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit WEEK_PERSON</li>
<li><span style='color:green'>(stable)</span> public static final MeasureUnit YEAR_PERSON</li>
</ul>
</ul>
<hr/>
<h2>Added in ICU4J 67.1</h2>
<h3>Package com.ibm.icu.number</h3>
<ul>
NumberFormatter.UnitWidth
<ul>
<li><span style='color:orange'>(draft)</span> public static final NumberFormatter.UnitWidth FORMAL</li>
<li><span style='color:orange'>(draft)</span> public static final NumberFormatter.UnitWidth VARIANT</li>
</ul>
</ul>
<h3>Package com.ibm.icu.text</h3>
<ul>
<li><span style='color:orange'>(draft)</span> public static final class <i>ListFormatter.Field</i></li>
<li><span style='color:orange'>(draft)</span> public static final class <i>ListFormatter.FormattedList</i></li>
<li><span style='color:orange'>(draft)</span> public static final class <i>ListFormatter.SpanField</i></li>
<li><span style='color:orange'>(draft)</span> public static enum <i>DateFormat.HourCycle</i></li>
<li><span style='color:orange'>(draft)</span> public static enum <i>ListFormatter.Type</i></li>
<li><span style='color:orange'>(draft)</span> public static enum <i>ListFormatter.Width</i></li>
CurrencyDisplayNames
<ul>
<li><span style='color:orange'>(draft)</span> public abstract java.lang.String <i>getFormalSymbol</i>(java.lang.String)</li>
<li><span style='color:orange'>(draft)</span> public abstract java.lang.String <i>getVariantSymbol</i>(java.lang.String)</li>
</ul>
DateFormat.HourCycle
<ul>
<li><span style='color:orange'>(draft)</span> public static final DateFormat.HourCycle HOUR_CYCLE_11</li>
<li><span style='color:orange'>(draft)</span> public static final DateFormat.HourCycle HOUR_CYCLE_12</li>
<li><span style='color:orange'>(draft)</span> public static final DateFormat.HourCycle HOUR_CYCLE_23</li>
<li><span style='color:orange'>(draft)</span> public static final DateFormat.HourCycle HOUR_CYCLE_24</li>
</ul>
DateTimePatternGenerator
<ul>
<li><span style='color:orange'>(draft)</span> public DateFormat.HourCycle <i>getDefaultHourCycle</i>()</li>
</ul>
DecimalFormatSymbols
<ul>
<li><span style='color:gray'>(deprecated)</span> public java.lang.String <i>getCurrencyPattern</i>()</li>
</ul>
ListFormatter
<ul>
<li><span style='color:orange'>(draft)</span> public ListFormatter.FormattedList <i>formatToValue</i>(java.lang.Object...)</li>
<li><span style='color:orange'>(draft)</span> public ListFormatter.FormattedList <i>formatToValue</i>(java.util.Collection&lt;?&gt;)</li>
<li><span style='color:orange'>(draft)</span> public static ListFormatter <i>getInstance</i>(ULocale, ListFormatter.Type, ListFormatter.Width)</li>
<li><span style='color:orange'>(draft)</span> public static ListFormatter <i>getInstance</i>(java.util.Locale, ListFormatter.Type, ListFormatter.Width)</li>
</ul>
ListFormatter.Type
<ul>
<li><span style='color:orange'>(draft)</span> public static final ListFormatter.Type AND</li>
<li><span style='color:orange'>(draft)</span> public static final ListFormatter.Type OR</li>
<li><span style='color:orange'>(draft)</span> public static final ListFormatter.Type UNITS</li>
</ul>
ListFormatter.Width
<ul>
<li><span style='color:orange'>(draft)</span> public static final ListFormatter.Width NARROW</li>
<li><span style='color:orange'>(draft)</span> public static final ListFormatter.Width SHORT</li>
<li><span style='color:orange'>(draft)</span> public static final ListFormatter.Width WIDE</li>
</ul>
</ul>
<h3>Package com.ibm.icu.util</h3>
<ul>
<li><span style='color:orange'>(draft)</span> public static enum <i>LocaleMatcher.Direction</i></li>
Currency
<ul>
<li><span style='color:orange'>(draft)</span> public static final int FORMAL_SYMBOL_NAME</li>
<li><span style='color:orange'>(draft)</span> public static final int VARIANT_SYMBOL_NAME</li>
</ul>
LocaleMatcher.Builder
<ul>
<li><span style='color:orange'>(draft)</span> public LocaleMatcher.Builder <i>setDirection</i>(LocaleMatcher.Direction)</li>
</ul>
LocaleMatcher.Direction
<ul>
<li><span style='color:orange'>(draft)</span> public static final LocaleMatcher.Direction ONLY_TWO_WAY</li>
<li><span style='color:orange'>(draft)</span> public static final LocaleMatcher.Direction WITH_ONE_WAY</li>
</ul>
ULocale
<ul>
<li><span style='color:orange'>(draft)</span> public static ULocale <i>createCanonical</i>(ULocale)</li>
</ul>
</ul>
<hr/>
<p><i><font size="-1">Contents generated by ReportAPI tool on Tue Dec 03 17:17:51 EST 2019<br/>© 2019 and later: Unicode, Inc. and others. License & terms of use: <a href="http://www.unicode.org/copyright.html#License">http://www.unicode.org/copyright.html#License</a></font></i></p>
<p><i><font size="-1">Contents generated by ReportAPI tool on Wed Apr 01 16:15:30 EDT 2020<br/>© 2020 and later: Unicode, Inc. and others. License & terms of use: <a href="http://www.unicode.org/copyright.html#License">http://www.unicode.org/copyright.html#License</a></font></i></p>
</body>
</html>

View file

@ -4,9 +4,9 @@
#* Copyright (C) 2009-2016, International Business Machines Corporation and *
#* others. All Rights Reserved. *
#*******************************************************************************
api.report.version = 66
api.report.prev.version = 65
release.file.ver = 66rc
api.doc.version = 66 Release Candidate
maven.pom.ver = 66.1-SNAPSHOT
api.report.version = 67
api.report.prev.version = 66
release.file.ver = 67rc
api.doc.version = 67 Release Candidate
maven.pom.ver = 67.1-SNAPSHOT

View file

@ -4,6 +4,6 @@
#* Copyright (C) 2010-2016, International Business Machines Corporation and *
#* others. All Rights Reserved. *
#*******************************************************************************
icu4j.plugin.impl.version.string=66.1.0
icu4j.plugin.impl.version.string=67.1.0
copyright.eclipse=(C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html#License
icu4j.data.version.number=66
icu4j.data.version.number=67

View file

@ -154,6 +154,16 @@ public class CurrencyData {
return fallback ? isoCode : null;
}
@Override
public String getFormalSymbol(String isoCode) {
return fallback ? isoCode : null;
}
@Override
public String getVariantSymbol(String isoCode) {
return fallback ? isoCode : null;
}
@Override
public Map<String, String> symbolMap() {
return Collections.emptyMap();

View file

@ -12,7 +12,9 @@ import java.text.FieldPosition;
import java.text.Format;
import java.text.ParsePosition;
import com.ibm.icu.number.FormattedNumber;
import com.ibm.icu.impl.FormattedStringBuilder;
import com.ibm.icu.impl.FormattedValueStringBuilderImpl;
import com.ibm.icu.impl.Utility;
import com.ibm.icu.number.LocalizedNumberFormatter;
import com.ibm.icu.number.NumberFormatter;
import com.ibm.icu.util.ULocale;
@ -46,16 +48,18 @@ public class LocalizedNumberFormatterAsFormat extends Format {
if (!(obj instanceof Number)) {
throw new IllegalArgumentException();
}
FormattedNumber result = formatter.format((Number) obj);
DecimalQuantity dq = new DecimalQuantity_DualStorageBCD((Number) obj);
FormattedStringBuilder string = new FormattedStringBuilder();
formatter.formatImpl(dq, string);
// always return first occurrence:
pos.setBeginIndex(0);
pos.setEndIndex(0);
boolean found = result.nextFieldPosition(pos);
boolean found = FormattedValueStringBuilderImpl.nextFieldPosition(string, pos);
if (found && toAppendTo.length() != 0) {
pos.setBeginIndex(pos.getBeginIndex() + toAppendTo.length());
pos.setEndIndex(pos.getEndIndex() + toAppendTo.length());
}
result.appendTo(toAppendTo);
Utility.appendTo(string, toAppendTo);
return toAppendTo;
}

View file

@ -401,8 +401,23 @@ public class MutablePatternModifier implements Modifier, SymbolProvider, MicroPr
} else if (unitWidth == UnitWidth.HIDDEN) {
return "";
} else {
int selector = unitWidth == UnitWidth.NARROW ? Currency.NARROW_SYMBOL_NAME
: Currency.SYMBOL_NAME;
int selector;
switch (unitWidth) {
case SHORT:
selector = Currency.SYMBOL_NAME;
break;
case NARROW:
selector = Currency.NARROW_SYMBOL_NAME;
break;
case FORMAL:
selector = Currency.FORMAL_SYMBOL_NAME;
break;
case VARIANT:
selector = Currency.VARIANT_SYMBOL_NAME;
break;
default:
throw new AssertionError();
}
return currency.getName(symbols.getULocale(), selector, null);
}
case AffixUtils.TYPE_CURRENCY_DOUBLE:

View file

@ -4,8 +4,6 @@ package com.ibm.icu.number;
import java.math.BigDecimal;
import java.text.AttributedCharacterIterator;
import java.text.FieldPosition;
import java.util.Arrays;
import com.ibm.icu.impl.FormattedStringBuilder;
import com.ibm.icu.impl.FormattedValueStringBuilderImpl;
@ -46,8 +44,7 @@ public class FormattedNumber implements FormattedValue {
/**
* {@inheritDoc}
*
* @draft ICU 64
* @provisional This API might change or be removed in a future release.
* @stable ICU 64
*/
@Override
public int length() {
@ -57,8 +54,7 @@ public class FormattedNumber implements FormattedValue {
/**
* {@inheritDoc}
*
* @draft ICU 64
* @provisional This API might change or be removed in a future release.
* @stable ICU 64
*/
@Override
public char charAt(int index) {
@ -68,8 +64,7 @@ public class FormattedNumber implements FormattedValue {
/**
* {@inheritDoc}
*
* @draft ICU 64
* @provisional This API might change or be removed in a future release.
* @stable ICU 64
*/
@Override
public CharSequence subSequence(int start, int end) {
@ -89,8 +84,7 @@ public class FormattedNumber implements FormattedValue {
/**
* {@inheritDoc}
*
* @draft ICU 64
* @provisional This API might change or be removed in a future release.
* @stable ICU 64
*/
@Override
public boolean nextPosition(ConstrainedFieldPosition cfpos) {
@ -107,44 +101,6 @@ public class FormattedNumber implements FormattedValue {
return FormattedValueStringBuilderImpl.toCharacterIterator(string, null);
}
/**
* Determines the start (inclusive) and end (exclusive) indices of the next occurrence of the
* given <em>field</em> in the output string. This allows you to determine the locations of,
* for example, the integer part, fraction part, or symbols.
* <p>
* This is a simpler but less powerful alternative to {@link #nextPosition}.
* <p>
* If a field occurs just once, calling this method will find that occurrence and return it. If a
* field occurs multiple times, this method may be called repeatedly with the following pattern:
*
* <pre>
* FieldPosition fpos = new FieldPosition(NumberFormat.Field.GROUPING_SEPARATOR);
* while (formattedNumber.nextFieldPosition(fpos, status)) {
* // do something with fpos.
* }
* </pre>
* <p>
* This method is useful if you know which field to query. If you want all available field position
* information, use {@link #nextPosition} or {@link #toCharacterIterator()}.
*
* @param fieldPosition
* Input+output variable. On input, the "field" property determines which field to look
* up, and the "beginIndex" and "endIndex" properties determine where to begin the search.
* On output, the "beginIndex" is set to the beginning of the first occurrence of the
* field with either begin or end indices after the input indices, "endIndex" is set to
* the end of that occurrence of the field (exclusive index). If a field position is not
* found, the method returns FALSE and the FieldPosition may or may not be changed.
* @return true if a new occurrence of the field was found; false otherwise.
* @draft ICU 62
* @provisional This API might change or be removed in a future release.
* @see com.ibm.icu.text.NumberFormat.Field
* @see NumberFormatter
*/
public boolean nextFieldPosition(FieldPosition fieldPosition) {
fq.populateUFieldPosition(fieldPosition);
return FormattedValueStringBuilderImpl.nextFieldPosition(string, fieldPosition);
}
/**
* Export the formatted number as a BigDecimal. This endpoint is useful for obtaining the exact
* number being printed after scaling and rounding have been applied by the number formatting
@ -166,41 +122,4 @@ public class FormattedNumber implements FormattedValue {
public IFixedDecimal getFixedDecimal() {
return fq;
}
/**
* {@inheritDoc}
*
* @draft ICU 60
* @provisional This API might change or be removed in a future release.
*/
@Override
public int hashCode() {
// FormattedStringBuilder and BigDecimal are mutable, so we can't call
// #equals() or #hashCode() on them directly.
return Arrays.hashCode(string.toCharArray())
^ Arrays.hashCode(string.toFieldArray())
^ fq.toBigDecimal().hashCode();
}
/**
* {@inheritDoc}
*
* @draft ICU 60
* @provisional This API might change or be removed in a future release.
*/
@Override
public boolean equals(Object other) {
if (this == other)
return true;
if (other == null)
return false;
if (!(other instanceof FormattedNumber))
return false;
// FormattedStringBuilder and BigDecimal are mutable, so we can't call
// #equals() or #hashCode() on them directly.
FormattedNumber _other = (FormattedNumber) other;
return Arrays.equals(string.toCharArray(), _other.string.toCharArray())
&& Arrays.equals(string.toFieldArray(), _other.string.toFieldArray())
&& fq.toBigDecimal().equals(_other.fq.toBigDecimal());
}
}

Some files were not shown because too many files have changed in this diff Show more