dimval 0.2.0
Modern C++23 header-only library of dimensional values (units, measures, ranges)
Loading...
Searching...
No Matches
imperial.hpp
Go to the documentation of this file.
1#pragma once
2
12
13#include <dimval/define.hpp>
14
15// -----------------------------------------------------------------------------
16// Length
17// -----------------------------------------------------------------------------
18
20 "in",
21 "in",
22 "in",
23 "inch",
24 "length",
25 0.0254,
26 ::comms::Icon::from("tabler:ruler"),
27 ::comms::Colors::mui::teal[300],
28 static constexpr int default_precision = 2;)
29
31 "ft",
32 "ft",
33 "ft",
34 "foot",
35 "length",
36 0.3048,
37 ::comms::Icon::from("tabler:ruler"),
38 ::comms::Colors::mui::teal[400],
39 static constexpr int default_precision = 2;)
40
42 "mi",
43 "mi",
44 "mi",
45 "mile",
46 "length",
47 1609.344,
48 ::comms::Icons::mdi::map_marker_distance,
49 ::comms::Colors::mui::teal[500],
50 static constexpr int default_precision = 2;)
51
52DIMVAL_DEFINE_UNIT(NauticalMile,
53 "nmi",
54 "nmi",
55 "nmi",
56 "nautical mile",
57 "length",
58 1852.0,
59 ::comms::Icons::mdi::sail_boat,
60 ::comms::Colors::mui::teal[600],
61 static constexpr int default_precision = 2;)
62
63// -----------------------------------------------------------------------------
64// Mass
65// -----------------------------------------------------------------------------
66
68 "lb",
69 "lb",
70 "lb",
71 "pound",
72 "mass",
73 0.45359237,
74 ::comms::Icons::mdi::weight_pound,
75 ::comms::Colors::mui::blue_grey[300],
76 static constexpr int default_precision = 2;)
77
78// -----------------------------------------------------------------------------
79// Pressure
80// -----------------------------------------------------------------------------
81
82DIMVAL_DEFINE_UNIT(PoundsPerSquareInch,
83 "psi",
84 "psi",
85 "psi",
86 "pound per square inch",
87 "pressure",
88 6894.757293168,
89 ::comms::Icon::from("ph:gauge"),
90 ::comms::Colors::mui::blue_grey[400],
91 static constexpr int default_precision = 2;)
92
93// -----------------------------------------------------------------------------
94// Volume
95// -----------------------------------------------------------------------------
96
97// US liquid gallon (3.785411784 L exactly). UK imperial gallon is a different
98// 4.54609 L unit; that variant is intentionally postponed to v0.2.
100 "gal",
101 "gal",
102 "gal",
103 "US liquid gallon",
104 "volume",
105 3.785411784,
106 ::comms::Icons::mdi::gas_station,
107 ::comms::Colors::mui::blue_grey[300],
108 static constexpr int default_precision = 2;)
Macros that expand into a CRTP unit/measure struct and a runtime auto-registration for it.
#define DIMVAL_DEFINE_UNIT(Tag, Id, Symbol, ShortName, LongName, Kind, Factor, Icon, Color,...)
Define a unit struct in ::dimval and auto-register its descriptor at static-init time.
Definition define.hpp:72