xo-unit: minor tweaks; add xo_ratio dep to build

This commit is contained in:
Roland Conybeare 2024-04-19 13:30:47 -04:00
commit 937ab77169
2 changed files with 12 additions and 3 deletions

View file

@ -51,7 +51,7 @@ xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets
# ----------------------------------------------------------------
# dependencies
#xo_headeronly_dependency(${SELF_LIB} randomgen)
xo_headeronly_dependency(${SELF_LIB} xo_ratio)
# etc..
# end CMakeLists.txt

View file

@ -2,12 +2,15 @@
#pragma once
#include "stringliteral.hpp"
//#include "stringliteral.hpp"
//#include "xo/flatstring/flatstring.hpp"
#include <cstdint>
namespace xo {
namespace unit {
enum class dim {
invalid = -1,
/** weight. native unit = 1 gram **/
mass,
/** distance. native unit = 1 meter **/
@ -23,8 +26,13 @@ namespace xo {
currency,
/** a screen price **/
price,
/** comes last, counts entries **/
n_dim
};
static constexpr std::size_t n_dim = static_cast<std::size_t>(dim::n_dim);
enum class native_unit_id {
gram,
meter,
@ -53,6 +61,7 @@ namespace xo {
template <dim Dim>
constexpr auto native_unit_for_v = native_unit_for<Dim>::value;
} /*namespace unit*/
} /*namespace xo*/