6#include <unordered_map>
21 const std::unordered_map<std::type_index, std::unordered_map<double, const char *>> shortNameMap =
24 {
meter.getValue(),
"m"},
29 {
inch.getValue(),
"in"},
30 {
foot.getValue(),
"ft"},
31 {
yard.getValue(),
"yd"},
32 {
mile.getValue(),
"mi"},
33 {
tile.getValue(),
"tile"},
38 return shortNameMap.at(
typeid(q)).at(q.getValue());
39 }
catch (
const std::out_of_range &e) {
40 throw std::domain_error(
41 "You have requested the shortname of an unknown unit somewhere (likely odometry strings). "
42 "Shortname for provided unit is unspecified. You can override this function to add more "
43 "names or manually specify the name instead.");
constexpr QLength kilometer
std::string getShortUnitName(QType q)
Returns a short name for a unit.
constexpr QAngle radian(1.0)
constexpr QLength meter(1.0)
constexpr QLength centimeter
constexpr QLength millimeter
constexpr QLength decimeter