mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 06:25:30 +00:00
ICU-13644 Replying to review feedback. Changing enum methods on NumberFormatter to take by value instead of const reference.
X-SVN-Rev: 41304
This commit is contained in:
parent
2e10a5315d
commit
3d0bf4b9c7
2 changed files with 31 additions and 31 deletions
|
@ -86,26 +86,14 @@ Derived NumberFormatterSettings<Derived>::perUnit(const icu::MeasureUnit& perUni
|
|||
|
||||
template<typename Derived>
|
||||
Derived NumberFormatterSettings<Derived>::perUnit(const icu::MeasureUnit& perUnit)&& {
|
||||
Derived copy(*this);
|
||||
// See comments above about slicing.
|
||||
copy.fMacros.perUnit = perUnit;
|
||||
return copy;
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
Derived NumberFormatterSettings<Derived>::adoptPerUnit(icu::MeasureUnit* perUnit) const& {
|
||||
Derived move(std::move(*this));
|
||||
// See comments above about slicing and ownership.
|
||||
if (perUnit != nullptr) {
|
||||
// TODO: On nullptr, reset to default value?
|
||||
move.fMacros.perUnit = std::move(*perUnit);
|
||||
delete perUnit;
|
||||
}
|
||||
// See comments above about slicing.
|
||||
move.fMacros.perUnit = perUnit;
|
||||
return move;
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
Derived NumberFormatterSettings<Derived>::adoptPerUnit(icu::MeasureUnit* perUnit)&& {
|
||||
Derived NumberFormatterSettings<Derived>::adoptPerUnit(icu::MeasureUnit* perUnit) const& {
|
||||
Derived copy(*this);
|
||||
// See comments above about slicing and ownership.
|
||||
if (perUnit != nullptr) {
|
||||
|
@ -116,6 +104,18 @@ Derived NumberFormatterSettings<Derived>::adoptPerUnit(icu::MeasureUnit* perUnit
|
|||
return copy;
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
Derived NumberFormatterSettings<Derived>::adoptPerUnit(icu::MeasureUnit* perUnit)&& {
|
||||
Derived move(std::move(*this));
|
||||
// See comments above about slicing and ownership.
|
||||
if (perUnit != nullptr) {
|
||||
// TODO: On nullptr, reset to default value?
|
||||
move.fMacros.perUnit = std::move(*perUnit);
|
||||
delete perUnit;
|
||||
}
|
||||
return move;
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
Derived NumberFormatterSettings<Derived>::rounding(const Rounder& rounder) const& {
|
||||
Derived copy(*this);
|
||||
|
@ -133,7 +133,7 @@ Derived NumberFormatterSettings<Derived>::rounding(const Rounder& rounder)&& {
|
|||
}
|
||||
|
||||
template<typename Derived>
|
||||
Derived NumberFormatterSettings<Derived>::grouping(const UGroupingStrategy& strategy) const& {
|
||||
Derived NumberFormatterSettings<Derived>::grouping(UGroupingStrategy strategy) const& {
|
||||
Derived copy(*this);
|
||||
// NOTE: This is slightly different than how the setting is stored in Java
|
||||
// because we want to put it on the stack.
|
||||
|
@ -142,7 +142,7 @@ Derived NumberFormatterSettings<Derived>::grouping(const UGroupingStrategy& stra
|
|||
}
|
||||
|
||||
template<typename Derived>
|
||||
Derived NumberFormatterSettings<Derived>::grouping(const UGroupingStrategy& strategy)&& {
|
||||
Derived NumberFormatterSettings<Derived>::grouping(UGroupingStrategy strategy)&& {
|
||||
Derived move(std::move(*this));
|
||||
move.fMacros.grouper = Grouper::forStrategy(strategy);
|
||||
return move;
|
||||
|
@ -191,42 +191,42 @@ Derived NumberFormatterSettings<Derived>::adoptSymbols(NumberingSystem* ns)&& {
|
|||
}
|
||||
|
||||
template<typename Derived>
|
||||
Derived NumberFormatterSettings<Derived>::unitWidth(const UNumberUnitWidth& width) const& {
|
||||
Derived NumberFormatterSettings<Derived>::unitWidth(UNumberUnitWidth width) const& {
|
||||
Derived copy(*this);
|
||||
copy.fMacros.unitWidth = width;
|
||||
return copy;
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
Derived NumberFormatterSettings<Derived>::unitWidth(const UNumberUnitWidth& width)&& {
|
||||
Derived NumberFormatterSettings<Derived>::unitWidth(UNumberUnitWidth width)&& {
|
||||
Derived move(std::move(*this));
|
||||
move.fMacros.unitWidth = width;
|
||||
return move;
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
Derived NumberFormatterSettings<Derived>::sign(const UNumberSignDisplay& style) const& {
|
||||
Derived NumberFormatterSettings<Derived>::sign(UNumberSignDisplay style) const& {
|
||||
Derived copy(*this);
|
||||
copy.fMacros.sign = style;
|
||||
return copy;
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
Derived NumberFormatterSettings<Derived>::sign(const UNumberSignDisplay& style)&& {
|
||||
Derived NumberFormatterSettings<Derived>::sign(UNumberSignDisplay style)&& {
|
||||
Derived move(std::move(*this));
|
||||
move.fMacros.sign = style;
|
||||
return move;
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
Derived NumberFormatterSettings<Derived>::decimal(const UNumberDecimalSeparatorDisplay& style) const& {
|
||||
Derived NumberFormatterSettings<Derived>::decimal(UNumberDecimalSeparatorDisplay style) const& {
|
||||
Derived copy(*this);
|
||||
copy.fMacros.decimal = style;
|
||||
return copy;
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
Derived NumberFormatterSettings<Derived>::decimal(const UNumberDecimalSeparatorDisplay& style)&& {
|
||||
Derived NumberFormatterSettings<Derived>::decimal(UNumberDecimalSeparatorDisplay style)&& {
|
||||
Derived move(std::move(*this));
|
||||
move.fMacros.decimal = style;
|
||||
return move;
|
||||
|
|
|
@ -1671,7 +1671,7 @@ class U_I18N_API NumberFormatterSettings {
|
|||
* @return The fluent chain.
|
||||
* @draft ICU 61
|
||||
*/
|
||||
Derived grouping(const UGroupingStrategy &strategy) const &;
|
||||
Derived grouping(UGroupingStrategy strategy) const &;
|
||||
|
||||
/**
|
||||
* Overload of grouping() for use on an rvalue reference.
|
||||
|
@ -1683,7 +1683,7 @@ class U_I18N_API NumberFormatterSettings {
|
|||
* @provisional This API might change or be removed in a future release.
|
||||
* @draft ICU 62
|
||||
*/
|
||||
Derived grouping(const UGroupingStrategy& strategy) &&;
|
||||
Derived grouping(UGroupingStrategy strategy) &&;
|
||||
|
||||
/**
|
||||
* Specifies the minimum and maximum number of digits to render before the decimal mark.
|
||||
|
@ -1846,7 +1846,7 @@ class U_I18N_API NumberFormatterSettings {
|
|||
* @see UNumberUnitWidth
|
||||
* @draft ICU 60
|
||||
*/
|
||||
Derived unitWidth(const UNumberUnitWidth &width) const &;
|
||||
Derived unitWidth(UNumberUnitWidth width) const &;
|
||||
|
||||
/**
|
||||
* Overload of unitWidth() for use on an rvalue reference.
|
||||
|
@ -1857,7 +1857,7 @@ class U_I18N_API NumberFormatterSettings {
|
|||
* @see #unitWidth
|
||||
* @draft ICU 62
|
||||
*/
|
||||
Derived unitWidth(const UNumberUnitWidth &width) &&;
|
||||
Derived unitWidth(UNumberUnitWidth width) &&;
|
||||
|
||||
/**
|
||||
* Sets the plus/minus sign display strategy. Most common values:
|
||||
|
@ -1885,7 +1885,7 @@ class U_I18N_API NumberFormatterSettings {
|
|||
* @provisional This API might change or be removed in a future release.
|
||||
* @draft ICU 60
|
||||
*/
|
||||
Derived sign(const UNumberSignDisplay &style) const &;
|
||||
Derived sign(UNumberSignDisplay style) const &;
|
||||
|
||||
/**
|
||||
* Overload of sign() for use on an rvalue reference.
|
||||
|
@ -1896,7 +1896,7 @@ class U_I18N_API NumberFormatterSettings {
|
|||
* @see #sign
|
||||
* @draft ICU 62
|
||||
*/
|
||||
Derived sign(const UNumberSignDisplay &style) &&;
|
||||
Derived sign(UNumberSignDisplay style) &&;
|
||||
|
||||
/**
|
||||
* Sets the decimal separator display strategy. This affects integer numbers with no fraction part. Most common
|
||||
|
@ -1924,7 +1924,7 @@ class U_I18N_API NumberFormatterSettings {
|
|||
* @provisional This API might change or be removed in a future release.
|
||||
* @draft ICU 60
|
||||
*/
|
||||
Derived decimal(const UNumberDecimalSeparatorDisplay &style) const &;
|
||||
Derived decimal(UNumberDecimalSeparatorDisplay style) const &;
|
||||
|
||||
/**
|
||||
* Overload of decimal() for use on an rvalue reference.
|
||||
|
@ -1935,7 +1935,7 @@ class U_I18N_API NumberFormatterSettings {
|
|||
* @see #decimal
|
||||
* @draft ICU 62
|
||||
*/
|
||||
Derived decimal(const UNumberDecimalSeparatorDisplay &style) &&;
|
||||
Derived decimal(UNumberDecimalSeparatorDisplay style) &&;
|
||||
|
||||
/**
|
||||
* Sets a scale (multiplier) to be used to scale the number by an arbitrary amount before formatting.
|
||||
|
|
Loading…
Add table
Reference in a new issue