libqalculate-5.10.0

Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Calculator Class Reference

The almighty calculator class. More...

`#include <Calculator.h>`

## Public Member Functions
Constructor
| Calculator (bool ignore_locale)
Functions for calculating expressions.
bool | calculate (MathStructure *mstruct, std::string str, int msecs, const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL, MathStructure *to_struct=NULL, bool make_to_division=true)
MathStructure | calculate (std::string str, const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL, MathStructure *to_struct=NULL, bool make_to_division=true)
bool | calculate (MathStructure *mstruct, int msecs, const EvaluationOptions &eo=default_user_evaluation_options, std::string to_str="")
MathStructure | calculate (const MathStructure &mstruct, const EvaluationOptions &eo=default_user_evaluation_options, std::string to_str="")
std::string | calculateAndPrint (std::string str, int msecs=10000, const EvaluationOptions &eo=default_user_evaluation_options, const PrintOptions &po=default_print_options, std::string *parsed_expression=NULL)
std::string | calculateAndPrint (std::string str, int msecs, const EvaluationOptions &eo, const PrintOptions &po, AutomaticFractionFormat auto_fraction, AutomaticApproximation auto_approx=AUTOMATIC_APPROXIMATION_OFF, std::string *parsed_expression=NULL, int max_length=-1, bool *result_is_comparison=NULL, bool format=false, int colorize=0, int tagtype=TAG_TYPE_HTML)
int | testCondition (std::string expression)
Functions for printing expressions with the option to set maximum time or abort.
std::string | print (const MathStructure &mstruct, int milliseconds=100000, const PrintOptions &po=default_print_options)
std::string | print (const MathStructure &mstruct, int milliseconds, const PrintOptions &po, bool format, int colorize=0, int tagtype=TAG_TYPE_HTML)
std::string | printMathStructureTimeOut (const MathStructure &mstruct, int milliseconds=100000, const PrintOptions &op=default_print_options)
| Deprecated: use print() instead.
void | startControl (int milliseconds=0)
void | stopControl (void)
bool | abort ()
bool | aborted (void)
bool | isControlled (void) const
std::string | abortedMessage (void) const
std::string | timedOutString (void) const
std::string | logicalORString (void) const
std::string | logicalANDString (void) const
void | startPrintControl (int milliseconds=0)
| Deprecated: use startControl().
void | abortPrint (void)
| Deprecated: use abort().
void | stopPrintControl (void)
| Deprecated: use stopControl().
bool | printingAborted (void)
| Deprecated: use aborted().
bool | printingControlled (void) const
| Deprecated: use isControlled().
std::string | printingAbortedMessage (void) const
| Deprecated: use abortedMessage().
Functions for handling of threaded calculations
bool | busy ()
void | saveState ()
| Deprecated: does nothing.
void | restoreState ()
| Deprecated: does nothing.
void | clearBuffers ()
void | terminateThreads ()
Functions for manipulation of the RPN stack.
bool | calculateRPNRegister (size_t index, int msecs, const EvaluationOptions &eo=default_user_evaluation_options)
bool | calculateRPN (MathOperation op, int msecs, const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL)
bool | calculateRPN (MathFunction *f, int msecs, const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL)
bool | calculateRPNBitwiseNot (int msecs, const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL)
bool | calculateRPNLogicalNot (int msecs, const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL)
MathStructure * | calculateRPN (MathOperation op, const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL)
MathStructure * | calculateRPN (MathFunction *f, const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL)
MathStructure * | calculateRPNBitwiseNot (const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL)
MathStructure * | calculateRPNLogicalNot (const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL)
bool | RPNStackEnter (MathStructure *mstruct, int msecs, const EvaluationOptions &eo=default_user_evaluation_options)
bool | RPNStackEnter (std::string str, int msecs, const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL, MathStructure *to_struct=NULL, bool make_to_division=true)
void | RPNStackEnter (MathStructure *mstruct, bool eval=false, const EvaluationOptions &eo=default_user_evaluation_options)
void | RPNStackEnter (std::string str, const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL, MathStructure *to_struct=NULL, bool make_to_division=true)
bool | setRPNRegister (size_t index, MathStructure *mstruct, int msecs, const EvaluationOptions &eo=default_user_evaluation_options)
bool | setRPNRegister (size_t index, std::string str, int msecs, const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL, MathStructure *to_struct=NULL, bool make_to_division=true)
void | setRPNRegister (size_t index, MathStructure *mstruct, bool eval=false, const EvaluationOptions &eo=default_user_evaluation_options)
void | setRPNRegister (size_t index, std::string str, const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *parsed_struct=NULL, MathStructure *to_struct=NULL, bool make_to_division=true)
void | deleteRPNRegister (size_t index)
MathStructure * | getRPNRegister (size_t index=1) const
size_t | RPNStackSize () const
void | clearRPNStack ()
void | moveRPNRegister (size_t old_index, size_t new_index)
void | moveRPNRegisterUp (size_t index)
void | moveRPNRegisterDown (size_t index)
Functions for expression parsing.
std::string | localizeExpression (std::string str, const ParseOptions &po=default_parse_options) const
std::string | unlocalizeExpression (std::string str, const ParseOptions &po=default_parse_options) const
bool | separateToExpression (std::string &str, std::string &to_str, const EvaluationOptions &eo, bool keep_modifiers=false, bool allow_empty_from=false) const
bool | hasToExpression (const std::string &str, bool allow_empty_from=false) const
bool | hasToExpression (const std::string &str, bool allow_empty_from, const EvaluationOptions &eo) const
std::string | parseToExpression (std::string to_str, EvaluationOptions &evalops, PrintOptions &printops, Number *custom_base=NULL, int *binary_prefixes=NULL, bool *complex_angle_form=NULL, bool *do_factors=NULL, bool *do_pfe=NULL, bool *do_calendars=NULL, bool *do_bases=NULL) const
bool | separateWhereExpression (std::string &str, std::string &where_str, const EvaluationOptions &eo) const
| Split an expression string after and before " where ".
bool | hasWhereExpression (const std::string &str, const EvaluationOptions &eo) const
std::string | parseComments (std::string &str, const ParseOptions &po=default_parse_options, bool *double_tag=NULL)
void | parseSigns (std::string &str, bool convert_to_internal_representation=false) const
MathStructure | parse (std::string str, const ParseOptions &po=default_parse_options)
void | parse (MathStructure *mstruct, std::string str, const ParseOptions &po=default_parse_options)
bool | parseNumber (MathStructure *mstruct, std::string str, const ParseOptions &po=default_parse_options)
bool | parseOperators (MathStructure *mstruct, std::string str, const ParseOptions &po=default_parse_options)
bool | parseAdd (std::string &str, MathStructure *mstruct, const ParseOptions &po, MathOperation s, bool append=true)
bool | parseAdd (std::string &str, MathStructure *mstruct, const ParseOptions &po)
void | parseExpressionAndWhere (MathStructure *mstruct, MathStructure *mwhere, std::string str, std::string str_where, const ParseOptions &po)
Functions converting expressions between units.
MathStructure | convert (const MathStructure &mstruct, std::string composite_, const EvaluationOptions &eo, MathStructure *units, bool transform_orig, MathStructure *parsed_struct=NULL)
MathStructure | convert (const MathStructure &mstruct, std::string composite_, const EvaluationOptions &eo=default_user_evaluation_options, MathStructure *units=NULL)
MathStructure | convert (const MathStructure &mstruct, Unit *to_unit, const EvaluationOptions &eo=default_user_evaluation_options, bool always_convert=true, bool convert_to_mixed_units=true, bool transform_orig=false, MathStructure *parsed_struct=NULL)
MathStructure | convert (const MathStructure &mstruct, KnownVariable *to_var, const EvaluationOptions &eo=default_user_evaluation_options)
MathStructure | convert (double value, Unit *from_unit, Unit *to_unit, const EvaluationOptions &eo=default_user_evaluation_options)
MathStructure | convert (std::string str, Unit *from_unit, Unit *to_unit, int milliseconds, const EvaluationOptions &eo=default_user_evaluation_options)
MathStructure | convertTimeOut (std::string str, Unit *from_unit, Unit *to_unit, int milliseconds, const EvaluationOptions &eo=default_user_evaluation_options)
MathStructure | convert (std::string str, Unit *from_unit, Unit *to_unit, const EvaluationOptions &eo=default_user_evaluation_options)
MathStructure | convertToBaseUnits (const MathStructure &mstruct, const EvaluationOptions &eo=default_user_evaluation_options)
Unit * | getBestUnit (Unit *u, bool allow_only_div=false, bool convert_to_local_currency=true)
Unit * | getOptimalUnit (Unit *u, bool allow_only_div=false, bool convert_to_local_currency=true)
MathStructure | convertToBestUnit (const MathStructure &mstruct, const EvaluationOptions &eo=default_user_evaluation_options, bool convert_to_si_units=true)
MathStructure | convertToOptimalUnit (const MathStructure &mstruct, const EvaluationOptions &eo=default_user_evaluation_options, bool convert_to_si_units=true)
MathStructure | convertToCompositeUnit (const MathStructure &mstruct, CompositeUnit *cu, const EvaluationOptions &eo=default_user_evaluation_options, bool always_convert=true)
MathStructure | convertToMixedUnits (const MathStructure &mstruct, const EvaluationOptions &eo=default_user_evaluation_options)
void | setTemperatureCalculationMode (TemperatureCalculationMode temperature_calculation_mode)
TemperatureCalculationMode | getTemperatureCalculationMode () const
Unit * | findMatchingUnit (const MathStructure &mstruct)
Functions for default assumptions for unknown variables and symbols
void | setDefaultAssumptions (Assumptions *ass)
Assumptions * | defaultAssumptions ()
Functions for retrieval of angle units
Unit * | getGraUnit ()
Unit * | getRadUnit ()
Unit * | getDegUnit ()
Functions for finding a suitable prefix.
DecimalPrefix * | getExactDecimalPrefix (int exp10, int exp=1) const
BinaryPrefix * | getExactBinaryPrefix (int exp2, int exp=1) const
Prefix * | getExactPrefix (const Number &o, int exp=1) const
DecimalPrefix * | getNearestDecimalPrefix (int exp10, int exp=1) const
DecimalPrefix * | getOptimalDecimalPrefix (int exp10, int exp=1, bool all_prefixes=true) const
DecimalPrefix * | getOptimalDecimalPrefix (const Number &exp10, const Number &exp, bool all_prefixes=true) const
BinaryPrefix * | getNearestBinaryPrefix (int exp2, int exp=1) const
BinaryPrefix * | getOptimalBinaryPrefix (int exp2, int exp=1) const
BinaryPrefix * | getOptimalBinaryPrefix (const Number &exp2, const Number &exp) const
int | usesBinaryPrefixes () const
void | useBinaryPrefixes (int use_binary_prefixes)
Prefix * | addPrefix (Prefix *p)
void | prefixNameChanged (Prefix *p, bool new_item=false)
Functions for managing functions, variables, units, prefixes and data sets.
void | expressionItemActivated (ExpressionItem *item)
void | expressionItemDeactivated (ExpressionItem *item)
void | expressionItemDeleted (ExpressionItem *item)
void | nameChanged (ExpressionItem *item, bool new_item=false)
void | deleteName (std::string name_, ExpressionItem *object=NULL)
void | deleteUnitName (std::string name_, Unit *object=NULL)
Unit * | addUnit (Unit *u, bool force=true, bool check_names=true)
void | delPrefixUFV (Prefix *object)
void | delUFV (ExpressionItem *object)
bool | hasVariable (Variable *v)
bool | hasUnit (Unit *u)
bool | hasFunction (MathFunction *f)
bool | stillHasVariable (Variable *v)
bool | stillHasUnit (Unit *u)
bool | stillHasFunction (MathFunction *f)
void | saveFunctionCalled ()
bool | checkSaveFunctionCalled ()
ExpressionItem * | getActiveExpressionItem (std::string name, ExpressionItem *item=NULL)
ExpressionItem * | getActiveExpressionItem (std::string name, ExpressionItem *item, bool ignore_us)
ExpressionItem * | getInactiveExpressionItem (std::string name, ExpressionItem *item=NULL)
ExpressionItem * | getActiveExpressionItem (ExpressionItem *item)
ExpressionItem * | getExpressionItem (std::string name, ExpressionItem *item=NULL)
Unit * | getUnit (std::string name_)
Unit * | getUnitById (int id) const
Unit * | getActiveUnit (std::string name_)
Unit * | getActiveUnit (std::string name_, bool ignore_us)
Unit * | getCompositeUnit (std::string internal_name_)
Unit * | getLocalCurrency ()
void | setLocalCurrency (Unit *u)
Prefix * | getPrefix (size_t index) const
Prefix * | getPrefix (std::string name_) const
Prefix * | getDecimalNullPrefix () const
Prefix * | getBinaryNullPrefix () const
Variable * | addVariable (Variable *v, bool force=true, bool check_names=true)
void | variableNameChanged (Variable *v, bool new_item=false)
void | functionNameChanged (MathFunction *f, bool new_item=false)
void | unitNameChanged (Unit *u, bool new_item=false)
Variable * | getVariable (std::string name_)
Variable * | getVariableById (int id) const
Variable * | getActiveVariable (std::string name_)
Variable * | getActiveVariable (std::string name_, bool ignore_us)
ExpressionItem * | addExpressionItem (ExpressionItem *item, bool force=true)
MathFunction * | addFunction (MathFunction *f, bool force=true, bool check_names=true)
DataSet * | addDataSet (DataSet *dc, bool force=true, bool check_names=true)
DataSet * | getDataSet (size_t index)
DataSet * | getDataSet (std::string name)
MathFunction * | getFunction (std::string name_)
MathFunction * | getFunctionById (int id) const
MathFunction * | getActiveFunction (std::string name_)
MathFunction * | getActiveFunction (std::string name_, bool ignore_us)
Variable * | getVariable (size_t index) const
Unit * | getUnit (size_t index) const
MathFunction * | getFunction (size_t index) const
bool | unitIsUsedByOtherUnits (const Unit *u) const
Functions for handling of builtin expression items
void | resetVariables ()
void | resetFunctions ()
void | resetUnits ()
void | reset ()
void | addBuiltinVariables ()
void | addBuiltinFunctions ()
void | addBuiltinUnits ()
void | setVariableUnitsEnabled (bool enable_variable_units=true)
bool | variableUnitsEnabled () const
Functions for testing validity of functions, variable and unit names.
bool | variableNameIsValid (const std::string &name_) const
bool | variableNameIsValid (const char *name_) const
bool | variableNameIsValid (const char *name_, int version_numbers[3], bool is_user_defs)
bool | variableNameIsValid (const std::string &name_, int version_numbers[3], bool is_user_defs)
std::string | convertToValidVariableName (std::string name_) const
bool | functionNameIsValid (const std::string &name_) const
bool | functionNameIsValid (const char *name_) const
bool | functionNameIsValid (const char *name_, int version_numbers[3], bool is_user_defs)
bool | functionNameIsValid (const std::string &name_, int version_numbers[3], bool is_user_defs)
std::string | convertToValidFunctionName (std::string name_) const
bool | unitNameIsValid (const std::string &name_) const
bool | unitNameIsValid (const char *name_) const
bool | unitNameIsValid (const char *name_, int version_numbers[3], bool is_user_defs)
bool | unitNameIsValid (const std::string &name_, int version_numbers[3], bool is_user_defs)
bool | utf8_pos_is_valid_in_name (char *pos) const
std::string | convertToValidUnitName (std::string name_) const
bool | nameTaken (std::string name, ExpressionItem *object=NULL)
bool | variableNameTaken (std::string name, Variable *object=NULL)
bool | unitNameTaken (std::string name, Unit *object=NULL)
bool | functionNameTaken (std::string name, MathFunction *object=NULL)
std::string | getName (std::string name="", ExpressionItem *object=NULL, bool force=false, bool always_append=false)
Functions for message handling.
void | error (bool critical, int message_category, const char *TEMPLATE,...)
void | error (bool critical, const char *TEMPLATE,...)
void | message (MessageType mtype, int message_category, const char *TEMPLATE,...)
void | message (MessageType mtype, const char *TEMPLATE,...)
void | message (MessageType mtype, int message_category, const char *TEMPLATE, va_list ap)
CalculatorMessage * | message ()
CalculatorMessage * | nextMessage ()
void | clearMessages ()
bool | showArgumentErrors () const
void | beginTemporaryStopMessages ()
int | endTemporaryStopMessages (int *message_count=NULL, int *warning_count=NULL, int release_messages_if_no_equal_or_greater_than_message_type=-1)
void | endTemporaryStopMessages (bool release_messages, std::vector< CalculatorMessage > *blocked_messages=NULL)
void | addMessages (std::vector< CalculatorMessage > *message_vector)
const PrintOptions & | messagePrintOptions () const
void | setMessagePrintOptions (const PrintOptions &po)
void | cleanMessages (const MathStructure &mstruct, size_t first_message=1)
Functions for loading and saving definitions (variables, functions, units, etc.).
bool | loadGlobalDefinitions ()
bool | loadGlobalDefinitions (std::string filename)
bool | loadGlobalPrefixes ()
bool | loadGlobalCurrencies ()
bool | loadGlobalUnits ()
bool | loadGlobalVariables ()
bool | loadGlobalFunctions ()
bool | loadGlobalDataSets ()
bool | loadLocalDefinitions ()
int | loadDefinitions (const char *file_name, bool is_user_defs=true, bool check_duplicates_of_global=false)
bool | saveDefinitions ()
int | saveDataObjects ()
int | savePrefixes (const char *file_name, bool save_global=false)
std::string | temporaryCategory (void) const
int | saveVariables (const char *file_name, bool save_global=false)
int | saveUnits (const char *file_name, bool save_global=false)
int | saveFunctions (const char *file_name, bool save_global=false)
int | saveDataSets (const char *file_name, bool save_global=false)
std::string | saveTemporaryDefinitions ()
void | saveVariables (void *xmldoc, bool save_global=false, bool save_only_temp=false)
void | saveUnits (void *xmldoc, bool save_global=false, bool save_only_temp=false)
void | saveFunctions (void *xmldoc, bool save_global=false, bool save_only_temp=false)
std::vector< std::string > | getDefinitionsLocales () const
Functions for CSV file import/export.
bool | importCSV (MathStructure &mstruct, const char *file_name, int first_row=1, std::string delimiter=",", std::vector< std::string > *headers=NULL)
bool | importCSV (const char *file_name, int first_row=1, bool headers=true, std::string delimiter=",", bool to_matrix=false, std::string name="", std::string title="", std::string category="")
bool | exportCSV (const MathStructure &mstruct, const char *file_name, std::string delimiter=",")
Functions for exchange rates.
bool | canFetch ()
bool | hasGVFS ()
| Deprecated: gvfs is not needed anymore.
bool | hasGnomeVFS ()
| Deprecated: gvfs is not needed anymore.
bool | loadExchangeRates ()
std::string | getExchangeRatesFileName (int index=1)
std::string | getExchangeRatesUrl (int index=1)
time_t | getExchangeRatesTime (int index=-1)
bool | fetchExchangeRates (int seconds, std::string wget_args)
| Deprecated: wget arguments are not used.
bool | fetchExchangeRates (int seconds=15, int n=-1)
bool | checkExchangeRatesDate (unsigned int n_days=7, bool force_check=false, bool send_warning=false, int n=-1)
void | setExchangeRatesWarningEnabled (bool enable)
| Enable or disable old exchange rates warning (initial state is true).
bool | exchangeRatesWarningEnabled () const
int | exchangeRatesUsed () const
| Check if exchange rates has been used since resetExchangeRatesUsed() was last called.
void | resetExchangeRatesUsed ()
void | setExchangeRatesUsed (int index)
| For internal use, called by currency units.
Functions for plotting
bool | canPlot ()
MathStructure | expressionToPlotVector (std::string expression, const MathStructure &min, const MathStructure &max, int steps, bool separate_complex_part, MathStructure *x_vector=NULL, std::string x_var="\\x", const ParseOptions &po=default_parse_options, int msecs=5000)
MathStructure | expressionToPlotVector (std::string expression, const MathStructure &min, const MathStructure &max, int steps, MathStructure *x_vector=NULL, std::string x_var="\\x", const ParseOptions &po=default_parse_options, int msecs=5000)
MathStructure | expressionToPlotVector (std::string expression, float min, float max, int steps, MathStructure *x_vector=NULL, std::string x_var="\\x", const ParseOptions &po=default_parse_options, int msecs=5000)
MathStructure | expressionToPlotVector (std::string expression, const MathStructure &min, const MathStructure &max, const MathStructure &step, bool separate_complex_part, MathStructure *x_vector=NULL, std::string x_var="\\x", const ParseOptions &po=default_parse_options, int msecs=5000)
MathStructure | expressionToPlotVector (std::string expression, const MathStructure &min, const MathStructure &max, const MathStructure &step, MathStructure *x_vector=NULL, std::string x_var="\\x", const ParseOptions &po=default_parse_options, int msecs=5000)
MathStructure | expressionToPlotVector (std::string expression, float min, float max, float step, MathStructure *x_vector=NULL, std::string x_var="\\x", const ParseOptions &po=default_parse_options, int msecs=5000)
MathStructure | expressionToPlotVector (std::string expression, const MathStructure &x_vector, std::string x_var="\\x", const ParseOptions &po=default_parse_options, int msecs=5000)
bool | plotVectors (PlotParameters *param, const std::vector< MathStructure > &y_vectors, const std::vector< MathStructure > &x_vectors, std::vector< PlotDataParameters * > &pdps, bool persistent=false, int msecs=5000)
void | forcePersistentPlot (bool persistent=true)
bool | invokeGnuplot (std::string commands, std::string commandline_extra="", bool persistent=false)
bool | closeGnuplot ()
bool | gnuplotOpen ()
Functions for global precision
void | setPrecision (int precision=DEFAULT_PRECISION)
int | getPrecision () const
void | useIntervalArithmetic (bool use_interval_arithmetic=true)
bool | usesIntervalArithmetic () const
void | beginTemporaryStopIntervalArithmetic ()
void | endTemporaryStopIntervalArithmetic ()
void | beginTemporaryEnableIntervalArithmetic ()
void | endTemporaryEnableIntervalArithmetic ()
bool | usesMatlabStyleMatrices () const
void | useMatlabStyleMatrices (bool use_matlab_style_matrices)
bool | conciseUncertaintyInputEnabled () const
void | setConciseUncertaintyInputEnabled (bool enable_concise_uncertainty_input)
long int | fixedDenominator () const
void | setFixedDenominator (long int fixed_denominator)
void | setCustomInputBase (Number nr)
void | setCustomOutputBase (Number nr)
const Number & | customInputBase () const
const Number & | customOutputBase () const
Unit * | customAngleUnit ()
void | setCustomAngleUnit (Unit *u)
bool | simplifiedPercentageUsed () const
void | setSimplifiedPercentageUsed (bool percentage_used=true)
Functions for localization
const std::string & | getDecimalPoint () const
const std::string & | getComma () const
void | setLocale ()
void | setIgnoreLocale ()
| Deprecated: use pass true to constructor instead.
bool | getIgnoreLocale ()
void | useDecimalComma ()
void | useDecimalPoint (bool comma_as_separator=false)
void | unsetLocale ()
std::string | localToString (bool include_spaces=true) const
std::string | localWhereString () const
Functions adding alternative symbols for operators and such
void | addStringAlternative (std::string replacement, std::string standard)
bool | delStringAlternative (std::string replacement, std::string standard)
void | addDefaultStringAlternative (std::string replacement, std::string standard)
bool | delDefaultStringAlternative (std::string replacement, std::string standard)
Functions for storing values with associated identifiers
size_t | addId (MathStructure *mstruct, bool persistent=false)
size_t | parseAddId (MathFunction *f, const std::string &str, const ParseOptions &po, bool persistent=false)
size_t | parseAddIdAppend (MathFunction *f, const MathStructure &append_mstruct, const std::string &str, const ParseOptions &po, bool persistent=false)
size_t | parseAddVectorId (const std::string &str, const ParseOptions &po, bool persistent=false)
MathStructure * | getId (size_t id)
void | delId (size_t id)

