// Export explicit template instantiations of MaybeStackArray, MemoryPool and // MaybeStackVector. This is required when building DLLs for Windows. (See // datefmt.h, collationiterator.h, erarules.h and others for similar examples.) // // Note: These need to be outside of the units namespace, or Clang will generate // a compile error. #if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN templateclass U_I18N_API MaybeStackArray<units::UnitsConverter*, 8>; templateclass U_I18N_API MemoryPool<units::UnitsConverter, 8>; templateclass U_I18N_API MaybeStackVector<units::UnitsConverter, 8>; templateclass U_I18N_API MaybeStackArray<MeasureUnitImpl*, 8>; templateclass U_I18N_API MemoryPool<MeasureUnitImpl, 8>; templateclass U_I18N_API MaybeStackVector<MeasureUnitImpl, 8>; templateclass U_I18N_API MaybeStackArray<MeasureUnit*, 8>; templateclass U_I18N_API MemoryPool<MeasureUnit, 8>; templateclass U_I18N_API MaybeStackVector<MeasureUnit, 8>; #endif
// Returns true if the specified `quantity` of the `inputUnit`, expressed in terms of the biggest // unit in the MeasureUnit `outputUnit`, is greater than or equal to `limit`. // For example, if the input unit is `meter` and the target unit is `foot+inch`. Therefore, this // function will convert the `quantity` from `meter` to `foot`, then, it will compare the value in // `foot` with the `limit`.
UBool greaterThanOrEqual(double quantity, double limit) const;
// Returns outputMeasures which is an array with the corresponding values. // - E.g. converting meters to feet and inches. // 1 meter --> 3 feet, 3.3701 inches // NOTE: // the smallest element is the only element that could have fractional values. And all // other elements are floored to the nearest integer
MaybeStackVector<Measure>
convert(double quantity, icu::number::impl::RoundingImpl *rounder, UErrorCode &status) const;
// TODO(ICU-21937): Make it private after submitting the public units conversion API.
MaybeStackVector<UnitsConverter> unitsConverters_;
// TODO(ICU-21937): Make it private after submitting the public units conversion API. // Individual units of mixed units, sorted big to small, with indices // indicating the requested output mixed unit order.
MaybeStackVector<MeasureUnitImplWithIndex> units_;
private: // Sorts units_, which must be populated before calling this, and populates // unitsConverters_. void init(const MeasureUnitImpl &inputUnit, const ConversionRates &ratesInfo, UErrorCode &status);
// Applies the rounder to the quantity (last element) and bubble up any carried value to all the // intValues. // TODO(ICU-21288): get smarter about precision for mixed units. void applyRounder(MaybeStackArray<int64_t, 5> &intValues, double &quantity,
icu::number::impl::RoundingImpl *rounder, UErrorCode &status) const;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.