From c3659dbb47869d1de567020122238e4fb47f6487 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 6 Apr 2021 13:33:27 +0200 Subject: [PATCH] refactor: `UNITS_UDLS` renamed to `UNITS_LITERALS` Also now the existence of the preprocessor flag is enough to trigger the feature (`#ifdef` instead of `#if`) --- README.md | 2 +- conanfile.py | 6 +++--- docs/CHANGELOG.md | 2 +- docs/framework/quantities.rst | 6 +++--- docs/quick_start.rst | 2 +- docs/usage.rst | 10 +++++----- example/alternative_namespaces/CMakeLists.txt | 2 +- example/hello_units.cpp | 2 +- src/CMakeLists.txt | 4 ++-- src/cmake/AddUnitsModule.cmake | 4 +--- src/core/CMakeLists.txt | 4 +--- src/core/include/units/generic/angle.h | 4 ++-- .../include/units/isq/iec80000/modulation_rate.h | 4 ++-- .../include/units/isq/iec80000/storage_capacity.h | 4 ++-- .../include/units/isq/iec80000/traffic_intensity.h | 4 ++-- .../include/units/isq/iec80000/transfer_rate.h | 4 ++-- .../si-cgs/include/units/isq/si/cgs/acceleration.h | 4 ++-- src/systems/si-cgs/include/units/isq/si/cgs/area.h | 4 ++-- src/systems/si-cgs/include/units/isq/si/cgs/energy.h | 4 ++-- src/systems/si-cgs/include/units/isq/si/cgs/force.h | 4 ++-- src/systems/si-cgs/include/units/isq/si/cgs/length.h | 4 ++-- src/systems/si-cgs/include/units/isq/si/cgs/mass.h | 4 ++-- src/systems/si-cgs/include/units/isq/si/cgs/power.h | 4 ++-- src/systems/si-cgs/include/units/isq/si/cgs/pressure.h | 4 ++-- src/systems/si-cgs/include/units/isq/si/cgs/speed.h | 4 ++-- src/systems/si-cgs/include/units/isq/si/cgs/time.h | 4 ++-- .../si-fps/include/units/isq/si/fps/acceleration.h | 4 ++-- src/systems/si-fps/include/units/isq/si/fps/area.h | 4 ++-- src/systems/si-fps/include/units/isq/si/fps/density.h | 4 ++-- src/systems/si-fps/include/units/isq/si/fps/energy.h | 4 ++-- src/systems/si-fps/include/units/isq/si/fps/force.h | 4 ++-- src/systems/si-fps/include/units/isq/si/fps/length.h | 4 ++-- src/systems/si-fps/include/units/isq/si/fps/mass.h | 4 ++-- src/systems/si-fps/include/units/isq/si/fps/power.h | 4 ++-- src/systems/si-fps/include/units/isq/si/fps/pressure.h | 4 ++-- src/systems/si-fps/include/units/isq/si/fps/speed.h | 4 ++-- src/systems/si-fps/include/units/isq/si/fps/time.h | 4 ++-- src/systems/si-fps/include/units/isq/si/fps/volume.h | 4 ++-- src/systems/si-iau/include/units/isq/si/iau/length.h | 4 ++-- .../si-imperial/include/units/isq/si/imperial/length.h | 4 ++-- .../include/units/isq/si/international/area.h | 4 ++-- .../include/units/isq/si/international/length.h | 4 ++-- .../include/units/isq/si/international/speed.h | 4 ++-- .../include/units/isq/si/international/volume.h | 4 ++-- .../include/units/isq/si/typographic/length.h | 4 ++-- src/systems/si-us/include/units/isq/si/us/length.h | 4 ++-- src/systems/si/include/units/isq/si/absorbed_dose.h | 4 ++-- src/systems/si/include/units/isq/si/acceleration.h | 4 ++-- .../si/include/units/isq/si/amount_of_substance.h | 4 ++-- src/systems/si/include/units/isq/si/angular_velocity.h | 4 ++-- src/systems/si/include/units/isq/si/area.h | 4 ++-- src/systems/si/include/units/isq/si/capacitance.h | 4 ++-- .../si/include/units/isq/si/catalytic_activity.h | 4 ++-- src/systems/si/include/units/isq/si/charge_density.h | 4 ++-- src/systems/si/include/units/isq/si/concentration.h | 4 ++-- src/systems/si/include/units/isq/si/conductance.h | 4 ++-- src/systems/si/include/units/isq/si/current_density.h | 4 ++-- src/systems/si/include/units/isq/si/density.h | 4 ++-- .../si/include/units/isq/si/dynamic_viscosity.h | 4 ++-- src/systems/si/include/units/isq/si/electric_charge.h | 4 ++-- src/systems/si/include/units/isq/si/electric_current.h | 4 ++-- .../si/include/units/isq/si/electric_field_strength.h | 4 ++-- src/systems/si/include/units/isq/si/energy.h | 4 ++-- src/systems/si/include/units/isq/si/energy_density.h | 4 ++-- src/systems/si/include/units/isq/si/force.h | 4 ++-- src/systems/si/include/units/isq/si/frequency.h | 4 ++-- src/systems/si/include/units/isq/si/heat_capacity.h | 4 ++-- src/systems/si/include/units/isq/si/inductance.h | 4 ++-- src/systems/si/include/units/isq/si/length.h | 4 ++-- src/systems/si/include/units/isq/si/luminance.h | 4 ++-- .../si/include/units/isq/si/luminous_intensity.h | 4 ++-- src/systems/si/include/units/isq/si/magnetic_flux.h | 4 ++-- .../si/include/units/isq/si/magnetic_induction.h | 4 ++-- src/systems/si/include/units/isq/si/mass.h | 4 ++-- src/systems/si/include/units/isq/si/molar_energy.h | 4 ++-- src/systems/si/include/units/isq/si/momentum.h | 4 ++-- src/systems/si/include/units/isq/si/permeability.h | 4 ++-- src/systems/si/include/units/isq/si/permittivity.h | 4 ++-- src/systems/si/include/units/isq/si/power.h | 4 ++-- src/systems/si/include/units/isq/si/pressure.h | 4 ++-- src/systems/si/include/units/isq/si/radioactivity.h | 4 ++-- src/systems/si/include/units/isq/si/resistance.h | 4 ++-- src/systems/si/include/units/isq/si/speed.h | 4 ++-- src/systems/si/include/units/isq/si/surface_tension.h | 4 ++-- .../si/include/units/isq/si/thermal_conductivity.h | 4 ++-- .../include/units/isq/si/thermodynamic_temperature.h | 4 ++-- src/systems/si/include/units/isq/si/time.h | 4 ++-- src/systems/si/include/units/isq/si/torque.h | 4 ++-- src/systems/si/include/units/isq/si/voltage.h | 4 ++-- src/systems/si/include/units/isq/si/volume.h | 4 ++-- test/unit_test/runtime/CMakeLists.txt | 2 +- test/unit_test/static/CMakeLists.txt | 4 ++-- 92 files changed, 181 insertions(+), 185 deletions(-) diff --git a/README.md b/README.md index 225aea71..36e323db 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ and dimensional analysis can be performed without sacrificing on accuracy. Pleas the below example for a quick preview of basic library features: ```cpp -#define UNITS_UDLS 1 +#define UNITS_LITERALS #include #include diff --git a/conanfile.py b/conanfile.py index b18a6524..32fa1f6e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -41,12 +41,12 @@ class UnitsConan(ConanFile): "gsl-lite/0.37.0" ) options = { - "udls": [True, False], + "literals": [True, False], "downcast_mode": ["off", "on", "auto"], "build_docs": [True, False] } default_options = { - "udls": False, + "literals": False, "downcast_mode": "on", "build_docs": True } @@ -118,7 +118,7 @@ class UnitsConan(ConanFile): def generate(self): tc = CMakeToolchain(self) - tc.variables["UNITS_UDLS"] = self.options.udls + tc.variables["UNITS_LITERALS"] = self.options.udls tc.variables["UNITS_DOWNCAST_MODE"] = str(self.options.downcast_mode).upper() # if self._run_tests: # TODO Enable this when environment is supported in the Conan toolchain tc.variables["UNITS_BUILD_DOCS"] = self.options.build_docs diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 0de43e7a..b0f19094 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,7 +6,7 @@ - (!) refactor: Refactored the library file tree - (!) refactor: `quantity::count()` renamed to `quantity::number()` - (!) refactor: `data` system renamed to `isq::iec80000` (quantity names renamed too) - - (!) refactor: quantity UDLs support has to be enabled with `UNITS_UDLS` preprocessor define + - (!) refactor: quantity UDLs support has to be enabled with `UNITS_LITERALS` preprocessor define - refactor: quantity (kind) point updated to reflect latest changes to `quantity` - refactor: basic concepts, `quantity` and `quantity_cast` refactored - refactor: `abs()` definition refactored to be more explicit about the return type diff --git a/docs/framework/quantities.rst b/docs/framework/quantities.rst index a4f0de73..18120cfa 100644 --- a/docs/framework/quantities.rst +++ b/docs/framework/quantities.rst @@ -87,7 +87,7 @@ User Defined Literals Alternatively, to construct quantities with compile-time known values the library provides :abbr:`UDL (User Defined Literal)` s for each :term:`unit` of every :term:`dimension`:: - #if UNITS_UDLS + #ifdef UNITS_LITERALS inline namespace literals { @@ -99,11 +99,11 @@ Alternatively, to construct quantities with compile-time known values the librar } - #endif // UNITS_UDLS + #endif // UNITS_LITERALS Thanks to them the same code can be as simple as:: - #define UNITS_UDLS 1 + #define UNITS_LITERALS using namespace units::isq::si::literals; auto d = 123._q_km; // si::length diff --git a/docs/quick_start.rst b/docs/quick_start.rst index 74592402..4b0745e4 100644 --- a/docs/quick_start.rst +++ b/docs/quick_start.rst @@ -40,7 +40,7 @@ but still easy to use interface where all unit conversions and dimensional analy performed without sacrificing on accuracy. Please see the below example for a quick preview of basic library features:: - #define UNITS_UDLS 1 + #define UNITS_LITERALS #include #include diff --git a/docs/usage.rst b/docs/usage.rst index cec3ccfe..cbca6aef 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -123,8 +123,8 @@ It also runs unit tests during Conan build. Conan Options ^^^^^^^^^^^^^ -udls -++++ +literals +++++++++ **Values**: ``True``/``False`` @@ -158,14 +158,14 @@ Additionally, enables project documentation generation when the project is being CMake Options ^^^^^^^^^^^^^ -UNITS_UDLS -+++++++++++++++++++ +UNITS_LITERALS +++++++++++++++ **Values**: ``ON``/``OFF`` **Defaulted to**: ``OFF`` -Equivalent to `udls`_. +Equivalent to `literals`_. UNITS_DOWNCAST_MODE diff --git a/example/alternative_namespaces/CMakeLists.txt b/example/alternative_namespaces/CMakeLists.txt index 1095d79f..c20bca76 100644 --- a/example/alternative_namespaces/CMakeLists.txt +++ b/example/alternative_namespaces/CMakeLists.txt @@ -25,7 +25,7 @@ cmake_minimum_required(VERSION 3.2) function(add_example target) add_executable(${target}_alt ${target}.cpp) target_link_libraries(${target}_alt PRIVATE mp-units::mp-units) - target_compile_definitions(${target}_alt PRIVATE UNITS_UDLS=1) + target_compile_definitions(${target}_alt PRIVATE UNITS_LITERALS) endfunction() add_example(box_example mp-units::si) diff --git a/example/hello_units.cpp b/example/hello_units.cpp index 6208cec2..a182b5c4 100644 --- a/example/hello_units.cpp +++ b/example/hello_units.cpp @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#define UNITS_UDLS 1 +#define UNITS_LITERALS #include #include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2707c44d..3cbd9c9c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,10 +27,10 @@ project(mp-units ) option(UNITS_AS_SYSTEM_HEADERS "Exports library as system headers" OFF) -option(UNITS_UDLS "Enables definitions of User Defined Literals (UDLs) provided for quantities of various units" OFF) +option(UNITS_LITERALS "Enables definitions of User Defined Literals (UDLs) provided for quantities of various units" OFF) message(STATUS "UNITS_AS_SYSTEM_HEADERS: ${UNITS_AS_SYSTEM_HEADERS}") -message(STATUS "UNITS_UDLS: ${UNITS_UDLS}") +message(STATUS "UNITS_LITERALS: ${UNITS_LITERALS}") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") diff --git a/src/cmake/AddUnitsModule.cmake b/src/cmake/AddUnitsModule.cmake index cfeffe2d..694e0620 100644 --- a/src/cmake/AddUnitsModule.cmake +++ b/src/cmake/AddUnitsModule.cmake @@ -45,7 +45,5 @@ endfunction() # function(add_units_system name) add_units_module(${name} ${ARGN}) - if(UNITS_UDLS) - target_compile_definitions(mp-units-${name} INTERFACE UNITS_UDLS=1) - endif() + target_compile_definitions(mp-units-${name} INTERFACE $<$:UNITS_LITERALS>) endfunction() diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 6041b0aa..c30b9179 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -55,9 +55,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") ) endif() -if(UNITS_UDLS) - target_compile_definitions(mp-units-core INTERFACE UNITS_UDLS=1) -endif() +target_compile_definitions(mp-units-core INTERFACE $<$:UNITS_LITERALS>) if(DEFINED UNITS_DOWNCAST_MODE) set(downcast_mode_options OFF ON AUTO) diff --git a/src/core/include/units/generic/angle.h b/src/core/include/units/generic/angle.h index 912bfd5a..fb4e1ad5 100644 --- a/src/core/include/units/generic/angle.h +++ b/src/core/include/units/generic/angle.h @@ -43,7 +43,7 @@ concept Angle = QuantityOfT; template> U, Representation Rep = double> using angle = quantity, U, Rep>; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -53,7 +53,7 @@ constexpr auto operator"" _q_rad(long double l) { return angle U, Representation Rep = double> using modulation_rate = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -66,7 +66,7 @@ constexpr auto operator"" _q_YBd(unsigned long long l) { gsl_ExpectsAudit(std::i } // namespace literals -#endif // UNITS_UDLS +#endif // UNITS_LITERALS namespace references { diff --git a/src/systems/isq-iec80000/include/units/isq/iec80000/storage_capacity.h b/src/systems/isq-iec80000/include/units/isq/iec80000/storage_capacity.h index da9b97b7..28b71036 100644 --- a/src/systems/isq-iec80000/include/units/isq/iec80000/storage_capacity.h +++ b/src/systems/isq-iec80000/include/units/isq/iec80000/storage_capacity.h @@ -79,7 +79,7 @@ concept StorageCapacity = QuantityOf; template U, Representation Rep = double> using storage_capacity = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -123,7 +123,7 @@ constexpr auto operator"" _q_PiB(unsigned long long l) { gsl_ExpectsAudit(std::i } // namespace literals -#endif // UNITS_UDLS +#endif // UNITS_LITERALS namespace references { diff --git a/src/systems/isq-iec80000/include/units/isq/iec80000/traffic_intensity.h b/src/systems/isq-iec80000/include/units/isq/iec80000/traffic_intensity.h index 325a4202..f575e797 100644 --- a/src/systems/isq-iec80000/include/units/isq/iec80000/traffic_intensity.h +++ b/src/systems/isq-iec80000/include/units/isq/iec80000/traffic_intensity.h @@ -43,7 +43,7 @@ concept TrafficIntensity = QuantityOf; template U, Representation Rep = double> using traffic_intensity = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -51,7 +51,7 @@ constexpr auto operator"" _q_E(unsigned long long l) { gsl_ExpectsAudit(std::in_ } // namespace literals -#endif // UNITS_UDLS +#endif // UNITS_LITERALS namespace references { diff --git a/src/systems/isq-iec80000/include/units/isq/iec80000/transfer_rate.h b/src/systems/isq-iec80000/include/units/isq/iec80000/transfer_rate.h index 98ba7cd1..56d70db9 100644 --- a/src/systems/isq-iec80000/include/units/isq/iec80000/transfer_rate.h +++ b/src/systems/isq-iec80000/include/units/isq/iec80000/transfer_rate.h @@ -52,7 +52,7 @@ concept TransferRate = QuantityOf; template U, Representation Rep = double> using transfer_rate = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -68,6 +68,6 @@ constexpr auto operator"" _q_YB_per_s(unsigned long long l) { gsl_ExpectsAudit(s } // namespace literals -#endif // UNITS_UDLS +#endif // UNITS_LITERALS } // namespace units::isq::iec80000 diff --git a/src/systems/si-cgs/include/units/isq/si/cgs/acceleration.h b/src/systems/si-cgs/include/units/isq/si/cgs/acceleration.h index 34f006c7..cfc19f07 100644 --- a/src/systems/si-cgs/include/units/isq/si/cgs/acceleration.h +++ b/src/systems/si-cgs/include/units/isq/si/cgs/acceleration.h @@ -40,7 +40,7 @@ struct dim_acceleration : isq::dim_acceleration U, Representation Rep = double> using acceleration = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -50,7 +50,7 @@ constexpr auto operator"" _q_Gal(long double l) { return acceleration {}; template U, Representation Rep = double> using area = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -52,7 +52,7 @@ constexpr auto operator"" _q_cm2(long double l) { return area {}; template U, Representation Rep = double> using energy = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -52,7 +52,7 @@ constexpr auto operator"" _q_erg(long double l) { return energy { template U, Representation Rep = double> using force = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -53,7 +53,7 @@ constexpr auto operator"" _q_dyn(long double l) { return force {}; template U, Representation Rep = double> using length = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -51,7 +51,7 @@ constexpr auto operator"" _q_cm(long double l) { return length {}; template U, Representation Rep = double> using mass = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -51,7 +51,7 @@ constexpr auto operator"" _q_g(long double l) { return mass(l } // namespace literals -#endif // UNITS_UDLS +#endif // UNITS_LITERALS namespace references { diff --git a/src/systems/si-cgs/include/units/isq/si/cgs/power.h b/src/systems/si-cgs/include/units/isq/si/cgs/power.h index e1511a6a..5b35c923 100644 --- a/src/systems/si-cgs/include/units/isq/si/cgs/power.h +++ b/src/systems/si-cgs/include/units/isq/si/cgs/power.h @@ -41,7 +41,7 @@ struct dim_power : isq::dim_power U, Representation Rep = double> using power = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -51,6 +51,6 @@ constexpr auto operator"" _q_erg_per_s(long double l) { return power U, Representation Rep = double> using pressure = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -53,7 +53,7 @@ constexpr auto operator"" _q_Ba(long double l) { return pressure U, Representation Rep = double> using speed = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -50,6 +50,6 @@ constexpr auto operator"" _q_cm_per_s(long double l) { return speed U, Representation Rep = double> using acceleration = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -49,6 +49,6 @@ constexpr auto operator"" _q_ft_per_s2(long double l) { return acceleration {}; template U, Representation Rep = double> using area = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -51,7 +51,7 @@ constexpr auto operator"" _q_ft2(long double l) { return area U, Representation Rep = double> using density = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -51,6 +51,6 @@ constexpr auto operator"" _q_lb_per_ft3(long double l) { return density U, Representation Rep = double> using energy = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -59,6 +59,6 @@ constexpr auto operator"" _q_ft_lbf(long double l) { return energy U, Representation Rep = double> using force = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -70,7 +70,7 @@ constexpr auto operator"" _q_klbf(long double l) { return force {}; template U, Representation Rep = double> using length = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -100,7 +100,7 @@ constexpr auto operator"" _q_naut_mi(long double l) { return length{}; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -100,7 +100,7 @@ constexpr auto operator"" _q_lton(long double l) { return mass U, Representation Rep = double> using power = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -64,7 +64,7 @@ constexpr auto operator"" _q_hp(long double l) { return power {}; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -67,7 +67,7 @@ constexpr auto operator"" _q_kpsi(long double l) { return pressure {}; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -66,7 +66,7 @@ constexpr auto operator"" _q_knot(long double l) { return speed {}; template U, Representation Rep = double> using volume = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -56,7 +56,7 @@ constexpr auto operator"" _q_yd3(long double l) { return volume {}; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -62,7 +62,7 @@ constexpr auto operator"" _q_angstrom(long double l) { return si::length {}; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -54,7 +54,7 @@ constexpr auto operator"" _q_rd(long double l) { return si::length {}; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -47,7 +47,7 @@ constexpr auto operator"" _q_ft2(long double l) { return si::area { // https://en.wikipedia.org/wiki/Thousandth_of_an_inch using mil = thou; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -104,7 +104,7 @@ constexpr auto operator"" _q_mil(long double l) { return si::length {}; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -46,6 +46,6 @@ constexpr auto operator"" _q_mi_per_h(long double l) { return si::speed {}; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -47,7 +47,7 @@ constexpr auto operator"" _q_ft3(long double l) { return si::volume {}; struct point_prn : named_scaled_unit {}; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -63,7 +63,7 @@ constexpr auto operator"" _q_point_prn(long double l) { return si::length {}; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -63,7 +63,7 @@ constexpr auto operator"" _q_mi_us(long double l) { return si::length U, Representation Rep = double> using absorbed_dose = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -152,7 +152,7 @@ constexpr auto operator"" _q_YGy(long double l) { return absorbed_dose U, Representation Rep = double> using acceleration = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -49,6 +49,6 @@ constexpr auto operator"" _q_m_per_s2(long double l) { return acceleration {}; template U, Representation Rep = double> using amount_of_substance = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -51,7 +51,7 @@ constexpr auto operator"" _q_mol(long double l) { return amount_of_substance U, Representation Rep = double> using angular_velocity = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -51,6 +51,6 @@ constexpr auto operator"" _q_rad_per_s(long double l) { return angular_velocity< } // namespace literals -#endif // UNITS_UDLS +#endif // UNITS_LITERALS } // namespace units::isq::si diff --git a/src/systems/si/include/units/isq/si/area.h b/src/systems/si/include/units/isq/si/area.h index 96b955d5..9ac0121b 100644 --- a/src/systems/si/include/units/isq/si/area.h +++ b/src/systems/si/include/units/isq/si/area.h @@ -63,7 +63,7 @@ struct hectare : alias_unit {}; template U, Representation Rep = double> using area = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -157,7 +157,7 @@ constexpr auto operator"" _q_ha(long double l) { return area U, Representation Rep = double> using capacitance = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -153,7 +153,7 @@ constexpr auto operator"" _q_YF(long double l) { return capacitance U, Representation Rep = double> using catalytic_activity = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -159,7 +159,7 @@ constexpr auto operator"" _q_U(long double l) { return catalytic_activity; template U, Representation Rep = double> using surface_charge_density = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -61,6 +61,6 @@ constexpr auto operator"" _q_C_per_m2(long double l) { return surface_charge_den } // namespace literals -#endif // UNITS_UDLS +#endif // UNITS_LITERALS } // namespace units::isq::si diff --git a/src/systems/si/include/units/isq/si/concentration.h b/src/systems/si/include/units/isq/si/concentration.h index 3d969a4d..64351e4b 100644 --- a/src/systems/si/include/units/isq/si/concentration.h +++ b/src/systems/si/include/units/isq/si/concentration.h @@ -40,7 +40,7 @@ struct dim_concentration : isq::dim_concentration U, Representation Rep = double> using concentration = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -50,7 +50,7 @@ constexpr auto operator"" _q_mol_per_m3(long double l) { return concentration U, Representation Rep = double> using conductance = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -132,7 +132,7 @@ constexpr auto operator"" _q_YS(long double l) { return conductance U, Representation Rep = double> using current_density = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -52,6 +52,6 @@ constexpr auto operator"" _q_A_per_m2(long double l) { return current_density U, Representation Rep = double> using density = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -52,6 +52,6 @@ constexpr auto operator"" _q_kg_per_m3(long double l) { return density U, Representation Rep = double> using dynamic_viscosity = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -50,7 +50,7 @@ constexpr auto operator"" _q_Pa_s(long double l) { return dynamic_viscosity U, Representation Rep = double> using electric_charge = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -52,7 +52,7 @@ constexpr auto operator"" _q_C(long double l) { return electric_charge {}; template U, Representation Rep = double> using electric_current = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -151,7 +151,7 @@ constexpr auto operator"" _q_YA(long double l) { return electric_current U, Representation Rep = double> using electric_field_strength = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -49,6 +49,6 @@ constexpr auto operator"" _q_V_per_m(long double l) { return electric_field_stre } // namespace literals -#endif // UNITS_UDLS +#endif // UNITS_LITERALS } // namespace units::isq::si diff --git a/src/systems/si/include/units/isq/si/energy.h b/src/systems/si/include/units/isq/si/energy.h index 27d3ee80..7a1e09c1 100644 --- a/src/systems/si/include/units/isq/si/energy.h +++ b/src/systems/si/include/units/isq/si/energy.h @@ -61,7 +61,7 @@ struct dim_energy : isq::dim_energy {} template U, Representation Rep = double> using energy = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -143,7 +143,7 @@ constexpr auto operator"" _q_GeV(long double l) { return energy U, Representation Rep = double> using energy_density = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -50,6 +50,6 @@ constexpr auto operator"" _q_J_per_m3(long double l) { return energy_density template U, Representation Rep = double> using force = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -153,7 +153,7 @@ constexpr auto operator"" _q_YN(long double l) { return force {}; template U, Representation Rep = double> using frequency = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -131,7 +131,7 @@ constexpr auto operator"" _q_YHz(long double l) { return frequency; template U, Representation Rep = double> using molar_heat_capacity = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -71,7 +71,7 @@ constexpr auto operator"" _q_J_per_mol_K(long double l) { return molar_heat_capa } // namespace literals -#endif // UNITS_UDLS +#endif // UNITS_LITERALS } // namespace units::isq::si diff --git a/src/systems/si/include/units/isq/si/inductance.h b/src/systems/si/include/units/isq/si/inductance.h index 311c13c4..b55e68a1 100644 --- a/src/systems/si/include/units/isq/si/inductance.h +++ b/src/systems/si/include/units/isq/si/inductance.h @@ -59,7 +59,7 @@ struct dim_inductance : isq::dim_inductance U, Representation Rep = double> using inductance = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -133,7 +133,7 @@ constexpr auto operator"" _q_YH(long double l) { return inductance {}; template U, Representation Rep = double> using length = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -157,7 +157,7 @@ constexpr auto operator"" _q_au(long double l) { return length U, Representation Rep = double> using luminance = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -50,7 +50,7 @@ constexpr auto operator"" _q_cd_per_m2(long double l) { return luminance {}; template U, Representation Rep = double> using luminous_intensity = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -151,7 +151,7 @@ constexpr auto operator"" _q_Ycd(long double l) { return luminous_intensity U, Representation Rep = double> using magnetic_flux = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -133,7 +133,7 @@ constexpr auto operator"" _q_YWb(long double l) { return magnetic_flux U, Representation Rep = double> using magnetic_induction = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -141,7 +141,7 @@ constexpr auto operator"" _q_G(long double l) { return magnetic_induction {}; template U, Representation Rep = double> using mass = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -263,7 +263,7 @@ constexpr auto operator"" _q_Da(long double l) { return mass U, Representation Rep = double> using molar_energy = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -52,6 +52,6 @@ constexpr auto operator"" _q_J_per_mol(long double l) { return molar_energy U, Representation Rep = double> using momentum = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -50,6 +50,6 @@ constexpr auto operator"" _q_kg_m_per_s(long double l) { return momentum U, Representation Rep = double> using permeability = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -51,7 +51,7 @@ constexpr auto operator"" _q_H_per_m(long double l) { return permeability U, Representation Rep = double> using permittivity = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -51,7 +51,7 @@ constexpr auto operator"" _q_F_per_m(long double l) { return permittivity {}; template U, Representation Rep = double> using power = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -132,7 +132,7 @@ constexpr auto operator"" _q_YW(long double l) { return power U, Representation Rep = double> using pressure = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -153,7 +153,7 @@ constexpr auto operator"" _q_YPa(long double l) { return pressure U, Representation Rep = double> using radioactivity = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -151,7 +151,7 @@ constexpr auto operator"" _q_YBq(long double l) { return radioactivity U, Representation Rep = double> using resistance = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -133,7 +133,7 @@ constexpr auto operator"" _q_YR(long double l) { return resistance U, Representation Rep = double> using speed = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -56,6 +56,6 @@ constexpr auto operator"" _q_km_per_h(long double l) { return speed U, Representation Rep = double> using surface_tension = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -50,6 +50,6 @@ constexpr auto operator"" _q_N_per_m(long double l) { return surface_tension U, Representation Rep = double> using thermal_conductivity = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -51,6 +51,6 @@ constexpr auto operator"" _q_W_per_m_K(long double l) { return thermal_conductiv } // namespace literals -#endif // UNITS_UDLS +#endif // UNITS_LITERALS } // namespace units::isq::si diff --git a/src/systems/si/include/units/isq/si/thermodynamic_temperature.h b/src/systems/si/include/units/isq/si/thermodynamic_temperature.h index 9d2a08bb..9ec6a4dd 100644 --- a/src/systems/si/include/units/isq/si/thermodynamic_temperature.h +++ b/src/systems/si/include/units/isq/si/thermodynamic_temperature.h @@ -40,7 +40,7 @@ struct dim_thermodynamic_temperature : isq::dim_thermodynamic_temperature U, Representation Rep = double> using thermodynamic_temperature = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -50,7 +50,7 @@ constexpr auto operator"" _q_K(long double l) { return thermodynamic_temperature } // namespace literals -#endif // UNITS_UDLS +#endif // UNITS_LITERALS namespace references { diff --git a/src/systems/si/include/units/isq/si/time.h b/src/systems/si/include/units/isq/si/time.h index cf0624bd..74395c1f 100644 --- a/src/systems/si/include/units/isq/si/time.h +++ b/src/systems/si/include/units/isq/si/time.h @@ -52,7 +52,7 @@ struct dim_time : isq::dim_time {}; template U, Representation Rep = double> using time = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -106,7 +106,7 @@ constexpr auto operator"" _q_d(long double l) { return time(l) } // namespace literals -#endif // UNITS_UDLS +#endif // UNITS_LITERALS namespace references { diff --git a/src/systems/si/include/units/isq/si/torque.h b/src/systems/si/include/units/isq/si/torque.h index 2b59997f..d960be90 100644 --- a/src/systems/si/include/units/isq/si/torque.h +++ b/src/systems/si/include/units/isq/si/torque.h @@ -42,7 +42,7 @@ struct dim_torque : isq::dim_torque U, Representation Rep = double> using torque = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -52,6 +52,6 @@ constexpr auto operator"" _q_Nm_per_rad(long double l) { return torque U, Representation Rep = double> using voltage = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -153,7 +153,7 @@ constexpr auto operator"" _q_YV(long double l) { return voltage {}; template U, Representation Rep = double> using volume = quantity; -#if UNITS_UDLS +#ifdef UNITS_LITERALS inline namespace literals { @@ -257,7 +257,7 @@ constexpr auto operator"" _q_Yl(long double l) { return volume,/wd4242 /wd4244,-Wno-conversion> ) -target_compile_definitions(unit_tests_static_truncating PRIVATE UNITS_UDLS=1) +target_compile_definitions(unit_tests_static_truncating PRIVATE UNITS_LITERALS) add_library(unit_tests_static cgs_test.cpp @@ -74,4 +74,4 @@ target_link_libraries(unit_tests_static PRIVATE unit_tests_static_truncating mp-units::mp-units ) -target_compile_definitions(unit_tests_static PRIVATE UNITS_UDLS=1) +target_compile_definitions(unit_tests_static PRIVATE UNITS_LITERALS)