## Public Attributes
KnownVariable * | v_pi
KnownVariable * | v_e
KnownVariable * | v_euler
KnownVariable * | v_catalan
KnownVariable * | v_i
KnownVariable * | v_pinf
KnownVariable * | v_minf
KnownVariable * | v_undef
KnownVariable * | v_precision
KnownVariable * | v_percent
KnownVariable * | v_permille
KnownVariable * | v_permyriad
KnownVariable * | v_today
KnownVariable * | v_yesterday
KnownVariable * | v_tomorrow
KnownVariable * | v_now
UnknownVariable * | v_x
UnknownVariable * | v_y
UnknownVariable * | v_z
UnknownVariable * | v_C
UnknownVariable * | v_n
MathFunction * | f_vector
MathFunction * | f_sort
MathFunction * | f_rank
MathFunction * | f_limits
MathFunction * | f_component
MathFunction * | f_dimension
MathFunction * | f_merge_vectors
MathFunction * | f_matrix
MathFunction * | f_matrix_to_vector
MathFunction * | f_area
MathFunction * | f_rows
MathFunction * | f_columns
MathFunction * | f_row
MathFunction * | f_column
MathFunction * | f_elements
MathFunction * | f_element
MathFunction * | f_transpose
MathFunction * | f_identity
MathFunction * | f_determinant
MathFunction * | f_permanent
MathFunction * | f_adjoint
MathFunction * | f_cofactor
MathFunction * | f_inverse
MathFunction * | f_magnitude
MathFunction * | f_hadamard
MathFunction * | f_entrywise
MathFunction * | f_factorial
MathFunction * | f_factorial2
MathFunction * | f_multifactorial
MathFunction * | f_binomial
MathFunction * | f_xor
MathFunction * | f_bitxor
MathFunction * | f_even
MathFunction * | f_odd
MathFunction * | f_shift
MathFunction * | f_bitcmp
MathFunction * | f_abs
MathFunction * | f_gcd
MathFunction * | f_lcm
MathFunction * | f_signum
MathFunction * | f_heaviside
MathFunction * | f_dirac
MathFunction * | f_round
MathFunction * | f_floor
MathFunction * | f_ceil
MathFunction * | f_trunc
MathFunction * | f_int
MathFunction * | f_frac
MathFunction * | f_rem
MathFunction * | f_mod
MathFunction * | f_polynomial_unit
MathFunction * | f_polynomial_primpart
MathFunction * | f_polynomial_content
MathFunction * | f_coeff
MathFunction * | f_lcoeff
MathFunction * | f_tcoeff
MathFunction * | f_degree
MathFunction * | f_ldegree
MathFunction * | f_re
MathFunction * | f_im
MathFunction * | f_arg
MathFunction * | f_numerator
MathFunction * | f_denominator
MathFunction * | f_interval
MathFunction * | f_uncertainty
MathFunction * | f_sqrt
MathFunction * | f_cbrt
MathFunction * | f_root
MathFunction * | f_sq
MathFunction * | f_exp
MathFunction * | f_ln
MathFunction * | f_logn
MathFunction * | f_lambert_w
MathFunction * | f_sin
MathFunction * | f_cos
MathFunction * | f_tan
MathFunction * | f_asin
MathFunction * | f_acos
MathFunction * | f_atan
MathFunction * | f_sinh
MathFunction * | f_cosh
MathFunction * | f_tanh
MathFunction * | f_asinh
MathFunction * | f_acosh
MathFunction * | f_atanh
MathFunction * | f_atan2
MathFunction * | f_sinc
MathFunction * | f_radians_to_default_angle_unit
MathFunction * | f_zeta
MathFunction * | f_gamma
MathFunction * | f_digamma
MathFunction * | f_beta
MathFunction * | f_airy
MathFunction * | f_besselj
MathFunction * | f_bessely
MathFunction * | f_erf
MathFunction * | f_erfc
MathFunction * | f_total
MathFunction * | f_percentile
MathFunction * | f_min
MathFunction * | f_max
MathFunction * | f_mode
MathFunction * | f_rand
MathFunction * | f_date
MathFunction * | f_datetime
MathFunction * | f_timevalue
MathFunction * | f_timestamp
MathFunction * | f_stamptodate
MathFunction * | f_days
MathFunction * | f_yearfrac
MathFunction * | f_week
MathFunction * | f_weekday
MathFunction * | f_month
MathFunction * | f_day
MathFunction * | f_year
MathFunction * | f_yearday
MathFunction * | f_time
MathFunction * | f_add_days
MathFunction * | f_add_months
MathFunction * | f_add_years
MathFunction * | f_lunarphase
MathFunction * | f_nextlunarphase
MathFunction * | f_bin
MathFunction * | f_oct
MathFunction * | f_hex
MathFunction * | f_base
MathFunction * | f_roman
MathFunction * | f_ascii
MathFunction * | f_char
MathFunction * | f_length
MathFunction * | f_concatenate
MathFunction * | f_replace
MathFunction * | f_stripunits
MathFunction * | f_genvector
MathFunction * | f_for
MathFunction * | f_sum
MathFunction * | f_product
MathFunction * | f_process
MathFunction * | f_process_matrix
MathFunction * | f_csum
MathFunction * | f_if
MathFunction * | f_is_number
MathFunction * | f_is_real
MathFunction * | f_is_rational
MathFunction * | f_is_integer
MathFunction * | f_represents_number
MathFunction * | f_represents_real
MathFunction * | f_represents_rational
MathFunction * | f_represents_integer
MathFunction * | f_function
MathFunction * | f_select
MathFunction * | f_diff
MathFunction * | f_integrate
MathFunction * | f_solve
MathFunction * | f_multisolve
MathFunction * | f_dsolve
MathFunction * | f_limit
MathFunction * | f_li
MathFunction * | f_Li
MathFunction * | f_Ei
MathFunction * | f_Si
MathFunction * | f_Ci
MathFunction * | f_Shi
MathFunction * | f_Chi
MathFunction * | f_igamma
MathFunction * | f_error
MathFunction * | f_warning
MathFunction * | f_message
MathFunction * | f_save
MathFunction * | f_load
MathFunction * | f_export
MathFunction * | f_title
MathFunction * | f_register
MathFunction * | f_stack
MathFunction * | f_plot
Unit * | u_rad
Unit * | u_gra
Unit * | u_deg
Unit * | u_euro
Unit * | u_btc
Unit * | u_second
Unit * | u_minute
Unit * | u_hour
Unit * | u_year
Unit * | u_month
Unit * | u_day
DecimalPrefix * | decimal_null_prefix
BinaryPrefix * | binary_null_prefix
bool | place_currency_code_before
bool | place_currency_sign_before
bool | place_currency_code_before_negative
bool | place_currency_sign_before_negative
bool | default_dot_as_separator
std::string | local_digit_group_separator
std::string | local_digit_group_format
bool | b_busy
std::string | expression_to_calculate
EvaluationOptions | tmp_evaluationoptions
MathStructure * | tmp_parsedstruct
MathStructure * | tmp_tostruct
MathStructure * | tmp_rpn_mstruct
bool | tmp_maketodivision
int | tmp_proc_command
int | tmp_proc_registers
size_t | tmp_rpnindex
PrintOptions | save_printoptions
PrintOptions | message_printoptions
std::vector< Variable * > | variables
std::vector< MathFunction * > | functions
std::vector< Unit * > | units
std::vector< Prefix * > | prefixes
std::vector< DecimalPrefix * > | decimal_prefixes
std::vector< BinaryPrefix * > | binary_prefixes

