refactor: unit_symbol_separator::dot renamed to half_high_dot

This commit is contained in:
Mateusz Pusz
2023-06-18 10:28:51 +02:00
parent faa4c203aa
commit 3d20dfef91
4 changed files with 16 additions and 15 deletions
+2 -2
View File
@@ -350,8 +350,8 @@ private:
f.specs.unit.separator = mp_units::unit_symbol_separator::space;
else {
if (f.specs.unit.encoding == mp_units::text_encoding::ascii)
throw UNITS_STD_FMT::format_error("dot unit separator allowed only for Unicode encoding");
f.specs.unit.separator = mp_units::unit_symbol_separator::dot;
throw UNITS_STD_FMT::format_error("half_high_dot unit separator allowed only for Unicode encoding");
f.specs.unit.separator = mp_units::unit_symbol_separator::half_high_dot;
}
}
+5 -4
View File
@@ -648,8 +648,8 @@ enum class unit_symbol_solidus {
};
enum class unit_symbol_separator {
space, // kg m²/s²
dot, // kg⋅m²/s² (valid only for unicode encoding)
space, // kg m²/s²
half_high_dot, // kg⋅m²/s² (valid only for unicode encoding)
default_separator = space
};
@@ -681,9 +681,10 @@ constexpr Out copy(const basic_symbol_text<UnicodeCharT, N, M>& txt, text_encodi
template<typename CharT, std::output_iterator<CharT> Out>
constexpr Out print_separator(Out out, unit_symbol_formatting fmt)
{
if (fmt.separator == unit_symbol_separator::dot) {
if (fmt.separator == unit_symbol_separator::half_high_dot) {
if (fmt.encoding != text_encoding::unicode)
throw std::invalid_argument("'unit_symbol_separator::dot' can be only used with 'text_encoding::unicode'");
throw std::invalid_argument(
"'unit_symbol_separator::half_high_dot' can be only used with 'text_encoding::unicode'");
copy(std::string_view("⋅"), out);
} else {
*out++ = ' ';