ON_ArithmeticCalculator Class Reference

#include <opennurbs_parse.h>

Public Types

enum  ERROR_CONDITION {
  no_error = 0, program_error = 1, invalid_expression_error = 2, divide_by_zero_error = 3,
  overflow_error = 4
}
 

Public Member Functions

 ON_ArithmeticCalculator ()
 
 ON_ArithmeticCalculator (const ON_ArithmeticCalculator &)
 
 ON_ArithmeticCalculator (ON_ArithmeticCalculator &&)
 
bool Add ()
 Enter an explicit addition operator whose operands are the previous value and the next value, where a value is a number, simple number, or parenthetic expression. More...
 
void ClearAll ()
 Clear all status, values and expressions. More...
 
bool Divide ()
 Enter an explicit division operator whose operands are the previous value and the next value, where a value is a number, simple number, or parenthetic expression. If the second value is zero, the calculator state is set to error. More...
 
ERROR_CONDITION ErrorCondition () const
 
bool Evaluate (double *value)
 Calculate the current value. More...
 
bool ImpliedMultiplication () const
 
bool LeftParenthesis ()
 Begin a parenthetic expression. More...
 
bool Multiply ()
 Enter an explicit multiplication operator whose operands are the previous value and the next value, where a value is a number, simple number, or parenthetic expression. More...
 
bool Number (double x)
 Enter a number that can be used as an implied multiplication operand when implied multiplication is enabled and appropriate. More...
 
ON_ArithmeticCalculatoroperator= (const ON_ArithmeticCalculator &)
 
ON_ArithmeticCalculatoroperator= (ON_ArithmeticCalculator &&)
 
unsigned int ParenthesesDepth () const
 
bool PendingImpliedMultiplication () const
 
bool PendingUnaryMinus () const
 
bool PendingUnaryOperation () const
 
bool PendingUnaryPlus () const
 
bool RightParenthesis ()
 End a parenthetic expression. More...
 
void SetImpliedMultiplication (bool bEnable)
 
bool SimpleNumber (double x)
 Enter a number that will never use implied multiplication. More...
 
bool Subtract ()
 Enter an explicit subtraction operator whose operands are the previous value and the next value, where a value is a number, simple number, or parenthetic expression. More...
 
bool UnaryMinus ()
 Enter an unary minus operator whose operand is the next number, simple number, or parenthetic expression. More...
 
bool UnaryPlus ()
 Enter an unary plus operator whose operand is the next number, simple number, or parenthetic expression. More...
 

Member Enumeration Documentation

◆ ERROR_CONDITION

Enumerator
no_error 
program_error 
invalid_expression_error 
divide_by_zero_error 

The input expression does not make sense.

overflow_error 

A calculation requested division by zero.

Constructor & Destructor Documentation

◆ ON_ArithmeticCalculator() [1/3]

ON_ArithmeticCalculator::ON_ArithmeticCalculator ( )

◆ ON_ArithmeticCalculator() [2/3]

ON_ArithmeticCalculator::ON_ArithmeticCalculator ( const ON_ArithmeticCalculator )

◆ ON_ArithmeticCalculator() [3/3]

ON_ArithmeticCalculator::ON_ArithmeticCalculator ( ON_ArithmeticCalculator &&  )

Member Function Documentation

◆ Add()

bool ON_ArithmeticCalculator::Add ( )

Enter an explicit addition operator whose operands are the previous value and the next value, where a value is a number, simple number, or parenthetic expression.

◆ ClearAll()

void ON_ArithmeticCalculator::ClearAll ( )

Clear all status, values and expressions.

◆ Divide()

bool ON_ArithmeticCalculator::Divide ( )

Enter an explicit division operator whose operands are the previous value and the next value, where a value is a number, simple number, or parenthetic expression. If the second value is zero, the calculator state is set to error.

◆ ErrorCondition()

ERROR_CONDITION ON_ArithmeticCalculator::ErrorCondition ( ) const

◆ Evaluate()

bool ON_ArithmeticCalculator::Evaluate ( double *  value)

Calculate the current value.

◆ ImpliedMultiplication()

bool ON_ArithmeticCalculator::ImpliedMultiplication ( ) const

◆ LeftParenthesis()

bool ON_ArithmeticCalculator::LeftParenthesis ( )

Begin a parenthetic expression.

◆ Multiply()

bool ON_ArithmeticCalculator::Multiply ( )

Enter an explicit multiplication operator whose operands are the previous value and the next value, where a value is a number, simple number, or parenthetic expression.

◆ Number()

bool ON_ArithmeticCalculator::Number ( double  x)

Enter a number that can be used as an implied multiplication operand when implied multiplication is enabled and appropriate.

◆ operator=() [1/2]

ON_ArithmeticCalculator& ON_ArithmeticCalculator::operator= ( const ON_ArithmeticCalculator )

◆ operator=() [2/2]

ON_ArithmeticCalculator& ON_ArithmeticCalculator::operator= ( ON_ArithmeticCalculator &&  )

◆ ParenthesesDepth()

unsigned int ON_ArithmeticCalculator::ParenthesesDepth ( ) const
Returns
The current number of parenthetic expressions that are not completed.

◆ PendingImpliedMultiplication()

bool ON_ArithmeticCalculator::PendingImpliedMultiplication ( ) const
Returns
True if an implied multiplication will be applied to the next number or parenthetical expression.

◆ PendingUnaryMinus()

bool ON_ArithmeticCalculator::PendingUnaryMinus ( ) const
Returns
True if a unary minus is pending and will be applied to the next number or parenthetical expression.

◆ PendingUnaryOperation()

bool ON_ArithmeticCalculator::PendingUnaryOperation ( ) const
Returns
True if a unary plus or unary minus is pending

◆ PendingUnaryPlus()

bool ON_ArithmeticCalculator::PendingUnaryPlus ( ) const
Returns
True if a unary plus is pending and will be applied to the next number or parenthetical expression.

◆ RightParenthesis()

bool ON_ArithmeticCalculator::RightParenthesis ( )

End a parenthetic expression.

◆ SetImpliedMultiplication()

void ON_ArithmeticCalculator::SetImpliedMultiplication ( bool  bEnable)

◆ SimpleNumber()

bool ON_ArithmeticCalculator::SimpleNumber ( double  x)

Enter a number that will never use implied multiplication.

◆ Subtract()

bool ON_ArithmeticCalculator::Subtract ( )

Enter an explicit subtraction operator whose operands are the previous value and the next value, where a value is a number, simple number, or parenthetic expression.

◆ UnaryMinus()

bool ON_ArithmeticCalculator::UnaryMinus ( )

Enter an unary minus operator whose operand is the next number, simple number, or parenthetic expression.

◆ UnaryPlus()

bool ON_ArithmeticCalculator::UnaryPlus ( )

Enter an unary plus operator whose operand is the next number, simple number, or parenthetic expression.