## Protected Member Functions
bool | calculateRPN (MathStructure *mstruct, int command, size_t index, int msecs, const EvaluationOptions &eo, int function_arguments=0)
bool | calculateRPN (std::string str, int command, size_t index, int msecs, const EvaluationOptions &eo, MathStructure *parsed_struct, MathStructure *to_struct, bool make_to_division, int function_arguments=0)

## Protected Attributes
std::vector< CalculatorMessage > | messages
int | ianglemode
int | i_precision
bool | b_interval
int | i_stop_interval
int | i_start_interval
char | vbuffer [200]
std::vector< void * > | ufvl
std::vector< char > | ufvl_t
std::vector< size_t > | ufvl_i
std::vector< void * > | ufv [4][UFV_LENGTHS]
std::vector< size_t > | ufv_i [4][UFV_LENGTHS]
std::vector< DataSet * > | data_sets
class Calculator_p * | priv
std::vector< std::string > | signs
std::vector< std::string > | real_signs
std::vector< std::string > | default_signs
std::vector< std::string > | default_real_signs
bool | b_ignore_locale
char * | saved_locale
int | disable_errors_ref
std::vector< int > | stopped_errors_count
std::vector< int > | stopped_warnings_count
std::vector< int > | stopped_messages_count
std::vector< std::vector< CalculatorMessage > > | stopped_messages
Thread * | calculate_thread
std::string | NAME_NUMBER_PRE_S
std::string | NAME_NUMBER_PRE_STR
std::string | DOT_STR
std::string | DOT_S
std::string | COMMA_S
std::string | COMMA_STR
std::string | ILLEGAL_IN_NAMES
std::string | ILLEGAL_IN_UNITNAMES
std::string | ILLEGAL_IN_NAMES_MINUS_SPACE_STR
bool | b_argument_errors
int | current_stage
time_t | exchange_rates_time [3]
time_t | exchange_rates_check_time [3]
int | b_exchange_rates_used
bool | b_exchange_rates_warning_enabled
bool | b_gnuplot_open
std::string | gnuplot_cmdline
FILE * | gnuplot_pipe
bool | local_to
Assumptions * | default_assumptions
std::vector< Variable * > | deleted_variables
std::vector< MathFunction * > | deleted_functions
std::vector< Unit * > | deleted_units
bool | b_var_units
bool | b_save_called
int | i_timeout
struct timeval | t_end
int | i_aborted
bool | b_controlled
std::string | per_str
std::string | times_str
std::string | plus_str
std::string | minus_str
std::string | and_str
std::string | AND_str
std::string | or_str
std::string | OR_str
std::string | XOR_str
size_t | per_str_len
size_t | times_str_len
size_t | plus_str_len
size_t | minus_str_len
size_t | and_str_len
size_t | AND_str_len
size_t | or_str_len
size_t | OR_str_len
size_t | XOR_str_len
std::vector< MathStructure * > | rpn_stack

