Leonetienne/Hazelnupp
Simple, easy to use, command line parameter interface
Public Member Functions | List of all members
Hazelnp::FloatValue Class Reference

Specializations for floating point values (uses long double) More...

#include <FloatValue.h>

Inheritance diagram for Hazelnp::FloatValue:
Inheritance graph
[legend]
Collaboration diagram for Hazelnp::FloatValue:
Collaboration graph
[legend]

Public Member Functions

 FloatValue (const long double &value)
 
 ~FloatValue () override
 
ValueDeepcopy () const override
 Will return a deeopopy of this object. More...
 
std::string GetAsOsString () const override
 Will return a string suitable for an std::ostream;. More...
 
const long double & GetValue () const
 Will return the raw value. More...
 
 operator long double () const
 
 operator double () const
 
long long int GetInt64 () const override
 Will return the data as a long long int. More...
 
int GetInt32 () const override
 Will return the data as an int. More...
 
long double GetFloat64 () const override
 Will return the data as a long double. More...
 
double GetFloat32 () const override
 Will return the data as a double. More...
 
std::string GetString () const override
 Will return the data as a string. More...
 
const std::vector< Value * > & GetList () const override
 Throws HazelnuppValueNotConvertibleException. More...
 
- Public Member Functions inherited from Hazelnp::Value
virtual ~Value ()
 
virtual ValueDeepcopy () const =0
 Will return a deeopopy of this object. More...
 
virtual std::string GetAsOsString () const =0
 Will return a string suitable for an std::ostream. More...
 
DATA_TYPE GetDataType () const
 Will return the data type of this value. More...
 
virtual long long int GetInt64 () const =0
 Will attempt to return the integer data (long long) More...
 
virtual int GetInt32 () const =0
 Will attempt to return the integer data (int) More...
 
virtual long double GetFloat64 () const =0
 Will attempt to return the floating-point data (long double) More...
 
virtual double GetFloat32 () const =0
 Will attempt to return the floating-point data (double) More...
 
virtual std::string GetString () const =0
 Will attempt to return the string-data. More...
 
virtual const std::vector< Value * > & GetList () const =0
 Will attempt to return the list-data. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Hazelnp::Value
 Value (DATA_TYPE type)
 
- Protected Attributes inherited from Hazelnp::Value
DATA_TYPE type
 

Detailed Description

Specializations for floating point values (uses long double)

Definition at line 9 of file FloatValue.h.

Constructor & Destructor Documentation

◆ FloatValue()

FloatValue::FloatValue ( const long double &  value)

Definition at line 7 of file FloatValue.cpp.

8 :
10 value { value }
11{
12 return;
13}
Value(DATA_TYPE type)
Definition: Value.cpp:5

◆ ~FloatValue()

Hazelnp::FloatValue::~FloatValue ( )
inlineoverride

Definition at line 13 of file FloatValue.h.

13{};

Member Function Documentation

◆ Deepcopy()

Value * FloatValue::Deepcopy ( ) const
overridevirtual

Will return a deeopopy of this object.

Implements Hazelnp::Value.

Definition at line 15 of file FloatValue.cpp.

16{
17 return new FloatValue(value);
18}
FloatValue(const long double &value)
Definition: FloatValue.cpp:7

◆ GetAsOsString()

std::string FloatValue::GetAsOsString ( ) const
overridevirtual

Will return a string suitable for an std::ostream;.

Implements Hazelnp::Value.

Definition at line 20 of file FloatValue.cpp.

21{
22 std::stringstream ss;
23 ss << "FloatValue: " << value;
24 return ss.str();
25}

◆ GetFloat32()

double FloatValue::GetFloat32 ( ) const
overridevirtual

Will return the data as a double.

Implements Hazelnp::Value.

Definition at line 59 of file FloatValue.cpp.

60{
61 return (double)value;
62}

◆ GetFloat64()

long double FloatValue::GetFloat64 ( ) const
overridevirtual

Will return the data as a long double.

Implements Hazelnp::Value.

Definition at line 54 of file FloatValue.cpp.

55{
56 return value;
57}

◆ GetInt32()

int FloatValue::GetInt32 ( ) const
overridevirtual

Will return the data as an int.

Implements Hazelnp::Value.

Definition at line 49 of file FloatValue.cpp.

50{
51 return (int)value;
52}

◆ GetInt64()

long long int FloatValue::GetInt64 ( ) const
overridevirtual

Will return the data as a long long int.

Implements Hazelnp::Value.

Definition at line 44 of file FloatValue.cpp.

45{
46 return (long long int)value;
47}

◆ GetList()

const std::vector< Value * > & FloatValue::GetList ( ) const
overridevirtual

Throws HazelnuppValueNotConvertibleException.

Implements Hazelnp::Value.

Definition at line 72 of file FloatValue.cpp.

73{
75}
Gets thrown when an attempt is made to retrieve the wrong data type from a value, when the value not ...

◆ GetString()

std::string FloatValue::GetString ( ) const
overridevirtual

Will return the data as a string.

Implements Hazelnp::Value.

Definition at line 64 of file FloatValue.cpp.

65{
66 std::stringstream ss;
67 ss << value;
68
69 return ss.str();
70}

◆ GetValue()

const long double & FloatValue::GetValue ( ) const

Will return the raw value.

Definition at line 27 of file FloatValue.cpp.

28{
29 return value;
30}

◆ operator double()

FloatValue::operator double ( ) const

Definition at line 37 of file FloatValue.cpp.

38{
39 return (double)value;
40}

◆ operator long double()

FloatValue::operator long double ( ) const

Definition at line 32 of file FloatValue.cpp.

33{
34 return value;
35}

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