Navigation
API > API/Runtime > API/Runtime/Core
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.
| Name | FNumericUnit |
| Type | struct |
| Header File | /Engine/Source/Runtime/Core/Public/Math/UnitConversion.h |
| Include Path | #include "Math/UnitConversion.h" |
Syntax
template<typename NumericType>
struct FNumericUnit
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FNumericUnit () |
Constructors | Math/UnitConversion.h | |
FNumericUnit
(
const FNumericUnit& Other |
Copy construction/assignment from the same type | Math/UnitConversion.h | |
FNumericUnit
(
const FNumericUnit< OtherType >& Other |
Templated Copy construction/assignment from differing numeric types. | Math/UnitConversion.h | |
FNumericUnit
(
const NumericType& InValue, |
Math/UnitConversion.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Units | const EUnit | The associated units for the value. | Math/UnitConversion.h | |
| Value | NumericType | The numeric (scalar) value | Math/UnitConversion.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TOptional< FNumericUnit< NumericType > > ConvertTo
(
EUnit ToUnits |
Convert this quantity to a different unit | Math/UnitConversion.h | |
FNumericUnit< NumericType > QuantizeUnitsToBestFit() |
Quantizes this number to the most appropriate unit for user friendly presentation (e.g. 1000m returns 1km). | Math/UnitConversion.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static bool ExtractNumberBoundary
(
const TCHAR* Start, |
Given a string, skip past whitespace, then any numeric characters. | Math/UnitConversion.h | |
static TValueOrError< FNumericUnit< NumericType >, FText > TryParseExpression
(
const TCHAR* InExpression, |
Try and parse an expression into a numeric unit | Math/UnitConversion.h | |
static TOptional< FNumericUnit< NumericType > > TryParseString
(
const TCHAR* InSource |
Parse a numeric unit from a string | Math/UnitConversion.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
operator const NumericType &() |
Conversion to the numeric type disabled as coupled with implicit construction from NumericType can easily lead to loss of associated units. | Math/UnitConversion.h | |
FNumericUnit & operator=
(
const FNumericUnit& Other |
Math/UnitConversion.h | ||
FNumericUnit & operator=
(
const FNumericUnit< OtherType >& Other |
Math/UnitConversion.h | ||
FNumericUnit< NumericType > & operator=
(
const FNumericUnit< OtherType >& Other |