## Detailed Description

The almighty calculator class.

The calculator class is responsible for loading functions, variables and units, and keeping track of them, as well as parsing expressions and much more. A calculator object must be created before any other Qalculate! class is used. There should never be more than one calculator object, accessed with CALCULATOR.

A simple application using libqalculate need only create a calculator object, perhaps load definitions (functions, variables, units, etc.) and use the calculate function as follows:

new Calculator();
CALCULATOR->loadGlobalDefinitions();
CALCULATOR->loadLocalDefinitions();
MathStructure result = CALCULATOR->calculate("1 + 1");
MathStructure
A structure representing a mathematical value/expression/result.
Definition MathStructure.h:150

## Member Function Documentation

## ◆ abort()

bool Calculator::abort | ( |  | ) |

Abort formatting, printing or evaluation (after startControl() has been called). This function will normally be called from a thread that checks for user input or other conditions.

Returns
  false if the calculation thread was forcibly stopped

## ◆ addBuiltinFunctions()

void Calculator::addBuiltinFunctions | ( |  | ) |

Adds builtin functions. Called automatically when the calculator is created.

## ◆ addBuiltinUnits()

void Calculator::addBuiltinUnits | ( |  | ) |

Adds builtin units. Called automatically when the calculator is created.

## ◆ addBuiltinVariables()

void Calculator::addBuiltinVariables | ( |  | ) |

Adds builtin variables. Called automatically when the calculator is created.

