Ark Server API (ASA) - Wiki
|
#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 |
Private Member Functions | |
operator const NumericType & () const | |
template<typename OtherType > | |
void | CopyValueWithConversion (const FNumericUnit< OtherType > &Other) |
Static Private Member Functions | |
static bool | ExtractNumberBoundary (const TCHAR *Start, const TCHAR *&End) |
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.
Definition at line 148 of file UnitConversion.h.
FNumericUnit< NumericType >::FNumericUnit | ( | ) |
Constructors
Definition at line 212 of file UnitConversion.inl.
FNumericUnit< NumericType >::FNumericUnit | ( | const NumericType & | InValue, |
EUnit | InUnits = EUnit::Unspecified ) |
Definition at line 217 of file UnitConversion.inl.
FNumericUnit< NumericType >::FNumericUnit | ( | const FNumericUnit< NumericType > & | Other | ) |
Copy construction/assignment from the same type
Definition at line 222 of file UnitConversion.inl.
FNumericUnit< NumericType >::FNumericUnit | ( | const FNumericUnit< OtherType > & | Other | ) |
Templated Copy construction/assignment from differing numeric types. Relies on implicit conversion of the two numeric types.
Definition at line 237 of file UnitConversion.inl.
TOptional< FNumericUnit< NumericType > > FNumericUnit< NumericType >::ConvertTo | ( | EUnit | ToUnits | ) | const |
Convert this quantity to a different unit
Definition at line 251 of file UnitConversion.inl.
|
private |
Copy another unit into this one, taking account of its units, and applying necessary conversion
Definition at line 325 of file UnitConversion.inl.
|
staticprivate |
Given a string, skip past whitespace, then any numeric characters. Set End pointer to the end of the last numeric character.
Definition at line 356 of file UnitConversion.inl.
|
private |
Conversion to the numeric type disabled as coupled with implicit construction from NumericType can easily lead to loss of associated units.
FNumericUnit< NumericType > & FNumericUnit< NumericType >::operator= | ( | const FNumericUnit< NumericType > & | Other | ) |
Definition at line 229 of file UnitConversion.inl.
FNumericUnit & FNumericUnit< NumericType >::operator= | ( | const FNumericUnit< OtherType > & | Other | ) |
FNumericUnit< NumericType > & FNumericUnit< NumericType >::operator= | ( | const FNumericUnit< OtherType > & | Other | ) |
Definition at line 243 of file UnitConversion.inl.
FNumericUnit< NumericType > FNumericUnit< NumericType >::QuantizeUnitsToBestFit | ( | ) | const |
Quantizes this number to the most appropriate unit for user friendly presentation (e.g. 1000m returns 1km).
Definition at line 266 of file UnitConversion.inl.
|
static |
Try and parse an expression into a numeric unit
Definition at line 272 of file UnitConversion.inl.
|
static |
Parse a numeric unit from a string
Definition at line 285 of file UnitConversion.inl.
|
friend |
Definition at line 219 of file UnitConversion.h.
|
friend |
Global arithmetic operators for number types. Deals with conversion from related units correctly. Note must be inlined for hidden friend optimization to work
Definition at line 194 of file UnitConversion.h.
const EUnit FNumericUnit< NumericType >::Units |
The associated units for the value. Can never change once set to anything other than EUnit::Unspecified.
Definition at line 153 of file UnitConversion.h.
NumericType FNumericUnit< NumericType >::Value |
The numeric (scalar) value
Definition at line 151 of file UnitConversion.h.