#include "MRViewer/exports.h"
#include "MRViewer/MRVectorTraits.h"
#include <cassert>
#include <optional>
#include <string>
#include <variant>
Go to the source code of this file.
Classes | |
struct | MR::UnitInfo |
struct | MR::detail::Units::Empty |
struct | MR::UnitToStringParams< E > |
Namespaces | |
namespace | MR |
namespace | MR::detail |
namespace | MR::detail::Units |
Concepts | |
concept | MR::UnitEnum |
concept | MR::detail::Units::Scalar |
Macros | |
#define | DETAIL_MR_UNIT_ENUMS(X) X(NoUnit) X(LengthUnit) X(AngleUnit) X(PixelSizeUnit) X(RatioUnit) X(TimeUnit) X(MovementSpeedUnit) X(AreaUnit) X(VolumeUnit) X(InvLengthUnit) |
#define | DETAIL_MR_UNIT_VALUE_TYPES(X, ...) |
#define | MR_X(E) || std::same_as<T, E> |
#define | MR_X(E) template <> [[nodiscard]] MRVIEWER_API const UnitInfo& getUnitInfo( E unit ); |
#define | MR_X(E) extern template MRVIEWER_API const UnitToStringParams<E>& getDefaultUnitParams(); |
#define | MR_X(E) extern template MRVIEWER_API void setDefaultUnitParams( const UnitToStringParams<E>& newParams ); |
#define | MR_TRIM_LEADING_COMMA(...) MR_TRIM_LEADING_COMMA_(__VA_ARGS__) |
#define | MR_TRIM_LEADING_COMMA_(x, ...) __VA_ARGS__ |
#define | MR_X(E) , UnitToStringParams<E> |
#define | MR_Y(T, E) extern template MRVIEWER_API std::string valueToString<E, T>( T value, const UnitToStringParams<E>& params ); |
#define | MR_X(E) DETAIL_MR_UNIT_VALUE_TYPES(MR_Y, E) |
#define | MR_X(T) extern template MRVIEWER_API std::string valueToString( T value, const VarUnitToStringParams& params ); |
#define | MR_X(T) |
#define | MR_Y(T, E) extern template MRVIEWER_API std::string valueToImGuiFormatString( T value, const UnitToStringParams<E>& params ); |
#define | MR_X(E) DETAIL_MR_UNIT_VALUE_TYPES(MR_Y, E) |
#define | MR_X(T) extern template MRVIEWER_API std::string valueToImGuiFormatString( T value, const VarUnitToStringParams& params ); |
Typedefs | |
template<typename T > | |
using | MR::detail::Units::MakeFloatingPoint = std::conditional_t<std::is_integral_v<typename VectorTraits<T>::BaseType>, typename VectorTraits<T>::template ChangeBaseType<float>, T> |
using | MR::VarUnitToStringParams |
Enumerations | |
enum class | MR::NoUnit { MR::_count } |
enum class | MR::LengthUnit { MR::mm , MR::meters , MR::inches , MR::_count } |
enum class | MR::AngleUnit { MR::radians , MR::degrees , MR::_count } |
enum class | MR::PixelSizeUnit { MR::pixels , MR::_count } |
enum class | MR::RatioUnit { MR::factor , MR::percents , MR::_count } |
enum class | MR::TimeUnit { MR::seconds , MR::milliseconds , MR::_count } |
enum class | MR::MovementSpeedUnit { MR::mmPerSecond , MR::metersPerSecond , MR::inchesPerSecond , MR::_count } |
enum class | MR::AreaUnit { MR::mm2 , MR::meters2 , MR::inches2 , MR::_count } |
enum class | MR::VolumeUnit { MR::mm3 , MR::meters3 , MR::inches3 , MR::_count } |
enum class | MR::InvLengthUnit { MR::inv_mm , MR::inv_meters , MR::inv_inches , MR::_count } |
enum class | MR::NumberStyle { MR::normal , MR::distributePrecision , MR::exponential , MR::maybeExponential } |
enum class | MR::DegreesMode { MR::degrees , MR::degreesMinutes , MR::degreesMinutesSeconds , MR::_count } |
Functions | |
template<UnitEnum E> | |
const UnitInfo & | MR::getUnitInfo (E unit)=delete |
template<UnitEnum E> | |
bool | MR::unitsAreEquivalent (E a, E b) |
template<UnitEnum E> | |
bool | MR::unitsAreEquivalent (const std::optional< E > &a, const std::optional< E > &b) |
template<UnitEnum E, typename T > | |
detail::Units::MakeFloatingPoint< T > | MR::convertUnits (E from, E to, const T &value) |
template<UnitEnum E, typename T > | |
detail::Units::MakeFloatingPoint< T > | MR::convertUnits (const std::optional< E > &from, const std::optional< E > &to, const T &value) |
template<UnitEnum E> | |
const UnitToStringParams< E > & | MR::getDefaultUnitParams () |
template<UnitEnum E> | |
void | MR::setDefaultUnitParams (const UnitToStringParams< E > &newParams) |
MRVIEWER_API std::string_view | MR::toString (DegreesMode mode) |
template<UnitEnum E, detail::Units::Scalar T> | |
MRVIEWER_API std::string | MR::valueToString (T value, const UnitToStringParams< E > ¶ms=getDefaultUnitParams< E >()) |
template<detail::Units::Scalar T> | |
MRVIEWER_API std::string | MR::valueToString (T value, const VarUnitToStringParams ¶ms) |
template<detail::Units::Scalar T> | |
MRVIEWER_API int | MR::guessPrecision (T value) |
template<detail::Units::Scalar T> | |
MRVIEWER_API int | MR::guessPrecision (T min, T max) |
template<typename T > requires (VectorTraits<T>::size > 1 && detail::Units::Scalar<typename VectorTraits<T>::BaseType>) | |
int | MR::guessPrecision (T value) |
template<typename T > requires (VectorTraits<T>::size > 1 && detail::Units::Scalar<typename VectorTraits<T>::BaseType>) | |
int | MR::guessPrecision (T min, T max) |
template<UnitEnum E, detail::Units::Scalar T> | |
MRVIEWER_API std::string | MR::valueToImGuiFormatString (T value, const UnitToStringParams< E > ¶ms=getDefaultUnitParams< E >()) |
template<detail::Units::Scalar T> | |
MRVIEWER_API std::string | MR::valueToImGuiFormatString (T value, const VarUnitToStringParams ¶ms) |
#define DETAIL_MR_UNIT_ENUMS | ( | X | ) | X(NoUnit) X(LengthUnit) X(AngleUnit) X(PixelSizeUnit) X(RatioUnit) X(TimeUnit) X(MovementSpeedUnit) X(AreaUnit) X(VolumeUnit) X(InvLengthUnit) |
#define DETAIL_MR_UNIT_VALUE_TYPES | ( | X, | |
... ) |
#define MR_TRIM_LEADING_COMMA | ( | ... | ) | MR_TRIM_LEADING_COMMA_(__VA_ARGS__) |
#define MR_TRIM_LEADING_COMMA_ | ( | x, | |
... ) __VA_ARGS__ |
#define MR_X | ( | E | ) | || std::same_as<T, E> |
#define MR_X | ( | E | ) | template <> [[nodiscard]] MRVIEWER_API const UnitInfo& getUnitInfo( E unit ); |
#define MR_X | ( | E | ) | extern template MRVIEWER_API const UnitToStringParams<E>& getDefaultUnitParams(); |
#define MR_X | ( | E | ) | extern template MRVIEWER_API void setDefaultUnitParams( const UnitToStringParams<E>& newParams ); |
#define MR_X | ( | E | ) | , UnitToStringParams<E> |
#define MR_X | ( | E | ) | DETAIL_MR_UNIT_VALUE_TYPES(MR_Y, E) |
#define MR_X | ( | E | ) | DETAIL_MR_UNIT_VALUE_TYPES(MR_Y, E) |
#define MR_X | ( | T | ) | extern template MRVIEWER_API std::string valueToString( T value, const VarUnitToStringParams& params ); |
#define MR_X | ( | T | ) |
#define MR_X | ( | T | ) | extern template MRVIEWER_API std::string valueToImGuiFormatString( T value, const VarUnitToStringParams& params ); |
#define MR_Y | ( | T, | |
E ) extern template MRVIEWER_API std::string valueToString<E, T>( T value, const UnitToStringParams<E>& params ); |
#define MR_Y | ( | T, | |
E ) extern template MRVIEWER_API std::string valueToImGuiFormatString( T value, const UnitToStringParams<E>& params ); |