## ◆ addId()

size_t Calculator::addId | ( | MathStructure * | mstruct,
|  | bool | persistent = false )

Stores a value with an associated id. Mainly for internal use.

Parameters

  mstruct | The value to store.
  persistent | If false the values will be removed from storage when retrieved with getId().

Returns
  Storage id.

## ◆ addPrefix()

Prefix * Calculator::addPrefix | ( | Prefix * | p | ) |

Add a new prefix to the calculator.

## ◆ busy()

bool Calculator::busy | ( |  | ) |

Returns true if the calculate or print thread is busy.

## ◆ calculate() [1/4]

MathStructure Calculator::calculate | ( | const MathStructure & | mstruct,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | std::string | to_str = "" )

Calculates a parsed value.

Parameters

  mstruct | Parsed value to evaluate.
  eo | Options for the evaluation of the expression.
  to_str | "to" expression for conversion.

Returns
  The result of the calculation.

## ◆ calculate() [2/4]

bool Calculator::calculate | ( | MathStructure * | mstruct,
|  | int | msecs,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | std::string | to_str = "" )

Calculates a parsed value. This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified. The calculation can then be stopped with abort().

Parameters

  [out] | mstruct | Parsed value to evaluate and fill with the result.
  | msecs | The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
  | eo | Options for the evaluation of the expression.
  | to_str | "to" expression for conversion.

Returns
  The result of the calculation.

## ◆ calculate() [3/4]

bool Calculator::calculate | ( | MathStructure * | mstruct,
|  | std::string | str,
|  | int | msecs,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | MathStructure * | parsed_struct = NULL,
|  | MathStructure * | to_struct = NULL,
|  | bool | make_to_division = true )

Calculates an expression. The expression should be unlocalized first with unlocalizeExpression(). This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified. The calculation can then be stopped with abort().

Parameters

  [out] | mstruct | Math structure to fill with the result.
  | str | Expression.
  | msecs | The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
  | eo | Options for the evaluation and parsing of the expression.
  [out] | parsed_struct | NULL or a math structure to fill with the result of the parsing of the expression.
  [out] | to_struct | NULL or a math structure to fill with unit expression parsed after "to". If expression does not contain a "to" string, and to_struct is a unit or a symbol (a unit expression string), to_struct will be used instead.
  | make_to_division | If true, the expression after "to" will be interpreted as a unit expression to convert the result to.

Returns
  true if the calculation was successfully started (and finished if msecs > 0).

## ◆ calculate() [4/4]

MathStructure Calculator::calculate | ( | std::string | str,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | MathStructure * | parsed_struct = NULL,
|  | MathStructure * | to_struct = NULL,
|  | bool | make_to_division = true )

Calculates an expression. The expression should be unlocalized first with unlocalizeExpression().

Parameters

  | str | Expression.
  | eo | Options for the evaluation and parsing of the expression.
  [out] | parsed_struct | NULL or a math structure to fill with the result of the parsing of the expression.
  [out] | to_struct | NULL or a math structure to fill with unit expression parsed after "to". If expression does not contain a "to" string, and to_struct is a unit or a symbol (a unit expression string), to_struct will be used instead.
  | make_to_division | If true, the expression after "to" will be interpreted as a unit expression to convert the result to.

Returns
  The result of the calculation.

## ◆ calculateAndPrint() [1/2]

std::string Calculator::calculateAndPrint | ( | std::string | str,
|  | int | msecs,
|  | const EvaluationOptions & | eo,
|  | const PrintOptions & | po,
|  | AutomaticFractionFormat | auto_fraction,
|  | AutomaticApproximation | auto_approx = AUTOMATIC_APPROXIMATION_OFF,
|  | std::string * | parsed_expression = NULL,
|  | int | max_length = -1,
|  | bool * | result_is_comparison = NULL,
|  | bool | format = false,
|  | int | colorize = 0,
|  | int | tagtype = TAG_TYPE_HTML )

Calculates an expression.and outputs the result to a text string. The expression should be unlocalized first with unlocalizeExpression().

Unlike other functions for expression evaluation this function handles ending "to"-commands, in addition to unit conversion, such "to hexadecimal" or to "fractions", similar to the qalc application.

Parameters

  str | Expression.
  msecs | The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
  eo | Options for the evaluation and parsing of the expression.
  po | Result formatting options.

Returns
  The result of the calculation.

Since
  4.0.0

## ◆ calculateAndPrint() [2/2]

std::string Calculator::calculateAndPrint | ( | std::string | str,
|  | int | msecs = 10000,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | const PrintOptions & | po = default_print_options,
|  | std::string * | parsed_expression = NULL )

Calculates an expression.and outputs the result to a text string. The expression should be unlocalized first with unlocalizeExpression().

Unlike other functions for expression evaluation this function handles ending "to"-commands, in addition to unit conversion, such "to hexadecimal" or to "fractions", similar to the qalc application.

Parameters

  str | Expression.
  msecs | The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
  eo | Options for the evaluation and parsing of the expression.
  po | Result formatting options.

Returns
  The result of the calculation.

Since
  2.6.0

## ◆ calculateRPN() [1/4]

MathStructure * Calculator::calculateRPN | ( | MathFunction * | f,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | MathStructure * | parsed_struct = NULL )

Applies a mathematical operation to the first value on the RPN stack. The value is set as the first argument of the function. If no register is available, then zero is added.

Parameters

  | f | Mathematical function.
  | eo | Options for the evaluation and parsing of the expression.
  [out] | parsed_struct | NULL or a math structure to fill with the unevaluated result.

Returns
  The first value on the stack.

## ◆ calculateRPN() [2/4]

bool Calculator::calculateRPN | ( | MathFunction * | f,
|  | int | msecs,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | MathStructure * | parsed_struct = NULL )

Applies a mathematical operation to the first value on the RPN stack. The value is set as the first argument of the function. If no register is available, then zero is added. This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified. The calculation can then be stopped with abort().

Parameters

  | f | Mathematical function.
  | msecs | The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
  | eo | Options for the evaluation and parsing of the expression.
  [out] | parsed_struct | NULL or a math structure to fill with the unevaluated result.

Returns
  true if the calculation was successfully started (and finished if msecs > 0).

## ◆ calculateRPN() [3/4]

MathStructure * Calculator::calculateRPN | ( | MathOperation | op,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | MathStructure * | parsed_struct = NULL )

Applies a mathematical operation to the first and second value on the RPN stack. The the second value is changed with input from the first value. For example, with OPERATION_SUBTRACT the first value is subtracted from the second. The first value on the stack is removed. If not enough registers is available, then zeros are added.

Parameters

  | op | Operation.
  | eo | Options for the evaluation and parsing of the expression.
  [out] | parsed_struct | NULL or a math structure to fill with the unevaluated result.

Returns
  The first value on the stack.

## ◆ calculateRPN() [4/4]

bool Calculator::calculateRPN | ( | MathOperation | op,
|  | int | msecs,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | MathStructure * | parsed_struct = NULL )

Applies a mathematical operation to the first and second value on the RPN stack. The the second value is changed with input from the first value. For example, with OPERATION_SUBTRACT the first value is subtracted from the second. The first value on the stack is removed. If not enough registers is available, then zeros are added. This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified. The calculation can then be stopped with abort().

Parameters

  | op | Operation.
  | msecs | The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
  | eo | Options for the evaluation and parsing of the expression.
  [out] | parsed_struct | NULL or a math structure to fill with the unevaluated result.

Returns
  true if the calculation was successfully started (and finished if msecs > 0).

## ◆ calculateRPNBitwiseNot() [1/2]

MathStructure * Calculator::calculateRPNBitwiseNot | ( | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | MathStructure * | parsed_struct = NULL )

Applies bitwise not to the first value on the RPN stack. If no register is available, then zero is added.

Parameters

  | eo | Options for the evaluation and parsing of the expression.
  [out] | parsed_struct | NULL or a math structure to fill with the unevaluated result.

Returns
  The first value on the stack.

## ◆ calculateRPNBitwiseNot() [2/2]

bool Calculator::calculateRPNBitwiseNot | ( | int | msecs,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | MathStructure * | parsed_struct = NULL )

Applies bitwise not to the first value on the RPN stack. If no register is available, then zero is added. This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified. The calculation can then be stopped with abort().

Parameters

  | msecs | The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
  | eo | Options for the evaluation and parsing of the expression.
  [out] | parsed_struct | NULL or a math structure to fill with the unevaluated result.

Returns
  true if the calculation was successfully started (and finished if msecs > 0).

## ◆ calculateRPNLogicalNot() [1/2]

MathStructure * Calculator::calculateRPNLogicalNot | ( | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | MathStructure * | parsed_struct = NULL )

Applies logical not to the first value on the RPN stack. If no register is available, then zero is added.

Parameters

  | eo | Options for the evaluation and parsing of the expression.
  [out] | parsed_struct | NULL or a math structure to fill with the unevaluated result.

Returns
  The first value on the stack.

## ◆ calculateRPNLogicalNot() [2/2]

bool Calculator::calculateRPNLogicalNot | ( | int | msecs,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | MathStructure * | parsed_struct = NULL )

