mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 20:34:26 +02:00
refactor: framework Unicode symbols are now spelled using their codes
This commit is contained in:
@@ -313,7 +313,7 @@ constexpr Out print_separator(Out out, const unit_symbol_formatting& fmt)
|
|||||||
if (fmt.encoding != text_encoding::utf8)
|
if (fmt.encoding != text_encoding::utf8)
|
||||||
MP_UNITS_THROW(
|
MP_UNITS_THROW(
|
||||||
std::invalid_argument("'unit_symbol_separator::half_high_dot' can be only used with 'text_encoding::utf8'"));
|
std::invalid_argument("'unit_symbol_separator::half_high_dot' can be only used with 'text_encoding::utf8'"));
|
||||||
const std::string_view dot = "⋅";
|
const std::string_view dot = "\u22C5";
|
||||||
out = detail::copy(dot.begin(), dot.end(), out);
|
out = detail::copy(dot.begin(), dot.end(), out);
|
||||||
} else {
|
} else {
|
||||||
*out++ = ' ';
|
*out++ = ' ';
|
||||||
@@ -393,7 +393,7 @@ constexpr Out magnitude_symbol_impl(Out out, const unit_symbol_formatting& fmt)
|
|||||||
|
|
||||||
if constexpr (Exp10 != 0) {
|
if constexpr (Exp10 != 0) {
|
||||||
if (numerator || denominator) {
|
if (numerator || denominator) {
|
||||||
constexpr auto mag_multiplier = symbol_text(u8" × ", " x ");
|
constexpr auto mag_multiplier = symbol_text(u8" \u00D7 ", " x ");
|
||||||
out = copy_symbol<CharT>(mag_multiplier, fmt.encoding, negative_power, out);
|
out = copy_symbol<CharT>(mag_multiplier, fmt.encoding, negative_power, out);
|
||||||
}
|
}
|
||||||
constexpr auto exp = symbol_text("10") + detail::superscript<Exp10>();
|
constexpr auto exp = symbol_text("10") + detail::superscript<Exp10>();
|
||||||
@@ -690,10 +690,10 @@ constexpr Magnitude auto mag_power = _pow<Num, Den>(mag<Base>);
|
|||||||
* @brief A convenient Magnitude constant for pi, which we can manipulate like a regular number.
|
* @brief A convenient Magnitude constant for pi, which we can manipulate like a regular number.
|
||||||
*/
|
*/
|
||||||
#if defined MP_UNITS_COMP_CLANG || MP_UNITS_COMP_CLANG < 18
|
#if defined MP_UNITS_COMP_CLANG || MP_UNITS_COMP_CLANG < 18
|
||||||
inline constexpr struct pi final : mag_constant<symbol_text{u8"𝜋", "pi"}> {
|
inline constexpr struct pi final : mag_constant<symbol_text{u8"\U0001D70B", "pi"}> {
|
||||||
static constexpr auto _value_ = std::numbers::pi_v<long double>;
|
static constexpr auto _value_ = std::numbers::pi_v<long double>;
|
||||||
#else
|
#else
|
||||||
inline constexpr struct pi final : mag_constant<symbol_text{u8"𝜋", "pi"}, std::numbers::pi_v<long double>> {
|
inline constexpr struct pi final : mag_constant<symbol_text{u8"\U0001D70B", "pi"}, std::numbers::pi_v<long double>> {
|
||||||
#endif
|
#endif
|
||||||
} pi;
|
} pi;
|
||||||
inline constexpr auto 𝜋 = pi;
|
inline constexpr auto 𝜋 = pi;
|
||||||
|
@@ -650,7 +650,7 @@ template<std::intmax_t Num, std::intmax_t Den = 1, Unit U>
|
|||||||
// common dimensionless units
|
// common dimensionless units
|
||||||
// clang-format off
|
// clang-format off
|
||||||
inline constexpr struct percent final : named_unit<"%", mag_ratio<1, 100> * one> {} percent;
|
inline constexpr struct percent final : named_unit<"%", mag_ratio<1, 100> * one> {} percent;
|
||||||
inline constexpr struct per_mille final : named_unit<symbol_text{u8"‰", "%o"}, mag_ratio<1, 1000> * one> {} per_mille;
|
inline constexpr struct per_mille final : named_unit<symbol_text{u8"\u2030", "%o"}, mag_ratio<1, 1000> * one> {} per_mille;
|
||||||
inline constexpr struct parts_per_million final : named_unit<"ppm", mag_ratio<1, 1'000'000> * one> {} parts_per_million;
|
inline constexpr struct parts_per_million final : named_unit<"ppm", mag_ratio<1, 1'000'000> * one> {} parts_per_million;
|
||||||
inline constexpr auto ppm = parts_per_million;
|
inline constexpr auto ppm = parts_per_million;
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
Reference in New Issue
Block a user