![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <UnitConversion.h>
Public Member Functions | |
| FNumericUnit () | |
| FNumericUnit (const NumericType &InValue, EUnit InUnits=EUnit::Unspecified) | |
| FNumericUnit (const FNumericUnit &Other) | |
| FNumericUnit & | operator= (const FNumericUnit &Other) |
| template<typename OtherType > | |
| FNumericUnit (const FNumericUnit< OtherType > &Other) | |
| template<typename OtherType > | |
| FNumericUnit & | operator= (const FNumericUnit< OtherType > &Other) |
| TOptional< FNumericUnit< NumericType > > | ConvertTo (EUnit ToUnits) const |
| FNumericUnit< NumericType > | QuantizeUnitsToBestFit () const |
| template<typename OtherType > | |
| FNumericUnit< NumericType > & | operator= (const FNumericUnit< OtherType > &Other) |
Static Public Member Functions | |
| static TValueOrError< FNumericUnit< NumericType >, FText > | TryParseExpression (const TCHAR *InExpression, EUnit InDefaultUnit, const FNumericUnit< NumericType > &InExistingValue) |
| static TOptional< FNumericUnit< NumericType > > | TryParseString (const TCHAR *InSource) |
Public Attributes | |
| NumericType | Value |
| const EUnit | Units |
Friends | |
| template<typename OtherType > | |
| bool | operator== (const FNumericUnit< NumericType > &LHS, const FNumericUnit< OtherType > &RHS) |
| template<typename OtherType > | |
| bool | operator!= (const FNumericUnit< NumericType > &LHS, const FNumericUnit< OtherType > &RHS) |
FNumericUnit is a numeric type that wraps the templated type, whilst a specified unit. It handles conversion to/from related units automatically. The units are considered not to contribute to the type's state, and as such should be considered immutable once set.
| FNumericUnit< NumericType >::FNumericUnit | ( | ) |
Constructors
| FNumericUnit< NumericType >::FNumericUnit | ( | const NumericType & | InValue, |
| EUnit | InUnits = EUnit::Unspecified |
||
| ) |
| FNumericUnit< NumericType >::FNumericUnit | ( | const FNumericUnit< NumericType > & | Other | ) |
Copy construction/assignment from the same type
| FNumericUnit< NumericType >::FNumericUnit | ( | const FNumericUnit< OtherType > & | Other | ) |
Templated Copy construction/assignment from differing numeric types. Relies on implicit conversion of the two numeric types.
| TOptional< FNumericUnit< NumericType > > FNumericUnit< NumericType >::ConvertTo | ( | EUnit | ToUnits | ) | const |
Convert this quantity to a different unit
| FNumericUnit< NumericType > & FNumericUnit< NumericType >::operator= | ( | const FNumericUnit< NumericType > & | Other | ) |
| FNumericUnit & FNumericUnit< NumericType >::operator= | ( | const FNumericUnit< OtherType > & | Other | ) |
| FNumericUnit< NumericType > & FNumericUnit< NumericType >::operator= | ( | const FNumericUnit< OtherType > & | Other | ) |
| FNumericUnit< NumericType > FNumericUnit< NumericType >::QuantizeUnitsToBestFit | ( | ) | const |
Quantizes this number to the most appropriate unit for user friendly presentation (e.g. 1000m returns 1km).
|
static |
Try and parse an expression into a numeric unit
|
static |
Parse a numeric unit from a string
|
friend |
|
friend |
Global arithmetic operators for number types. Deals with conversion from related units correctly. Note must be inlined for hidden friend optimization to work
| const EUnit FNumericUnit< NumericType >::Units |
The associated units for the value. Can never change once set to anything other than EUnit::Unspecified.
| NumericType FNumericUnit< NumericType >::Value |
The numeric (scalar) value