Applies logical not to the first value on the RPN stack. If no register is available, then zero is added. This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified. The calculation can then be stopped with abort().

Parameters

  | msecs | The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
  | eo | Options for the evaluation and parsing of the expression.
  [out] | parsed_struct | NULL or a math structure to fill with the unevaluated result.

Returns
  true if the calculation was successfully started (and finished if msecs > 0).

## ◆ calculateRPNRegister()

bool Calculator::calculateRPNRegister | ( | size_t | index,
|  | int | msecs,
|  | const EvaluationOptions & | eo = default_user_evaluation_options )

Evaluates a value on the RPN stack. This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified. The calculation can then be stopped with abort().

Parameters

  index | Index, starting at 1, on the RPN stack.
  msecs | The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
  eo | Options for the evaluation and parsing of the expression.

Returns
  true if the calculation was successfully started (and finished if msecs > 0).

## ◆ canFetch()

bool Calculator::canFetch | ( |  | ) |

Checks if able to downloading exchange rates from the Internet (using libcurl).

Returns
  true if exchange rates can downloaded (if libcurl is available).

## ◆ canPlot()

bool Calculator::canPlot | ( |  | ) |

Checks if gnuplot is available.

Returns
  true if gnuplot was found.

## ◆ checkExchangeRatesDate()

bool Calculator::checkExchangeRatesDate | ( | unsigned int | n_days = 7,
|  | bool | force_check = false,
|  | bool | send_warning = false,
|  | int | n = -1 )

Check age of exchange rates on local disc.

Parameters

  n_days | How old in days exchange rates may be before exchange rates need updating
  force_check | If exchange rates date should be checked again even if found outdated within n_days before
  send_warning | If the standard exchange rates warning should be sent.

Returns
  false if exchange.rates need updating

## ◆ clearBuffers()

void Calculator::clearBuffers | ( |  | ) |

Clears all stored values. Used internally after aborted calculation.

## ◆ clearMessages()

void Calculator::clearMessages | ( |  | ) |

Clear the message queue.

## ◆ convert() [1/2]

MathStructure Calculator::convert | ( | const MathStructure & | mstruct,
|  | std::string | composite_,
|  | const EvaluationOptions & | eo,
|  | MathStructure * | units,
|  | bool | transform_orig,
|  | MathStructure * | parsed_struct = NULL )

Converts to a unit expression. The converted value is evaluated.

Parameters

  | mstruct | The value to convert.
  | composite_ | Unit expression.
  | eo | Evaluation options.
  [out] | units | NULL or a math structure to fill with the parsed unit expression (or set to undefined if no units were found).

Returns
  Converted value.

## ◆ convert() [2/2]

MathStructure Calculator::convert | ( | const MathStructure & | mstruct,
|  | Unit * | to_unit,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | bool | always_convert = true,
|  | bool | convert_to_mixed_units = true,
|  | bool | transform_orig = false,
|  | MathStructure * | parsed_struct = NULL )

Converts to a unit. The converted value is evaluated.

Parameters

  mstruct | The value to convert.
  to_unit | Unit to convert to.
  eo | Evaluation options.
  always_convert | ...

Returns
  Converted value.

## ◆ convertTimeOut()

MathStructure Calculator::convertTimeOut | ( | std::string | str,
|  | Unit * | from_unit,
|  | Unit * | to_unit,
|  | int | milliseconds,
|  | const EvaluationOptions & | eo = default_user_evaluation_options )

Deprecated: use convert()

## ◆ convertToBestUnit()

MathStructure Calculator::convertToBestUnit | ( | const MathStructure & | mstruct,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | bool | convert_to_si_units = true )

Deprecated: use convertToOptimalUnit()

## ◆ defaultAssumptions()

Assumptions * Calculator::defaultAssumptions | ( |  | ) |

Returns the default assumptions for objects without own assumptions (unknown variables and symbols).

## ◆ delId()

void Calculator::delId | ( | size_t | id | ) |

Removes and unreferences (value->unref() will be called) a value from storage. Mainly for internal use.

Parameters

  id | Storage id.

## ◆ fetchExchangeRates()

bool Calculator::fetchExchangeRates | ( | int | seconds = 15,
|  | int | n = -1 )

Download current exchange rates from the Internet to local disc with default wget arguments.

Parameters

  seconds | Maximum time for download try

Returns
  true if operation was successful.

## ◆ findMatchingUnit()

Unit * Calculator::findMatchingUnit | ( | const MathStructure & | mstruct | ) |

Used by the UI to find unit category for a mathematical expression.

## ◆ getBestUnit()

Unit * Calculator::getBestUnit | ( | Unit * | u,
|  | bool | allow_only_div = false,
|  | bool | convert_to_local_currency = true )

Deprecated: use getOptimalUnit()

## ◆ getComma()

const std::string & Calculator::getComma | ( |  | ) | const

Returns the preferred comma character for separating arguments.

## ◆ getDecimalPoint()

const std::string & Calculator::getDecimalPoint | ( |  | ) | const

Returns the preferred decimal point character.

## ◆ getDegUnit()

Unit * Calculator::getDegUnit | ( |  | ) |

Returns the degrees unit.

## ◆ getExactBinaryPrefix()

BinaryPrefix * Calculator::getExactBinaryPrefix | ( | int | exp2,
|  | int | exp = 1 ) const

Returns a binary prefix with exactly the provided value, that fulfils the condition prefix->exponent(exp) == exp2.

Parameters

  exp2 | Base-2 exponent of the requested prefix.
  exp | The exponent of the unit.

Returns
  A prefix or NULL if not found.

## ◆ getExactDecimalPrefix()

DecimalPrefix * Calculator::getExactDecimalPrefix | ( | int | exp10,
|  | int | exp = 1 ) const

Returns a decimal prefix with exactly the provided value, that fulfils the condition prefix->exponent(exp) == exp10.

Parameters

  exp10 | Base-10 exponent of the requested prefix.
  exp | The exponent of the unit.

Returns
  A prefix or NULL if not found.

## ◆ getExactPrefix()

Prefix * Calculator::getExactPrefix | ( | const Number & | o,
|  | int | exp = 1 ) const

Returns a prefix with exactly the provided value, that fulfils the condition prefix->value(exp) == o.

Parameters

  o | Value of the requested prefix.
  exp | The exponent of the unit.

Returns
  A prefix or NULL if not found.

## ◆ getExchangeRatesFileName()

std::string Calculator::getExchangeRatesFileName | ( | int | index = 1 | ) |

Name of the exchange rates file on local disc. Multiple exchange rates sources might be used. Iterate over these, using the index parameter, until an empty string is returned.

Parameters

  index | The index (starting at one) of the exchange rate source

Returns
  name of local exchange rates file.

## ◆ getExchangeRatesTime()

time_t Calculator::getExchangeRatesTime | ( | int | index = -1 | ) |

Modification time of the exchange rates file.

Returns
  Returns exchange rates modification time.

## ◆ getExchangeRatesUrl()

std::string Calculator::getExchangeRatesUrl | ( | int | index = 1 | ) |

Url of the exchange rates file on the Internet. Multiple exchange rates sources might be used. Iterate over these, using the index parameter, until an empty string is returned.

Parameters

  index | The index (starting at one) of the exchange rate source

Returns
  Url of exchange rates file.

## ◆ getFunction()

MathFunction * Calculator::getFunction | ( | size_t | index | ) | const

Returns function for an index (starting at zero). All functions can be traversed by starting at index zero and increasing the index until NULL is returned.

Parameters

  index | Index of function.

Returns
  Function for index or NULL if not found.

## ◆ getGraUnit()

Unit * Calculator::getGraUnit | ( |  | ) |

Returns the gradians unit.

## ◆ getId()

MathStructure * Calculator::getId | ( | size_t | id | ) |

Returns a stored value. Mainly for internal use.

Parameters

  id | Storage id.

Returns
  A stored value.

## ◆ getNearestBinaryPrefix()

BinaryPrefix * Calculator::getNearestBinaryPrefix | ( | int | exp2,
|  | int | exp = 1 ) const

Returns the nearest binary prefix for a value.

Parameters

  exp2 | Base-2 exponent of the value.
  exp | The exponent of the unit.

Returns
  A prefix or NULL if no binary prefix is available.

## ◆ getNearestDecimalPrefix()

DecimalPrefix * Calculator::getNearestDecimalPrefix | ( | int | exp10,
|  | int | exp = 1 ) const

Returns the nearest decimal prefix for a value.

Parameters

  exp10 | Base-10 exponent of the value.
  exp | The exponent of the unit.

Returns
  A prefix or NULL if no decimal prefix is available.

## ◆ getOptimalBinaryPrefix() [1/2]

BinaryPrefix * Calculator::getOptimalBinaryPrefix | ( | const Number & | exp2,
|  | const Number & | exp ) const

Returns the best suited binary prefix for a value.

Parameters

  exp2 | Base-2 exponent of the value.
  exp | The exponent of the unit.

Returns
  A prefix or NULL if the unit should be left without prefix.

## ◆ getOptimalBinaryPrefix() [2/2]

BinaryPrefix * Calculator::getOptimalBinaryPrefix | ( | int | exp2,
|  | int | exp = 1 ) const

Returns the best suited binary prefix for a value.

Parameters

  exp2 | Base-2 exponent of the value.
  exp | The exponent of the unit.

Returns
  A prefix or NULL if the unit should be left without prefix.

## ◆ getOptimalDecimalPrefix() [1/2]

DecimalPrefix * Calculator::getOptimalDecimalPrefix | ( | const Number & | exp10,
|  | const Number & | exp,
|  | bool | all_prefixes = true ) const

Returns the best suited decimal prefix for a value.

Parameters

  exp10 | Base-10 exponent of the value.
  exp | The exponent of the unit.
  all_prefixes | If false, prefixes which is not a multiple of thousand (centi, deci, deca, hecto) will be skipped.

Returns
  A prefix or NULL if the unit should be left without prefix.

## ◆ getOptimalDecimalPrefix() [2/2]

DecimalPrefix * Calculator::getOptimalDecimalPrefix | ( | int | exp10,
|  | int | exp = 1,
|  | bool | all_prefixes = true ) const

Returns the best suited decimal prefix for a value.

Parameters

  exp10 | Base-10 exponent of the value.
  exp | The exponent of the unit.
  all_prefixes | If false, prefixes which is not a multiple of thousand (centi, deci, deca, hecto) will be skipped.

Returns
  A prefix or NULL if the unit should be left without prefix.

## ◆ getPrecision()

int Calculator::getPrecision | ( |  | ) | const

Returns default precision for approximate calculations.

## ◆ getPrefix() [1/2]

Prefix * Calculator::getPrefix | ( | size_t | index | ) | const

Returns prefix for an index (starting at zero). All prefixes can be traversed by starting at index zero and increasing the index until NULL is returned.

Parameters

  index | Index of prefix.

Returns
  Prefix for index or NULL if not found.

## ◆ getPrefix() [2/2]

Prefix * Calculator::getPrefix | ( | std::string | name_ | ) | const

Returns prefix with provided name.

Parameters

  name_ | Name of prefix to retrieve.

Returns
  Prefix with provided name or NULL if not found.

## ◆ getRadUnit()

Unit * Calculator::getRadUnit | ( |  | ) |

Returns the radians unit.

## ◆ getUnit()

Unit * Calculator::getUnit | ( | size_t | index | ) | const

Returns unit for an index (starting at zero). All units can be traversed by starting at index zero and increasing the index until NULL is returned.

Parameters

  index | Index of unit.

Returns
  Unit for index or NULL if not found.

## ◆ getVariable()

Variable * Calculator::getVariable | ( | size_t | index | ) | const

Returns variable for an index (starting at zero). All variables can be traversed by starting at index zero and increasing the index until NULL is returned.

Parameters

  index | Index of variable.

Returns
  Variable for index or NULL if not found.

## ◆ hasFunction()

bool Calculator::hasFunction | ( | MathFunction * | f | ) |

Checks if a function exists/is registered in the calculator.

## ◆ hasUnit()

bool Calculator::hasUnit | ( | Unit * | u | ) |

Checks if a unit exists/is registered in the calculator.

## ◆ hasVariable()

bool Calculator::hasVariable | ( | Variable * | v | ) |

Checks if a variable exists/is registered in the calculator.

## ◆ loadDefinitions()

int Calculator::loadDefinitions | ( | const char * | file_name,
|  | bool | is_user_defs = true,
|  | bool | check_duplicates_of_global = false )

Load definitions from a file.

Parameters

  file_name | The path to the file to load.
  is_user_defs | true if the definitions are local, false if they are global.

Returns
  true if the definitions were successfully loaded.

## ◆ loadExchangeRates()

bool Calculator::loadExchangeRates | ( |  | ) |

Load exchange rates. Use before loadGlobalCurrencies() or loadGlobalDefinitions().

Returns
  true if operation successful.

## ◆ loadGlobalCurrencies()

bool Calculator::loadGlobalCurrencies | ( |  | ) |

Load currencies.

Returns
  true if the definitions were successfully loaded.

## ◆ loadGlobalDataSets()

bool Calculator::loadGlobalDataSets | ( |  | ) |

Load data sets.

Returns
  true if the definitions were successfully loaded.

## ◆ loadGlobalDefinitions() [1/2]

bool Calculator::loadGlobalDefinitions | ( |  | ) |

Load all standard global (system wide) definitions from the global data directory ($PREFIX/share/qalculate).

Returns
  true if the definitions were successfully loaded.

## ◆ loadGlobalDefinitions() [2/2]

bool Calculator::loadGlobalDefinitions | ( | std::string | filename | ) |

Load global (system wide) definitions from a file in the global data directory ($PREFIX/share/qalculate).

Parameters

  filename | Name of the file in the global data directory.

Returns
  true if the definitions were successfully loaded.

## ◆ loadGlobalFunctions()

bool Calculator::loadGlobalFunctions | ( |  | ) |

Load functions.

Returns
  true if the definitions were successfully loaded.

## ◆ loadGlobalPrefixes()

bool Calculator::loadGlobalPrefixes | ( |  | ) |

Load prefixes.

Returns
  true if the definitions were successfully loaded.

## ◆ loadGlobalUnits()

bool Calculator::loadGlobalUnits | ( |  | ) |

Load units.

Returns
  true if the definitions were successfully loaded.

## ◆ loadGlobalVariables()

bool Calculator::loadGlobalVariables | ( |  | ) |

Load variables.

Returns
  true if the definitions were successfully loaded.

## ◆ loadLocalDefinitions()

bool Calculator::loadLocalDefinitions | ( |  | ) |

Load local, user specific, definitions from the local definitions directory (~/.qalculate/definitions). All files in the directory and in the datasets subdirectory are loaded.

Returns
  true if the definitions were successfully loaded.

## ◆ localizeExpression()

std::string Calculator::localizeExpression | ( | std::string | str,
|  | const ParseOptions & | po = default_parse_options ) const

Returns a localized expressions. Affects decimal signs and argument separators.

Parameters

  str | The expression to localize.

Returns
  A localized expression.

## ◆ localToString()

std::string Calculator::localToString | ( | bool | include_spaces = true | ) | const

