libqalculate-4.9.0
Public Member Functions | Protected Attributes | List of all members
NumberPrefix Class Reference

A prefix with a free numerical value. More...

#include <Prefix.h>

Inheritance diagram for NumberPrefix:
Prefix

Public Member Functions

 NumberPrefix (const Number &nr, std::string long_name, std::string short_name="", std::string unicode_name="")
 
void setValue (const Number &nr)
 
Number value (const Number &nexp) const
 
Number value (int iexp) const
 
Number value () const
 
int type () const
 
- Public Member Functions inherited from Prefix
 Prefix (std::string long_name, std::string short_name="", std::string unicode_name="")
 
const std::string & shortName (bool return_long_if_no_short=true, bool use_unicode=false) const
 
const std::string & longName (bool return_short_if_no_long=true, bool use_unicode=false) const
 
const std::string & unicodeName (bool return_short_if_no_uni=true) const
 
void setShortName (std::string short_name)
 
void setLongName (std::string long_name)
 
void setUnicodeName (std::string unicode_name)
 
const std::string & name (bool short_default=true, bool use_unicode=false, bool(*can_display_unicode_string_function)(const char *, void *)=NULL, void *can_display_unicode_string_arg=NULL) const
 
const std::string & referenceName () const
 
const ExpressionNamepreferredName (bool abbreviation=false, bool use_unicode=false, bool plural=false, bool reference=false, bool(*can_display_unicode_string_function)(const char *, void *)=NULL, void *can_display_unicode_string_arg=NULL) const
 
const ExpressionNamepreferredInputName (bool abbreviation=false, bool use_unicode=false, bool plural=false, bool reference=false, bool(*can_display_unicode_string_function)(const char *, void *)=NULL, void *can_display_unicode_string_arg=NULL) const
 
const ExpressionNamepreferredDisplayName (bool abbreviation=false, bool use_unicode=false, bool plural=false, bool reference=false, bool(*can_display_unicode_string_function)(const char *, void *)=NULL, void *can_display_unicode_string_arg=NULL) const
 
const ExpressionNamegetName (size_t index) const
 
void setName (const ExpressionName &ename, size_t index=1)
 
void setName (std::string sname, size_t index)
 
void addName (const ExpressionName &ename, size_t index=0)
 
void addName (std::string sname, size_t index=0)
 
size_t countNames () const
 
void clearNames ()
 
void clearNonReferenceNames ()
 
void removeName (size_t index)
 
size_t hasName (const std::string &sname, bool case_sensitive=true) const
 
size_t hasNameCaseSensitive (const std::string &sname) const
 
const ExpressionNamefindName (int abbreviation=-1, int use_unicode=-1, int plural=-1, bool(*can_display_unicode_string_function)(const char *, void *)=NULL, void *can_display_unicode_string_arg=NULL) const
 
virtual Number value (const Number &nexp) const =0
 
virtual Number value (int iexp) const =0
 
virtual Number value () const =0
 
virtual int type () const =0
 

Protected Attributes

Number o_number
 
- Protected Attributes inherited from Prefix
std::vector< ExpressionNamenames
 

Detailed Description

A prefix with a free numerical value.

A prefix without any predefined base, which can use any number.

Constructor & Destructor Documentation

◆ NumberPrefix()

NumberPrefix::NumberPrefix ( const Number nr,
std::string  long_name,
std::string  short_name = "",
std::string  unicode_name = "" 
)

Create a number prefix.

Parameters
nrValue of the prefix.
long_nameLong name.
short_nameShort name.
unicode_nameUnicode name.

Member Function Documentation

◆ setValue()

void NumberPrefix::setValue ( const Number nr)

Sets the value of the prefix.

Parameters
nrNew value for the prefix.

◆ type()

int NumberPrefix::type ( ) const
virtual

Returns type, subclass, of the prefix. This can be PREFIX_DECIMAL for prefixes of the class DecimalPrefix, PREFIX_BINARY for BinaryPrefix, or PREFIX_NUMBER for NumberPrefix.

Returns
The type of the prefix.

Implements Prefix.

◆ value() [1/3]

Number NumberPrefix::value ( ) const
virtual

Returns the value of the prefix.

Returns
The value of the prefix.

Implements Prefix.

◆ value() [2/3]

Number NumberPrefix::value ( const Number nexp) const
virtual

Returns the value of the prefix.

Parameters
nexpThe power of the prefixed unit.
Returns
The value of the prefix.

Implements Prefix.

◆ value() [3/3]

Number NumberPrefix::value ( int  iexp) const
virtual

Returns the value of the prefix.

Parameters
iexpThe power of the prefixed unit.
Returns
The value of the prefix.

Implements Prefix.


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