mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 23:37:33 +09:00
Issue #1971 - Part 2: Update ICU source to 63.2.
This commit is contained in:
parent
8df84683be
commit
1e69214382
3160 changed files with 275815 additions and 234203 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
|
|
@ -19,10 +19,15 @@
|
|||
#include "unicode/utypes.h"
|
||||
#include "unicode/unistr.h"
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
// Forward declaration:
|
||||
namespace number {
|
||||
namespace impl {
|
||||
class SimpleModifier;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats simple patterns like "{1} was born in {0}".
|
||||
* Minimal subset of MessageFormat; fast, simple, minimal dependencies.
|
||||
|
|
@ -49,15 +54,15 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @see MessageFormat
|
||||
* @see UMessagePatternApostropheMode
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
class U_COMMON_API SimpleFormatter U_FINAL : public UMemory {
|
||||
public:
|
||||
/**
|
||||
* Default constructor.
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
SimpleFormatter() : compiledPattern((UChar)0) {}
|
||||
SimpleFormatter() : compiledPattern((char16_t)0) {}
|
||||
|
||||
/**
|
||||
* Constructs a formatter from the pattern string.
|
||||
|
|
@ -66,7 +71,7 @@ public:
|
|||
* @param errorCode ICU error code in/out parameter.
|
||||
* Must fulfill U_SUCCESS before the function call.
|
||||
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax.
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
SimpleFormatter(const UnicodeString& pattern, UErrorCode &errorCode) {
|
||||
applyPattern(pattern, errorCode);
|
||||
|
|
@ -84,7 +89,7 @@ public:
|
|||
* Must fulfill U_SUCCESS before the function call.
|
||||
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and
|
||||
* too few or too many arguments.
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
SimpleFormatter(const UnicodeString& pattern, int32_t min, int32_t max,
|
||||
UErrorCode &errorCode) {
|
||||
|
|
@ -93,20 +98,20 @@ public:
|
|||
|
||||
/**
|
||||
* Copy constructor.
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
SimpleFormatter(const SimpleFormatter& other)
|
||||
: compiledPattern(other.compiledPattern) {}
|
||||
|
||||
/**
|
||||
* Assignment operator.
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
SimpleFormatter &operator=(const SimpleFormatter& other);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
~SimpleFormatter();
|
||||
|
||||
|
|
@ -118,7 +123,7 @@ public:
|
|||
* Must fulfill U_SUCCESS before the function call.
|
||||
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax.
|
||||
* @return TRUE if U_SUCCESS(errorCode).
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
UBool applyPattern(const UnicodeString &pattern, UErrorCode &errorCode) {
|
||||
return applyPatternMinMaxArguments(pattern, 0, INT32_MAX, errorCode);
|
||||
|
|
@ -137,14 +142,14 @@ public:
|
|||
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and
|
||||
* too few or too many arguments.
|
||||
* @return TRUE if U_SUCCESS(errorCode).
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
UBool applyPatternMinMaxArguments(const UnicodeString &pattern,
|
||||
int32_t min, int32_t max, UErrorCode &errorCode);
|
||||
|
||||
/**
|
||||
* @return The max argument number + 1.
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
int32_t getArgumentLimit() const {
|
||||
return getArgumentLimit(compiledPattern.getBuffer(), compiledPattern.length());
|
||||
|
|
@ -160,7 +165,7 @@ public:
|
|||
* @param errorCode ICU error code in/out parameter.
|
||||
* Must fulfill U_SUCCESS before the function call.
|
||||
* @return appendTo
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
UnicodeString &format(
|
||||
const UnicodeString &value0,
|
||||
|
|
@ -177,7 +182,7 @@ public:
|
|||
* @param errorCode ICU error code in/out parameter.
|
||||
* Must fulfill U_SUCCESS before the function call.
|
||||
* @return appendTo
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
UnicodeString &format(
|
||||
const UnicodeString &value0,
|
||||
|
|
@ -196,7 +201,7 @@ public:
|
|||
* @param errorCode ICU error code in/out parameter.
|
||||
* Must fulfill U_SUCCESS before the function call.
|
||||
* @return appendTo
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
UnicodeString &format(
|
||||
const UnicodeString &value0,
|
||||
|
|
@ -221,7 +226,7 @@ public:
|
|||
* @param errorCode ICU error code in/out parameter.
|
||||
* Must fulfill U_SUCCESS before the function call.
|
||||
* @return appendTo
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
UnicodeString &formatAndAppend(
|
||||
const UnicodeString *const *values, int32_t valuesLength,
|
||||
|
|
@ -247,7 +252,7 @@ public:
|
|||
* @param errorCode ICU error code in/out parameter.
|
||||
* Must fulfill U_SUCCESS before the function call.
|
||||
* @return result
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
UnicodeString &formatAndReplace(
|
||||
const UnicodeString *const *values, int32_t valuesLength,
|
||||
|
|
@ -257,7 +262,7 @@ public:
|
|||
/**
|
||||
* Returns the pattern text with none of the arguments.
|
||||
* Like formatting with all-empty string values.
|
||||
* @draft ICU 57
|
||||
* @stable ICU 57
|
||||
*/
|
||||
UnicodeString getTextWithNoArguments() const {
|
||||
return getTextWithNoArguments(compiledPattern.getBuffer(), compiledPattern.length());
|
||||
|
|
@ -275,23 +280,24 @@ private:
|
|||
*/
|
||||
UnicodeString compiledPattern;
|
||||
|
||||
static inline int32_t getArgumentLimit(const UChar *compiledPattern,
|
||||
static inline int32_t getArgumentLimit(const char16_t *compiledPattern,
|
||||
int32_t compiledPatternLength) {
|
||||
return compiledPatternLength == 0 ? 0 : compiledPattern[0];
|
||||
}
|
||||
|
||||
static UnicodeString getTextWithNoArguments(const UChar *compiledPattern, int32_t compiledPatternLength);
|
||||
static UnicodeString getTextWithNoArguments(const char16_t *compiledPattern, int32_t compiledPatternLength);
|
||||
|
||||
static UnicodeString &format(
|
||||
const UChar *compiledPattern, int32_t compiledPatternLength,
|
||||
const char16_t *compiledPattern, int32_t compiledPatternLength,
|
||||
const UnicodeString *const *values,
|
||||
UnicodeString &result, const UnicodeString *resultCopy, UBool forbidResultAsValue,
|
||||
int32_t *offsets, int32_t offsetsLength,
|
||||
UErrorCode &errorCode);
|
||||
|
||||
// Give access to internals to SimpleModifier for number formatting
|
||||
friend class number::impl::SimpleModifier;
|
||||
};
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif /* U_HIDE_DRAFT_API */
|
||||
|
||||
#endif // __SIMPLEFORMATTER_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue