refactor: framework Unicode symbols are now spelled using their codes

This commit is contained in:
Mateusz Pusz
2024-10-23 22:12:53 +02:00
parent 1e38b2791c
commit 08b6a51b22
2 changed files with 5 additions and 5 deletions

View File

@@ -313,7 +313,7 @@ constexpr Out print_separator(Out out, const unit_symbol_formatting& fmt)
if (fmt.encoding != text_encoding::utf8)
MP_UNITS_THROW(
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);
} else {
*out++ = ' ';
@@ -393,7 +393,7 @@ constexpr Out magnitude_symbol_impl(Out out, const unit_symbol_formatting& fmt)
if constexpr (Exp10 != 0) {
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);
}
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.
*/
#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>;
#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
} pi;
inline constexpr auto 𝜋 = pi;

View File

@@ -650,7 +650,7 @@ template<std::intmax_t Num, std::intmax_t Den = 1, Unit U>
// common dimensionless units
// clang-format off
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 auto ppm = parts_per_million;
// clang-format on