Returns the translated text string used in expressions for converting to a specific unit expression (ex "5 meters to feet.

## ◆ message() [1/2]

CalculatorMessage * Calculator::message | ( |  | ) |

Returns the first message in queue.

## ◆ message() [2/2]

void Calculator::message | ( | MessageType | mtype,
|  | int | message_category,
|  | const char * | TEMPLATE,
|  |  | ... )

Put a message in the message queue.

## ◆ nameTaken()

bool Calculator::nameTaken | ( | std::string | name,
|  | ExpressionItem * | object = NULL )

Checks if a name is used by another object which is not allowed to have the same name.

Parameters

  name | Name.
  object | Object to exclude from check.

Returns
  true if the name is used.

## ◆ nextMessage()

CalculatorMessage * Calculator::nextMessage | ( |  | ) |

Removes the first message in queue and returns the next.

## ◆ parse()

MathStructure Calculator::parse | ( | std::string | str,
|  | const ParseOptions & | po = default_parse_options )

Parse an expression and place in a MathStructure object.

Parameters

  str | Expression
  po | Parse options.

Returns
  MathStructure with result of parse.

## ◆ parseAddId()

size_t Calculator::parseAddId | ( | MathFunction * | f,
|  | const std::string & | str,
|  | const ParseOptions & | po,
|  | bool | persistent = false )

Stores a function value with arguments parsed from a text string using Function::parse(), with an associated id. Mainly for internal use.

Parameters

  f | Mathematical function.
  str | Arguments.
  po | Parse options.
  persistent | If false the values will be removed from storage when retrieved with getId().

Returns
  Storage id.

## ◆ parseToExpression()

std::string Calculator::parseToExpression | ( | std::string | to_str,
|  | EvaluationOptions & | evalops,
|  | PrintOptions & | printops,
|  | Number * | custom_base = NULL,
|  | int * | binary_prefixes = NULL,
|  | bool * | complex_angle_form = NULL,
|  | bool * | do_factors = NULL,
|  | bool * | do_pfe = NULL,
|  | bool * | do_calendars = NULL,
|  | bool * | do_bases = NULL ) const

Parses a "to"-expression (separated from expression using separateToExpression).

Parameters

  | to_str | The "to"-expression
  [out] | evalops | Updated with directives from the expression
  [out] | printops | Updated with directives from the expression
  [out] | custom_base | Set to non-zero if conversion to custom number base (with Calculator::setCustomOutputBase()) is requested
  [out] | binary_prefixes | Set to 2 if temporary activation of binary prefixes (using Calculator::useBinaryPrefixes()) is requested, 0 for requested deactivation, and -1 otherwise
  [out] | complex_angle_form | Set to true (and evalops.complex_number_form to COMPLEX_FORM_CIS) if complex angle form is requested
  [out] | do_factors | Set to true (and evalops.structuring to STRUCTURING_FACTORIZE) if factorization is requested
  [out] | do_pfe | Set to true if partial fraction expansion is requested
  [out] | do_calendars | Set to true if calendar conversion is requested
  [out] | do_bases | Set to true if expression includes "to bases"

Returns
  the remaining unit expression

## ◆ prefixNameChanged()

void Calculator::prefixNameChanged | ( | Prefix * | p,
|  | bool | new_item = false )

Used internally.

## ◆ print() [1/2]

std::string Calculator::print | ( | const MathStructure & | mstruct,
|  | int | milliseconds,
|  | const PrintOptions & | po,
|  | bool | format,
|  | int | colorize = 0,
|  | int | tagtype = TAG_TYPE_HTML )

Calls MathStructure::format(po) and MathStructure::print(po). The process is aborted after msecs milliseconds.

Since
  4.0.0

## ◆ print() [2/2]

std::string Calculator::print | ( | const MathStructure & | mstruct,
|  | int | milliseconds = 100000,
|  | const PrintOptions & | po = default_print_options )

Calls MathStructure::format(po) and MathStructure::print(po). The process is aborted after msecs milliseconds.

## ◆ reset()

void Calculator::reset | ( |  | ) |

Unloads all non-builtin variables, functions and units.

## ◆ resetFunctions()

void Calculator::resetFunctions | ( |  | ) |

Unloads all non-builtin functions.

## ◆ resetUnits()

void Calculator::resetUnits | ( |  | ) |

Unloads all non-builtin units.

## ◆ resetVariables()

void Calculator::resetVariables | ( |  | ) |

Unloads all non-builtin variables.

## ◆ RPNStackEnter() [1/4]

void Calculator::RPNStackEnter | ( | MathStructure * | mstruct,
|  | bool | eval = false,
|  | const EvaluationOptions & | eo = default_user_evaluation_options )

Adds a value first on the RPN stack.

Parameters

  mstruct | Value.
  eval | If true, the the mathematical structure will be evaluated first.

## ◆ RPNStackEnter() [2/4]

bool Calculator::RPNStackEnter | ( | MathStructure * | mstruct,
|  | int | msecs,
|  | const EvaluationOptions & | eo = default_user_evaluation_options )

Evaluates a value and adds the result first on the RPN stack. This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified. The calculation can then be stopped with abort().

Parameters

  mstruct | Value.
  msecs | The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
  eo | Options for the evaluation of the expression.

Returns
  true if the calculation was successfully started (and finished if msecs > 0).

## ◆ RPNStackEnter() [3/4]

void Calculator::RPNStackEnter | ( | std::string | str,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | MathStructure * | parsed_struct = NULL,
|  | MathStructure * | to_struct = NULL,
|  | bool | make_to_division = true )

Calculates an expression adds the result first on the RPN stack. The expression should be unlocalized first with unlocalizeExpression().

Parameters

  | str | Expression.
  | eo | Options for the evaluation and parsing of the expression.
  [out] | parsed_struct | NULL or a math structure to fill with the result of the parsing of the expression.
  [out] | to_struct | NULL or a math structure to fill with unit expression parsed after "to".
  | make_to_division | If true, the expression after "to" will be interpreted as a unit expression to convert the result to.

## ◆ RPNStackEnter() [4/4]

bool Calculator::RPNStackEnter | ( | std::string | str,
|  | int | msecs,
|  | const EvaluationOptions & | eo = default_user_evaluation_options,
|  | MathStructure * | parsed_struct = NULL,
|  | MathStructure * | to_struct = NULL,
|  | bool | make_to_division = true )

Calculates an expression and adds the result first on the RPN stack. The expression should be unlocalized first with unlocalizeExpression(). This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified. The calculation can then be stopped with abort().

Parameters

  | str | Expression.
  | msecs | The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
  | eo | Options for the evaluation and parsing of the expression.
  [out] | parsed_struct | NULL or a math structure to fill with the result of the parsing of the expression.
  [out] | to_struct | NULL or a math structure to fill with unit expression parsed after "to".
  | make_to_division | If true, the expression after "to" will be interpreted as a unit expression to convert the result to.

Returns
  true if the calculation was successfully started (and finished if msecs > 0).

## ◆ saveDefinitions()

bool Calculator::saveDefinitions | ( |  | ) |

Save local definitions to ~/.qalculate/definitions/

Returns
  true if definitions was successfully saved.

## ◆ separateToExpression()

bool Calculator::separateToExpression | ( | std::string & | str,
|  | std::string & | to_str,
|  | const EvaluationOptions & | eo,
|  | bool | keep_modifiers = false,
|  | bool | allow_empty_from = false ) const

Split an expression string after and before " to ".

Parameters

  [out] | str | The expression. Will be set to the string before " to ".
  [out] | to_str | Will be set to the string after " to ".
  | eo | Options for the evaluation and parsing of the expression (nothing will be done if units are not enabled).

Returns
  true if " to " was found and the expression split.

## ◆ setDefaultAssumptions()

void Calculator::setDefaultAssumptions | ( | Assumptions * | ass | ) |

Set assumptions for objects without own assumptions (unknown variables and symbols).

## ◆ setLocale()

void Calculator::setLocale | ( |  | ) |

Sets argument separator and decimal sign from the current locale. Mainly for internal use.

## ◆ setPrecision()

void Calculator::setPrecision | ( | int | precision = DEFAULT_PRECISION | ) |

Set default precision for approximate calculations.

Parameters

  precision | Precision.

## ◆ startControl()

void Calculator::startControl | ( | int | milliseconds = 0 | ) |

Called before calculation, formatting or printing of a MathStructure (Calculator::calculate(), without maximum time, MathStructure::eval(), MathStructure::format() and MathStructure::print(), etc.) or printing of a Number (using Number::print) to be able to abort the process. Always use Calculator::stopControl() after finishing.

Parameters

  milliseconds | The maximum time for the process in milliseconds. If msecs <= 0 the time will be unlimited (stop with abort()).

## ◆ stillHasFunction()

bool Calculator::stillHasFunction | ( | MathFunction * | f | ) |

Checks if a pointer points to a mathematical function that still exists in the calculator. As opposed to hasFunction(), this function only checks if the mathematical function has been deleted.

## ◆ stillHasUnit()

bool Calculator::stillHasUnit | ( | Unit * | u | ) |

Checks if a pointer points to a unit that still exists in the calculator. As opposed to hasUnit(), this function only checks if the unit has been deleted.

## ◆ stillHasVariable()

bool Calculator::stillHasVariable | ( | Variable * | v | ) |

Checks if a pointer points to a variable that still exists in the calculator. As opposed to hasFunction(), this function only checks if the mathematical function has been deleted.

## ◆ stopControl()

void Calculator::stopControl | ( | void |  | ) |

Always call this function after Calculator::startControl() after formatting, printing or calculation has finished.

## ◆ terminateThreads()

void Calculator::terminateThreads | ( |  | ) |

Terminate calculation and print threads if started. Do not use to terminate calculation.

## ◆ unlocalizeExpression()

std::string Calculator::unlocalizeExpression | ( | std::string | str,
|  | const ParseOptions & | po = default_parse_options ) const

Returns an unlocalized expressions. Affects decimal signs and argument separators.

Parameters

  str | The expression to unlocalize.

Returns
  An unlocalized expression.

## ◆ unsetLocale()

void Calculator::unsetLocale | ( |  | ) |

Resets argument separator and decimal sign. Mainly for internal use.

## ◆ useDecimalPoint()

void Calculator::useDecimalPoint | ( | bool | comma_as_separator = false | ) |

Use point as decimal separator. To use comma as an ignored separator in numbers, must be invoked with comma_as_separator = true, to change the default function argument separator to semicolon, in addition to using ParseOptions::comma_as_separator.

## ◆ useIntervalArithmetic()

void Calculator::useIntervalArithmetic | ( | bool | use_interval_arithmetic = true | ) |

Set if interval should be produced for approximate functions and irrational numbers. This does not affect calculation of lower precision explicit intervals (uncertainty propagation).

Parameters

  use_interval_arithmetic | Set true to activate, or false to deactivate, interval arithmetic.

## ◆ usesBinaryPrefixes()

int Calculator::usesBinaryPrefixes | ( |  | ) | const

Controls if binary, instead of decimal, prefixes will be used by default. 1 = use binary prefixes for information units, 2 = use binary prefixes for all units.

## ◆ usesIntervalArithmetic()

bool Calculator::usesIntervalArithmetic | ( |  | ) | const

Returns true if interval arithmetic are activated.

## ◆ variableNameIsValid() [1/2]

bool Calculator::variableNameIsValid | ( | const char * | name_ | ) | const

Tests if a name is valid for a variable.

Parameters

  name_ | Variable name.

Returns
  true if the name is valid for a variable.

## ◆ variableNameIsValid() [2/2]

bool Calculator::variableNameIsValid | ( | const std::string & | name_ | ) | const

Tests if a name is valid for a variable.

Parameters

  name_ | Variable name.

Returns
  true if the name is valid for a variable.

The documentation for this class was generated from the following file:

- /build/libqalculate/src/libqalculate/libqalculate/Calculator.h