3#include <NDEVR/TranslatedString.h>
4#include <NDEVR/StringStream.h>
5#include <NDEVR/Angle.h>
8 class TranslatedString;
43 template<
class t_angle_type>
46 return convertToString(program_space.template internal<false>(), add_comma, min_decimals, max_decimals, min_digits, include_abv, direction);
48 template<
class t_angle_type>
51 return convertToUnit(program_space.template internal<false>(), direction);
53 template<
class t_angle_type>
60 return toString(convertToUnit(program_space, direction), add_comma, min_decimals, max_decimals, min_digits, include_abv, direction);
65 toString(s, unit_space, add_comma, min_decimals, max_decimals, min_digits, include_abv, direction);
72 if (add_comma || min_decimals > 0 || max_decimals <=
string.size() || min_digits > 0)
73 string =
string.formatNumberString(add_comma, min_decimals, max_decimals, min_digits);
75 string += abbreviation(direction).translation();
80 return convertFromUnit(fromString(unit_string, direction), direction);
90 [[nodiscard]]
virtual String getNextPreferredSeparator(
const String& current_string,
uint01 direction = X)
const;
92 [[nodiscard]]
virtual String toFormula(
const String& unit_string,
uint01 direction = X)
const;
100 return other.
matrix() == matrix() && other.
name == name;
102 [[nodiscard]]
virtual Unit* clone()
const;
#define UNUSED(expr)
Definition BaseValues.hpp:433
Stores an angle in an optimized format.
Definition StringStream.h:352
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition Matrix.hpp:173
Definition Vertex.hpp:341
t_type getAs() const
Definition String.h:334
Definition StringStream.h:62
Definition TranslatedString.h:9
A vertex.
Definition Vertex.hpp:54
UnitType
Definition Unit.h:10
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
@ INTERNAL_ANGLE
Definition Angle.h:67
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181
virtual const Unit * subUnit(uint01 direction) const =0
virtual Vertex< 3, fltp08 > convertFromUnit(const Vertex< 3, fltp08 > &unit_space) const =0
virtual fltp08 convertFromUnit(const fltp08 &unit_space, const uint01 direction=X) const =0
virtual Matrix< fltp08 > matrix() const =0
const TranslatedString translated_id
Definition Unit.h:30
String toString(const fltp08 &unit_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const
Definition Unit.h:62
virtual const TranslatedString & abbreviation(uint01 direction=X) const =0
virtual Unit * clone(const String &new_name, const TranslatedString &new_display_name) const =0
fltp08 convertToUnit(const Angle< t_angle_type > &program_space, uint01 direction=X) const
Definition Unit.h:49
virtual Ray< 3, fltp08 > convertToUnit(const Ray< 3, fltp08 > &program_space) const =0
virtual void toString(String &string, const fltp08 &unit_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const
Definition Unit.h:69
virtual fltp08 convertToUnit(const fltp08 &program_space, const uint01 direction=X) const =0
bool operator==(const Unit &other) const
Definition Unit.h:98
virtual String convertToString(const fltp08 &program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const
Definition Unit.h:58
virtual fltp08 convertFromString(const String &unit_string, uint01 direction=X) const
Definition Unit.h:78
String convertToString(const Angle< t_angle_type > &program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const
Definition Unit.h:44
virtual Vertex< 3, fltp08 > convertToUnit(const Vertex< 3, fltp08 > &program_space) const =0
virtual fltp08 fromString(const String &unit_string, uint01 direction=X) const
Definition Unit.h:82
const String name
Definition Unit.h:29
virtual Ray< 3, fltp08 > convertFromUnit(const Ray< 3, fltp08 > &unit_space) const =0
Angle< t_angle_type > convertAngleFromUnit(const fltp08 &unit_space, uint01 direction=X) const
Definition Unit.h:54