libqalculate-5.7.0
NumberArgument Class Reference

A definition for numerical arguments. More...

#include <Function.h>

Inheritance diagram for NumberArgument:
Argument

Public Member Functions

 NumberArgument (std::string name_="", ArgumentMinMaxPreDefinition minmax=ARGUMENT_MIN_MAX_NONE, bool does_test=true, bool does_error=true)
 NumberArgument (const NumberArgument *arg)
virtual void set (const Argument *arg)
virtual Argumentcopy () const
virtual std::string print () const
void setMin (const Number *nmin)
void setIncludeEqualsMin (bool include_equals)
bool includeEqualsMin () const
const Numbermin () const
void setMax (const Number *nmax)
void setIncludeEqualsMax (bool include_equals)
bool includeEqualsMax () const
const Numbermax () const
bool complexAllowed () const
void setComplexAllowed (bool allow_complex)
bool rationalNumber () const
void setRationalNumber (bool rational_number)
virtual int type () const
Public Member Functions inherited from Argument
 Argument (std::string name_="", bool does_test=true, bool does_error=true)
 Argument (const Argument *arg)
virtual ~Argument ()
std::string printlong () const
bool test (MathStructure &value, int index, MathFunction *f, const EvaluationOptions &eo=default_evaluation_options) const
virtual MathStructure parse (const std::string &str, const ParseOptions &po=default_parse_options) const
virtual void parse (MathStructure *mstruct, const std::string &str, const ParseOptions &po=default_parse_options) const
std::string name () const
void setName (std::string name_)
void setCustomCondition (std::string condition)
std::string getCustomCondition () const
bool tests () const
void setTests (bool does_error)
bool alerts () const
void setAlerts (bool does_error)
bool zeroForbidden () const
void setZeroForbidden (bool forbid_zero)
bool matrixAllowed () const
void setMatrixAllowed (bool allow_matrix)
bool handlesVector () const
void setHandleVector (bool handle_vector)
bool isLastArgument () const
void setIsLastArgument (bool is_last)
bool rationalPolynomial () const
void setRationalPolynomial (bool rational_polynomial)
virtual bool suggestsQuotes () const

Protected Member Functions

virtual bool subtest (MathStructure &value, const EvaluationOptions &eo) const
virtual std::string subprintlong () const

Protected Attributes

Numberfmin
Numberfmax
bool b_incl_min
bool b_incl_max
bool b_complex
bool b_rational_number
Protected Attributes inherited from Argument
std::string sname
std::string scondition
bool b_zero
bool b_test
bool b_matrix
bool b_text
bool b_error
bool b_rational
bool b_last
bool b_handle_vector

Detailed Description

A definition for numerical arguments.

These arguments allows numerical values. The value can be restricted to real or rational numbers (defaults to allow all numbers, including complex), and a max and/or min value.

Member Function Documentation

◆ copy()

virtual Argument * NumberArgument::copy ( ) const
virtual

Returns a copy of the argument definition.

Returns
A copy.

Reimplemented from Argument.

References Argument::Argument().

◆ print()

virtual std::string NumberArgument::print ( ) const
virtual

Returns a short description of the argument definition. Ex. "number" for NumberArgument.

Returns
Short description.

Reimplemented from Argument.

◆ set()

virtual void NumberArgument::set ( const Argument * arg)
virtual

Sets the argument to a copy of an argument definition.

Parameters
argArgument to copy.

Reimplemented from Argument.

References Argument::Argument().

◆ subprintlong()

virtual std::string NumberArgument::subprintlong ( ) const
protectedvirtual

This function is called from Argument::printlong() and returns description specific the argument definition type. Should be reimplemented by all subclasses. For example IntegerArgument::subprintlong() might return "an integer" and Argument::printlong() might append " that fulfills the condition: even(\x)".

Returns
Long description.

Reimplemented from Argument.

◆ subtest()

virtual bool NumberArgument::subtest ( MathStructure & value,
const EvaluationOptions & eo ) const
protectedvirtual

This function is called from Argument::test() and performs validation specific to the argument definition type. Should be reimplemented by all subclasses.

Parameters
valueValue to test.
eoEvaluation options to use if the value needs to be evaluated.
Returns
true if the value is valid for the argument definition.

Reimplemented from Argument.

◆ type()

virtual int NumberArgument::type ( ) const
virtual

Returns the type of the argument, corresponding to which subclass the object belongs to.

Returns
ArgumentType.

Reimplemented from Argument.


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