#include <opennurbs_string_value.h>

Public Types

enum  StringFormat : unsigned char { StringFormat::ExactDecimal = 0, StringFormat::ExactFraction = 1, StringFormat::CleanDecimal = 2, StringFormat::CleanFraction = 3 }
 ON_AngleValue::StringFormat identifies the formatting to apply when creating a length value from a double. More...
 

Public Member Functions

 ON_AngleValue ()=default
 
 ON_AngleValue (const ON_AngleValue &)=default
 
 ~ON_AngleValue ()=default
 
double Angle (ON::AngleUnitSystem context_unit_system) const
 
const ON_wStringAngleAsString () const
 
const wchar_t * AngleAsStringPointer () const
 
const ON_ParseSettings AngleStringParseSettings () const
 
ON::AngleUnitSystem AngleUnitSystem () const
 
bool IsSet () const
 
bool IsUnset () const
 
ON_AngleValueoperator= (const ON_AngleValue &)=default
 
bool Read (class ON_BinaryArchive &archive)
 
bool Write (class ON_BinaryArchive &archive) const
 

Static Public Member Functions

static ON_AngleValue::StringFormat AngleStringFormatFromUnsigned (unsigned int string_format_as_unsigned)
 
static ON_AngleValue Create (double angle_value, ON::AngleUnitSystem angle_unit_system, unsigned int locale_id, ON_AngleValue::StringFormat string_format)
 
static ON_AngleValue Create (double angle_value, const class ON_AngleUnitName &angle_unit_system, ON_AngleValue::StringFormat string_format)
 
static ON_AngleValue CreateFromString (ON_ParseSettings parse_settings, const wchar_t *string)
 Create an ON_AngleValue by parsing a string. More...
 
static ON_AngleValue CreateFromSubString (ON_ParseSettings parse_settings, const wchar_t *string, int string_count, const wchar_t **string_end)
 Create an ON_AngleValue by parsing a string. More...
 

Static Public Attributes

static const ON_AngleValue Unset
 
static const ON_AngleValue Zero
 

Member Enumeration Documentation

◆ StringFormat

enum ON_AngleValue::StringFormat : unsigned char
strong

ON_AngleValue::StringFormat identifies the formatting to apply when creating a length value from a double.

Enumerator
ExactDecimal 

Use exact decimal string.

ExactFraction 

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).

CleanFraction 

The value may be adjusted slightly to improve clarity (1.124999... becomes 9/8).

Constructor & Destructor Documentation

◆ ON_AngleValue() [1/2]

ON_AngleValue::ON_AngleValue ( )
default

◆ ~ON_AngleValue()

ON_AngleValue::~ON_AngleValue ( )
default

◆ ON_AngleValue() [2/2]

ON_AngleValue::ON_AngleValue ( const ON_AngleValue )
default

Member Function Documentation

◆ Angle()

double ON_AngleValue::Angle ( ON::AngleUnitSystem  context_unit_system) const
Parameters
context_unit_system[in] angle unit system for the returned value. Pass ON::AngleUnitSystem::None to ignore the angle unit system and get the value save in this class.
Returns
Angle in the specified angle unit system

◆ AngleAsString()

const ON_wString& ON_AngleValue::AngleAsString ( ) const
Returns
The angle as a string.

If ON_AngleValue::CreateFromString() or ON_AngleValue::CreateFromSubString() were used to create this ON_AngleValue, a copy of that string is returned.

◆ AngleAsStringPointer()

const wchar_t* ON_AngleValue::AngleAsStringPointer ( ) const

◆ AngleStringFormatFromUnsigned()

static ON_AngleValue::StringFormat ON_AngleValue::AngleStringFormatFromUnsigned ( unsigned int  string_format_as_unsigned)
static

◆ AngleStringParseSettings()

const ON_ParseSettings ON_AngleValue::AngleStringParseSettings ( ) const

◆ AngleUnitSystem()

ON::AngleUnitSystem ON_AngleValue::AngleUnitSystem ( ) const
Returns
Angle unit system for this class.

◆ Create() [1/2]

static ON_AngleValue ON_AngleValue::Create ( double  angle_value,
ON::AngleUnitSystem  angle_unit_system,
unsigned int  locale_id,
ON_AngleValue::StringFormat  string_format 
)
static
Parameters
angle_value[in]
angle_unit_system[in]
bUseFractionsInString[in] If bUseFractions is true and angle_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 angle unit system bool
Returns
Angle in the specified angle unit system

If you don't like the automatically created string value, then format the string yourself and use ON_AngleValue::CreateFromString().

◆ Create() [2/2]

static ON_AngleValue ON_AngleValue::Create ( double  angle_value,
const class ON_AngleUnitName angle_unit_system,
ON_AngleValue::StringFormat  string_format 
)
static

◆ CreateFromString()

static ON_AngleValue ON_AngleValue::CreateFromString ( ON_ParseSettings  parse_settings,
const wchar_t *  string 
)
static

Create an ON_AngleValue 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.
Returns
If the string is valid, the exact angle value is returned. If the string is not valid or parsing ends before the string's null terminator, the ON_AngleValue::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_AngleValue ON_AngleValue::CreateFromSubString ( ON_ParseSettings  parse_settings,
const wchar_t *  string,
int  string_count,
const wchar_t **  string_end 
)
static

Create an ON_AngleValue 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 angle 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 angle value is returned. If the string is not valid or parsing ends before the string's null terminator, the ON_AngleValue::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_AngleValue::IsSet ( ) const

◆ IsUnset()

bool ON_AngleValue::IsUnset ( ) const

◆ operator=()

ON_AngleValue& ON_AngleValue::operator= ( const ON_AngleValue )
default

◆ Read()

bool ON_AngleValue::Read ( class ON_BinaryArchive archive)

◆ Write()

bool ON_AngleValue::Write ( class ON_BinaryArchive archive) const

Member Data Documentation

◆ Unset

const ON_AngleValue ON_AngleValue::Unset
static

◆ Zero

const ON_AngleValue ON_AngleValue::Zero
static