DecimalFormatProperties tprops(*fProperties);
bool useCurrency = ((!tprops.currency.isNull()) || !tprops.currencyPluralInfo.fPtr.isNull() ||
!tprops.currencyUsage.isNull() || AffixUtils::hasCurrencySymbols(
- UnicodeStringCharSequence(tprops.positivePrefixPattern), localStatus) ||
- AffixUtils::hasCurrencySymbols(
- UnicodeStringCharSequence(tprops.positiveSuffixPattern), localStatus) ||
- AffixUtils::hasCurrencySymbols(
- UnicodeStringCharSequence(tprops.negativePrefixPattern), localStatus) ||
- AffixUtils::hasCurrencySymbols(
- UnicodeStringCharSequence(tprops.negativeSuffixPattern), localStatus));
+ tprops.positivePrefixPattern, localStatus) || AffixUtils::hasCurrencySymbols(
+ tprops.positiveSuffixPattern, localStatus) || AffixUtils::hasCurrencySymbols(
+ tprops.negativePrefixPattern, localStatus) || AffixUtils::hasCurrencySymbols(
+ tprops.negativeSuffixPattern, localStatus));
if (useCurrency) {
tprops.minimumFractionDigits = fExportedProperties->minimumFractionDigits;
tprops.maximumFractionDigits = fExportedProperties->maximumFractionDigits;
using namespace icu::number;
using namespace icu::number::impl;
-int32_t AffixUtils::estimateLength(const CharSequence &patternString, UErrorCode &status) {
+int32_t AffixUtils::estimateLength(const UnicodeString &patternString, UErrorCode &status) {
AffixPatternState state = STATE_BASE;
int32_t offset = 0;
int32_t length = 0;
for (; offset < patternString.length();) {
- UChar32 cp = patternString.codePointAt(offset);
+ UChar32 cp = patternString.char32At(offset);
switch (state) {
case STATE_BASE:
return length;
}
-UnicodeString AffixUtils::escape(const CharSequence &input) {
+UnicodeString AffixUtils::escape(const UnicodeString &input) {
AffixPatternState state = STATE_BASE;
int32_t offset = 0;
UnicodeString output;
for (; offset < input.length();) {
- UChar32 cp = input.codePointAt(offset);
+ UChar32 cp = input.char32At(offset);
switch (cp) {
case u'\'':
}
int32_t
-AffixUtils::unescape(const CharSequence &affixPattern, NumberStringBuilder &output, int32_t position,
+AffixUtils::unescape(const UnicodeString &affixPattern, NumberStringBuilder &output, int32_t position,
const SymbolProvider &provider, UErrorCode &status) {
int32_t length = 0;
AffixTag tag;
return length;
}
-int32_t AffixUtils::unescapedCodePointCount(const CharSequence &affixPattern,
+int32_t AffixUtils::unescapedCodePointCount(const UnicodeString &affixPattern,
const SymbolProvider &provider, UErrorCode &status) {
int32_t length = 0;
AffixTag tag;
}
bool
-AffixUtils::containsType(const CharSequence &affixPattern, AffixPatternType type, UErrorCode &status) {
+AffixUtils::containsType(const UnicodeString &affixPattern, AffixPatternType type, UErrorCode &status) {
if (affixPattern.length() == 0) {
return false;
}
return false;
}
-bool AffixUtils::hasCurrencySymbols(const CharSequence &affixPattern, UErrorCode &status) {
+bool AffixUtils::hasCurrencySymbols(const UnicodeString &affixPattern, UErrorCode &status) {
if (affixPattern.length() == 0) {
return false;
}
return false;
}
-UnicodeString AffixUtils::replaceType(const CharSequence &affixPattern, AffixPatternType type,
+UnicodeString AffixUtils::replaceType(const UnicodeString &affixPattern, AffixPatternType type,
char16_t replacementChar, UErrorCode &status) {
- UnicodeString output = affixPattern.toUnicodeString();
+ UnicodeString output(affixPattern); // copy
if (affixPattern.length() == 0) {
return output;
};
return output;
}
-bool AffixUtils::containsOnlySymbolsAndIgnorables(const CharSequence& affixPattern,
+bool AffixUtils::containsOnlySymbolsAndIgnorables(const UnicodeString& affixPattern,
const UnicodeSet& ignorables, UErrorCode& status) {
if (affixPattern.length() == 0) {
return true;
return true;
}
-void AffixUtils::iterateWithConsumer(const CharSequence& affixPattern, TokenConsumer& consumer,
+void AffixUtils::iterateWithConsumer(const UnicodeString& affixPattern, TokenConsumer& consumer,
UErrorCode& status) {
if (affixPattern.length() == 0) {
return;
}
}
-AffixTag AffixUtils::nextToken(AffixTag tag, const CharSequence &patternString, UErrorCode &status) {
+AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString, UErrorCode &status) {
int32_t offset = tag.offset;
int32_t state = tag.state;
for (; offset < patternString.length();) {
- UChar32 cp = patternString.codePointAt(offset);
+ UChar32 cp = patternString.char32At(offset);
int32_t count = U16_LENGTH(cp);
switch (state) {
}
}
-bool AffixUtils::hasNext(const AffixTag &tag, const CharSequence &string) {
+bool AffixUtils::hasNext(const AffixTag &tag, const UnicodeString &string) {
// First check for the {-1} and default initializer syntax.
if (tag.offset < 0) {
return false;
* @param patternString The original string whose width will be estimated.
* @return The length of the unescaped string.
*/
- static int32_t estimateLength(const CharSequence& patternString, UErrorCode& status);
+ static int32_t estimateLength(const UnicodeString& patternString, UErrorCode& status);
/**
* Takes a string and escapes (quotes) characters that have special meaning in the affix pattern
* @param input The string to be escaped.
* @return The resulting UnicodeString.
*/
- static UnicodeString escape(const CharSequence& input);
+ static UnicodeString escape(const UnicodeString& input);
static Field getFieldForType(AffixPatternType type);
* @param position The index into the NumberStringBuilder to insert the string.
* @param provider An object to generate locale symbols.
*/
- static int32_t unescape(const CharSequence& affixPattern, NumberStringBuilder& output,
+ static int32_t unescape(const UnicodeString& affixPattern, NumberStringBuilder& output,
int32_t position, const SymbolProvider& provider, UErrorCode& status);
/**
* @param provider An object to generate locale symbols.
* @return The same return value as if you called {@link #unescape}.
*/
- static int32_t unescapedCodePointCount(const CharSequence& affixPattern,
+ static int32_t unescapedCodePointCount(const UnicodeString& affixPattern,
const SymbolProvider& provider, UErrorCode& status);
/**
* @param type The token type.
* @return true if the affix pattern contains the given token type; false otherwise.
*/
- static bool containsType(const CharSequence& affixPattern, AffixPatternType type, UErrorCode& status);
+ static bool containsType(const UnicodeString& affixPattern, AffixPatternType type, UErrorCode& status);
/**
* Checks whether the specified affix pattern has any unquoted currency symbols ("ยค").
* @param affixPattern The string to check for currency symbols.
* @return true if the literal has at least one unquoted currency symbol; false otherwise.
*/
- static bool hasCurrencySymbols(const CharSequence& affixPattern, UErrorCode& status);
+ static bool hasCurrencySymbols(const UnicodeString& affixPattern, UErrorCode& status);
/**
* Replaces all occurrences of tokens with the given type with the given replacement char.
* @param replacementChar The char to substitute in place of chars of the given token type.
* @return A string containing the new affix pattern.
*/
- static UnicodeString replaceType(const CharSequence& affixPattern, AffixPatternType type,
+ static UnicodeString replaceType(const UnicodeString& affixPattern, AffixPatternType type,
char16_t replacementChar, UErrorCode& status);
/**
* Returns whether the given affix pattern contains only symbols and ignorables as defined by the
* given ignorables set.
*/
- static bool containsOnlySymbolsAndIgnorables(const CharSequence& affixPattern,
+ static bool containsOnlySymbolsAndIgnorables(const UnicodeString& affixPattern,
const UnicodeSet& ignorables, UErrorCode& status);
/**
* Iterates over the affix pattern, calling the TokenConsumer for each token.
*/
- static void iterateWithConsumer(const CharSequence& affixPattern, TokenConsumer& consumer,
+ static void iterateWithConsumer(const UnicodeString& affixPattern, TokenConsumer& consumer,
UErrorCode& status);
/**
* (never negative), or -1 if there were no more tokens in the affix pattern.
* @see #hasNext
*/
- static AffixTag nextToken(AffixTag tag, const CharSequence& patternString, UErrorCode& status);
+ static AffixTag nextToken(AffixTag tag, const UnicodeString& patternString, UErrorCode& status);
/**
* Returns whether the affix pattern string has any more tokens to be retrieved from a call to
* @param string The affix pattern.
* @return true if there are more tokens to consume; false otherwise.
*/
- static bool hasNext(const AffixTag& tag, const CharSequence& string);
+ static bool hasNext(const AffixTag& tag, const UnicodeString& string);
private:
/**
// [p/n] => p for positive, n for negative
// [p/s] => p for prefix, s for suffix
// [o/p] => o for escaped custom override string, p for pattern string
- UnicodeString ppo = AffixUtils::escape(UnicodeStringCharSequence(properties.positivePrefix));
- UnicodeString pso = AffixUtils::escape(UnicodeStringCharSequence(properties.positiveSuffix));
- UnicodeString npo = AffixUtils::escape(UnicodeStringCharSequence(properties.negativePrefix));
- UnicodeString nso = AffixUtils::escape(UnicodeStringCharSequence(properties.negativeSuffix));
+ UnicodeString ppo = AffixUtils::escape(properties.positivePrefix);
+ UnicodeString pso = AffixUtils::escape(properties.positiveSuffix);
+ UnicodeString npo = AffixUtils::escape(properties.negativePrefix);
+ UnicodeString nso = AffixUtils::escape(properties.negativeSuffix);
const UnicodeString& ppp = properties.positivePrefixPattern;
const UnicodeString& psp = properties.positiveSuffixPattern;
const UnicodeString& npp = properties.negativePrefixPattern;
bool PropertiesAffixPatternProvider::positiveHasPlusSign() const {
// TODO: Change the internal APIs to propagate out the error?
ErrorCode localStatus;
- return AffixUtils::containsType(UnicodeStringCharSequence(posPrefix), TYPE_PLUS_SIGN, localStatus) ||
- AffixUtils::containsType(UnicodeStringCharSequence(posSuffix), TYPE_PLUS_SIGN, localStatus);
+ return AffixUtils::containsType(posPrefix, TYPE_PLUS_SIGN, localStatus) ||
+ AffixUtils::containsType(posSuffix, TYPE_PLUS_SIGN, localStatus);
}
bool PropertiesAffixPatternProvider::hasNegativeSubpattern() const {
bool PropertiesAffixPatternProvider::negativeHasMinusSign() const {
ErrorCode localStatus;
- return AffixUtils::containsType(UnicodeStringCharSequence(negPrefix), TYPE_MINUS_SIGN, localStatus) ||
- AffixUtils::containsType(UnicodeStringCharSequence(negSuffix), TYPE_MINUS_SIGN, localStatus);
+ return AffixUtils::containsType(negPrefix, TYPE_MINUS_SIGN, localStatus) ||
+ AffixUtils::containsType(negSuffix, TYPE_MINUS_SIGN, localStatus);
}
bool PropertiesAffixPatternProvider::hasCurrencySign() const {
ErrorCode localStatus;
- return AffixUtils::hasCurrencySymbols(UnicodeStringCharSequence(posPrefix), localStatus) ||
- AffixUtils::hasCurrencySymbols(UnicodeStringCharSequence(posSuffix), localStatus) ||
- AffixUtils::hasCurrencySymbols(UnicodeStringCharSequence(negPrefix), localStatus) ||
- AffixUtils::hasCurrencySymbols(UnicodeStringCharSequence(negSuffix), localStatus);
+ return AffixUtils::hasCurrencySymbols(posPrefix, localStatus) ||
+ AffixUtils::hasCurrencySymbols(posSuffix, localStatus) ||
+ AffixUtils::hasCurrencySymbols(negPrefix, localStatus) ||
+ AffixUtils::hasCurrencySymbols(negSuffix, localStatus);
}
bool PropertiesAffixPatternProvider::containsSymbolType(AffixPatternType type, UErrorCode& status) const {
- return AffixUtils::containsType(UnicodeStringCharSequence(posPrefix), type, status) ||
- AffixUtils::containsType(UnicodeStringCharSequence(posSuffix), type, status) ||
- AffixUtils::containsType(UnicodeStringCharSequence(negPrefix), type, status) ||
- AffixUtils::containsType(UnicodeStringCharSequence(negSuffix), type, status);
+ return AffixUtils::containsType(posPrefix, type, status) ||
+ AffixUtils::containsType(posSuffix, type, status) ||
+ AffixUtils::containsType(negPrefix, type, status) ||
+ AffixUtils::containsType(negSuffix, type, status);
}
bool PropertiesAffixPatternProvider::hasBody() const {
// Enter and exit CharSequence Mode to get the length.
nonConstThis->prepareAffix(true);
- int result = AffixUtils::unescapedCodePointCount(
- UnicodeStringCharSequence(currentAffix),
- *this,
- status); // prefix length
+ int result = AffixUtils::unescapedCodePointCount(currentAffix, *this, status); // prefix length
return result;
}
// Render the affixes to get the length
nonConstThis->prepareAffix(true);
- int result = AffixUtils::unescapedCodePointCount(
- UnicodeStringCharSequence(currentAffix),
- *this,
- status); // prefix length
+ int result = AffixUtils::unescapedCodePointCount(currentAffix, *this, status); // prefix length
nonConstThis->prepareAffix(false);
- result += AffixUtils::unescapedCodePointCount(
- UnicodeStringCharSequence(currentAffix),
- *this,
- status); // suffix length
+ result += AffixUtils::unescapedCodePointCount(currentAffix, *this, status); // suffix length
return result;
}
int32_t MutablePatternModifier::insertPrefix(NumberStringBuilder& sb, int position, UErrorCode& status) {
prepareAffix(true);
- int length = AffixUtils::unescape(
- UnicodeStringCharSequence(currentAffix), sb, position, *this, status);
+ int length = AffixUtils::unescape(currentAffix, sb, position, *this, status);
return length;
}
int32_t MutablePatternModifier::insertSuffix(NumberStringBuilder& sb, int position, UErrorCode& status) {
prepareAffix(false);
- int length = AffixUtils::unescape(
- UnicodeStringCharSequence(currentAffix), sb, position, *this, status);
+ int length = AffixUtils::unescape(currentAffix, sb, position, *this, status);
return length;
}
}
bool ParsedPatternInfo::containsSymbolType(AffixPatternType type, UErrorCode& status) const {
- return AffixUtils::containsType(UnicodeStringCharSequence(pattern), type, status);
+ return AffixUtils::containsType(pattern, type, status);
}
bool ParsedPatternInfo::hasBody() const {
if (positive.hasPadding) {
// The width of the positive prefix and suffix templates are included in the padding
int paddingWidth = positive.widthExceptAffixes +
- AffixUtils::estimateLength(UnicodeStringCharSequence(posPrefix), status) +
- AffixUtils::estimateLength(UnicodeStringCharSequence(posSuffix), status);
+ AffixUtils::estimateLength(posPrefix, status) +
+ AffixUtils::estimateLength(posSuffix, status);
properties.formatWidth = paddingWidth;
UnicodeString rawPaddingString = patternInfo.getString(AffixPatternProvider::AFFIX_PADDING);
if (rawPaddingString.length() == 1) {
if (!ppp.isBogus()) {
sb.append(ppp);
}
- sb.append(AffixUtils::escape(UnicodeStringCharSequence(pp)));
+ sb.append(AffixUtils::escape(pp));
int afterPrefixPos = sb.length();
// Figure out the grouping sizes.
if (!psp.isBogus()) {
sb.append(psp);
}
- sb.append(AffixUtils::escape(UnicodeStringCharSequence(ps)));
+ sb.append(AffixUtils::escape(ps));
// Resolve Padding
if (paddingWidth != -1 && !paddingLocation.isNull()) {
if (!npp.isBogus()) {
sb.append(npp);
}
- sb.append(AffixUtils::escape(UnicodeStringCharSequence(np)));
+ sb.append(AffixUtils::escape(np));
// Copy the positive digit format into the negative.
// This is optional; the pattern is the same as if '#' were appended here instead.
// NOTE: It is not safe to append the UnicodeString to itself, so we need to copy.
if (!nsp.isBogus()) {
sb.append(nsp);
}
- sb.append(AffixUtils::escape(UnicodeStringCharSequence(ns)));
+ sb.append(AffixUtils::escape(ns));
}
return sb;
};
-// TODO: Should this be moved somewhere else, maybe where other ICU classes can use it?
-// Exported as U_I18N_API because it is a base class for other exported types
-class U_I18N_API CharSequence {
- public:
- virtual ~CharSequence() = default;
-
- virtual int32_t length() const = 0;
-
- virtual char16_t charAt(int32_t index) const = 0;
-
- virtual UChar32 codePointAt(int32_t index) const {
- // Default implementation; can be overridden with a more efficient version
- char16_t leading = charAt(index);
- if (U16_IS_LEAD(leading) && length() > index + 1) {
- char16_t trailing = charAt(index + 1);
- return U16_GET_SUPPLEMENTARY(leading, trailing);
- } else {
- return leading;
- }
- }
-
- /**
- * Gets a "safe" UnicodeString that can be used even after the CharSequence is destructed.
- * */
- virtual UnicodeString toUnicodeString() const = 0;
-
- /**
- * Gets an "unsafe" UnicodeString that is valid only as long as the CharSequence is alive and
- * unchanged. Slightly faster than toUnicodeString().
- */
- virtual const UnicodeString toTempUnicodeString() const = 0;
-};
-
class U_I18N_API AffixPatternProvider {
public:
static const int32_t AFFIX_PLURAL_MASK = 0xff;
U_NAMESPACE_BEGIN namespace number {
namespace impl {
-class UnicodeStringCharSequence : public CharSequence {
- public:
- explicit UnicodeStringCharSequence(const UnicodeString& other) {
- fStr = other;
- }
-
- ~UnicodeStringCharSequence() U_OVERRIDE = default;
-
- int32_t length() const U_OVERRIDE {
- return fStr.length();
- }
-
- char16_t charAt(int32_t index) const U_OVERRIDE {
- return fStr.charAt(index);
- }
-
- UChar32 codePointAt(int32_t index) const U_OVERRIDE {
- return fStr.char32At(index);
- }
-
- UnicodeString toUnicodeString() const U_OVERRIDE {
- // Performs a copy:
- return fStr;
- }
-
- const UnicodeString toTempUnicodeString() const U_OVERRIDE {
- // Readonly alias:
- return UnicodeString().fastCopyFrom(fStr);
- }
-
- private:
- UnicodeString fStr;
-};
-
struct MicroProps : public MicroPropsGenerator {
// NOTE: All of these fields are properly initialized in NumberFormatterImpl.
}
AffixPatternMatcherBuilder builder(affixPattern, tokenWarehouse, ignorables);
- AffixUtils::iterateWithConsumer(UnicodeStringCharSequence(affixPattern), builder, status);
+ AffixUtils::iterateWithConsumer(affixPattern, builder, status);
return builder.build();
}
bool AffixMatcherWarehouse::isInteresting(const AffixPatternProvider& patternInfo,
const IgnorablesMatcher& ignorables, parse_flags_t parseFlags,
UErrorCode& status) {
- UnicodeStringCharSequence posPrefixString(patternInfo.getString(AffixPatternProvider::AFFIX_POS_PREFIX));
- UnicodeStringCharSequence posSuffixString(patternInfo.getString(AffixPatternProvider::AFFIX_POS_SUFFIX));
- UnicodeStringCharSequence negPrefixString(UnicodeString(u""));
- UnicodeStringCharSequence negSuffixString(UnicodeString(u""));
+ UnicodeString posPrefixString = patternInfo.getString(AffixPatternProvider::AFFIX_POS_PREFIX);
+ UnicodeString posSuffixString = patternInfo.getString(AffixPatternProvider::AFFIX_POS_SUFFIX);
+ UnicodeString negPrefixString;
+ UnicodeString negSuffixString;
if (patternInfo.hasNegativeSubpattern()) {
- negPrefixString = UnicodeStringCharSequence(patternInfo.getString(AffixPatternProvider::AFFIX_NEG_PREFIX));
- negSuffixString = UnicodeStringCharSequence(patternInfo.getString(AffixPatternProvider::AFFIX_NEG_SUFFIX));
+ negPrefixString = patternInfo.getString(AffixPatternProvider::AFFIX_NEG_PREFIX);
+ negSuffixString = patternInfo.getString(AffixPatternProvider::AFFIX_NEG_SUFFIX);
}
if (0 == (parseFlags & PARSE_FLAG_USE_FULL_AFFIXES) &&
partialMatchLen == segment.length();
}
-bool CombinedCurrencyMatcher::smokeTest(const StringSegment& segment) const {
+bool CombinedCurrencyMatcher::smokeTest(const StringSegment&) const {
// TODO: See constructor
return true;
//return segment.startsWith(fLeadCodePoints);
*
* @author sffc
*/
-class StringSegment : public UMemory, public ::icu::number::impl::CharSequence {
+class StringSegment : public UMemory {
public:
StringSegment(const UnicodeString& str, bool ignoreCase);
void resetLength();
- int32_t length() const override;
+ int32_t length() const;
- char16_t charAt(int32_t index) const override;
+ char16_t charAt(int32_t index) const;
- UChar32 codePointAt(int32_t index) const override;
+ UChar32 codePointAt(int32_t index) const;
- UnicodeString toUnicodeString() const override;
+ UnicodeString toUnicodeString() const;
- const UnicodeString toTempUnicodeString() const override;
+ const UnicodeString toTempUnicodeString() const;
/**
* Returns the first code point in the string segment, or -1 if the string starts with an invalid
for (auto &cas : cases) {
UnicodeString input(cas[0]);
UnicodeString expected(cas[1]);
- UnicodeString result = AffixUtils::escape(UnicodeStringCharSequence(input));
+ UnicodeString result = AffixUtils::escape(input);
assertEquals(input, expected, result);
}
}
UnicodeString input(cas.input);
UnicodeString output(cas.output);
- assertEquals(input, cas.currency, AffixUtils::hasCurrencySymbols(UnicodeStringCharSequence(input), status));
+ assertEquals(input, cas.currency, AffixUtils::hasCurrencySymbols(input, status));
assertSuccess("Spot 1", status);
- assertEquals(input, cas.expectedLength, AffixUtils::estimateLength(UnicodeStringCharSequence(input), status));
+ assertEquals(input, cas.expectedLength, AffixUtils::estimateLength(input, status));
assertSuccess("Spot 2", status);
UnicodeString actual = unescapeWithDefaults(defaultProvider, input, status);
assertSuccess("Spot 3", status);
assertEquals(input, output, actual);
- int32_t ulength = AffixUtils::unescapedCodePointCount(UnicodeStringCharSequence(input), defaultProvider, status);
+ int32_t ulength = AffixUtils::unescapedCodePointCount(input, defaultProvider, status);
assertSuccess("Spot 4", status);
assertEquals(input, output.countChar32(), ulength);
}
UnicodeString output(cas.output);
assertEquals(
- input, hasMinusSign, AffixUtils::containsType(UnicodeStringCharSequence(input), TYPE_MINUS_SIGN, status));
+ input, hasMinusSign, AffixUtils::containsType(input, TYPE_MINUS_SIGN, status));
assertSuccess("Spot 1", status);
assertEquals(
- input, output, AffixUtils::replaceType(UnicodeStringCharSequence(input), TYPE_MINUS_SIGN, u'+', status));
+ input, output, AffixUtils::replaceType(input, TYPE_MINUS_SIGN, u'+', status));
assertSuccess("Spot 2", status);
}
}
UnicodeString str(strPtr);
status = U_ZERO_ERROR;
- AffixUtils::hasCurrencySymbols(UnicodeStringCharSequence(str), status);
+ AffixUtils::hasCurrencySymbols(str, status);
assertEquals("Should set error code spot 1", status, U_ILLEGAL_ARGUMENT_ERROR);
status = U_ZERO_ERROR;
- AffixUtils::estimateLength(UnicodeStringCharSequence(str), status);
+ AffixUtils::estimateLength(str, status);
assertEquals("Should set error code spot 2", status, U_ILLEGAL_ARGUMENT_ERROR);
status = U_ZERO_ERROR;
UErrorCode status = U_ZERO_ERROR;
NumberStringBuilder sb;
- for (auto cas : cases) {
+ for (auto& cas : cases) {
UnicodeString input(cas[0]);
UnicodeString expected(cas[1]);
sb.clear();
- AffixUtils::unescape(UnicodeStringCharSequence(input), sb, 0, provider, status);
+ AffixUtils::unescape(input, sb, 0, provider, status);
assertSuccess("Spot 1", status);
assertEquals(input, expected, sb.toUnicodeString());
assertEquals(input, expected, sb.toTempUnicodeString());
sb.clear();
sb.append(u"abcdefg", UNUM_FIELD_COUNT, status);
assertSuccess("Spot 2", status);
- AffixUtils::unescape(UnicodeStringCharSequence(UnicodeString(u"-+%")), sb, 4, provider, status);
+ AffixUtils::unescape(u"-+%", sb, 4, provider, status);
assertSuccess("Spot 3", status);
assertEquals(u"Symbol provider into middle", u"abcd123efg", sb.toUnicodeString());
}
UnicodeString AffixUtilsTest::unescapeWithDefaults(const SymbolProvider &defaultProvider,
UnicodeString input, UErrorCode &status) {
NumberStringBuilder nsb;
- int32_t length = AffixUtils::unescape(UnicodeStringCharSequence(input), nsb, 0, defaultProvider, status);
+ int32_t length = AffixUtils::unescape(input, nsb, 0, defaultProvider, status);
assertEquals("Return value of unescape", nsb.length(), length);
return nsb.toUnicodeString();
}