#include <opennurbs_string_value.h>
|
static int | Compare (const ON_LengthValue &lhs, const ON_LengthValue &rhs) |
|
static ON_LengthValue | Create (double length_value, const class ON_UnitSystem &length_unit_system, unsigned int locale_id, ON_LengthValue::StringFormat string_format) |
|
static ON_LengthValue | Create (double length_value, const ON::LengthUnitSystem length_unit_system, unsigned int locale_id, ON_LengthValue::StringFormat string_format) |
|
static ON_LengthValue | Create (double length_value, const class ON_LengthUnitName &length_unit_system, ON_LengthValue::StringFormat string_format) |
|
static ON_LengthValue | CreateFromString (ON_ParseSettings parse_settings, const wchar_t *string) |
| Create an ON_LengthValue by parsing a string. More...
|
|
static ON_LengthValue | CreateFromSubString (ON_ParseSettings parse_settings, const wchar_t *string, int string_count, const wchar_t **string_end) |
| Create an ON_LengthValue by parsing a string. More...
|
|
static ON_LengthValue::StringFormat | LengthStringFormatFromUnsigned (unsigned int string_format_as_unsigned) |
|
◆ StringFormat
Formatting to apply when creating a length value from a double.
Enumerator |
---|
ExactDecimal | Use exact decimal string.
|
ExactProperFraction | If possible, use exact integer-fraction format (1.125 becomes 1-1/8).
|
ExactImproperFraction | If possible, use exact fraction format (1.125 becomes 9/8).
|
CleanDecimal | The value may be adjusted slightly to improve clarity (1.124999... becomes 1.125).
|
CleanProperFraction | The value may be adjusted slightly to improve clarity (1.124999... becomes 1-1/8).
|
CleanImproperFraction | The value may be adjusted slightly to improve clarity (1.124999... becomes 9/8).
|
◆ ON_LengthValue() [1/2]
ON_LengthValue::ON_LengthValue |
( |
| ) |
|
|
default |
◆ ~ON_LengthValue()
ON_LengthValue::~ON_LengthValue |
( |
| ) |
|
|
default |
◆ ON_LengthValue() [2/2]
◆ ChangeLength()
const ON_LengthValue ON_LengthValue::ChangeLength |
( |
double |
length_value | ) |
const |
- Parameters
-
length_value | [in] New length. |
- Returns
- A ON_LengthValue with the new length and other settings copied from this.
◆ Compare()
◆ ContentHash()
◆ ContextAngleUnitSystem()
ON::AngleUnitSystem ON_LengthValue::ContextAngleUnitSystem |
( |
| ) |
const |
- Returns
- Angle unit system used to parse input strings.
◆ ContextLocaleId()
unsigned int ON_LengthValue::ContextLocaleId |
( |
| ) |
const |
- Returns
- Locale used to parse input strings and create unit names.
◆ Create() [1/3]
- Parameters
-
length_value | [in] |
length_unit_system | [in] |
bUseFractionsInString | [in] If bUseFractions is true and length_value can be represented as a common fraction, then the string form will contain a fraction rather than a decimal. |
locale_id | [in] locale id for the string length unit system 0 will select ON_Locale::CurrentCulture. |
string_format | [in] Determines the format of the string representation |
- Returns
- Length in the specified length unit system
If you don't like the automatically created string value, then format the string yourself and use ON_LengthValue::CreateFromString().
◆ Create() [2/3]
- Parameters
-
length_value | [in] |
length_unit_system | [in] |
bUseFractionsInString | [in] If bUseFractions is true and length_value can be represented as a common fraction, then the string form will contain a fraction rather than a decimal. |
locale_id | [in] locale id for the string length unit system bool |
- Returns
- Length in the specified length unit system
If you don't like the automatically created string value, then format the string yourself and use ON_LengthValue::CreateFromString().
◆ Create() [3/3]
◆ CreateFromString()
Create an ON_LengthValue by parsing a string.
- Parameters
-
- Returns
- If the string is valid, the exact length value is returned. If the string is not valid or parsing ends before the string's null terminator, the ON_LengthValue::Unset is returned.
If the entire string is not parsed, that is an error condition. Use CreateFromSubString() to permit parsing a portion of the string.
◆ CreateFromSubString()
static ON_LengthValue ON_LengthValue::CreateFromSubString |
( |
ON_ParseSettings |
parse_settings, |
|
|
const wchar_t * |
string, |
|
|
int |
string_count, |
|
|
const wchar_t ** |
string_end |
|
) |
| |
|
static |
Create an ON_LengthValue by parsing a string.
- Parameters
-
parse_settings | [in] Pass ON_ParseSettings(context_length_unit_system,context_angle_unit_system,context_locale_id) |
string | [in] null terminated string to parse. |
string_count | [in] string[] and string_count specify the string to parse. If string_count >= 0, it specifies the maximum number of elements in string[] that may be parsed. If string_count = -1, then the string must contain a character that terminates length parsing. |
string_end | [out] If string_end is not nullptr, then *string_end points to the first element in the string that was not parsed. |
- Returns
- If the string is valid, the exact length value is returned. If the string is not valid or parsing ends before the string's null terminator, the ON_LengthValue::Unset is returned.
If the entire string is not parsed, that is an error condition. Use CreateFromSubString() to permit parsing a portion of the string.
◆ IsSet()
bool ON_LengthValue::IsSet |
( |
| ) |
const |
◆ IsUnset()
bool ON_LengthValue::IsUnset |
( |
| ) |
const |
◆ Length() [1/2]
double ON_LengthValue::Length |
( |
const class ON_UnitSystem & |
context_unit_system | ) |
const |
- Parameters
-
context_unit_system | [in] length unit system for the returned value. Pass ON_UnitSystem::None to ignore the length unit system and get the value save in this class. |
- Returns
- Length in the specified length unit system
◆ Length() [2/2]
double ON_LengthValue::Length |
( |
ON::LengthUnitSystem |
context_unit_system | ) |
const |
- Parameters
-
context_unit_system | [in] length unit system for the returned value. Pass ON::LengthUnitSystem::None to ignore the length unit system and get the value save in this class. |
- Returns
- Length in the specified length unit system
◆ LengthAsString()
const ON_wString& ON_LengthValue::LengthAsString |
( |
| ) |
const |
◆ LengthAsStringPointer()
const wchar_t* ON_LengthValue::LengthAsStringPointer |
( |
| ) |
const |
◆ LengthStringFormat()
- Returns
- Format processing applied to input values.
◆ LengthStringFormatFromUnsigned()
◆ LengthStringParseSettings()
◆ LengthUnitSystem()
const class ON_UnitSystem& ON_LengthValue::LengthUnitSystem |
( |
| ) |
const |
- Returns
- Length unit system for this class.
◆ operator=()
◆ Read()
◆ RemoveUnitSystem()
- Returns
- A ON_LengthValue with the same length value and unit system = None.
◆ Write()
◆ Unset
◆ Zero