| Leonetienne/Hazelnupp Simple, easy to use, command line parameter interface

Public Member Functions | List of all members
FloatValue Class Reference

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

`#include <FloatValue.h>`

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

## Public Member Functions
| FloatValue (const long double &value)
| ~FloatValue () override
Value * | Deepcopy () 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 Value
virtual | ~Value ()
DATA_TYPE | GetDataType () const
| Will return the data type of this value. More...

## Additional Inherited Members
Protected Member Functions inherited from Value
| Value (DATA_TYPE type)
Protected Attributes inherited from Value
DATA_TYPE | type

## Detailed Description

Specializations for floating point values (uses long double)

Definition at line 7 of file FloatValue.h.

## Constructor & Destructor Documentation

## ◆ FloatValue()

FloatValue::FloatValue | ( | const long double & | value | ) |

Definition at line 5 of file FloatValue.cpp.

6 :
7 Value(DATA_TYPE::FLOAT),
8 value { value }
9 {
10 return;
11 }

## ◆ ~FloatValue()

FloatValue::~FloatValue | ( |  | ) |
| inline override

Definition at line 11 of file FloatValue.h.

11 {};

## Member Function Documentation

## ◆ Deepcopy()

Value * FloatValue::Deepcopy | ( |  | ) | const
| override virtual

Will return a deeopopy of this object.

Implements Value.

Definition at line 13 of file FloatValue.cpp.

14 {
15 return new FloatValue(value);
16 }

## ◆ GetAsOsString()

std::string FloatValue::GetAsOsString | ( |  | ) | const
| override virtual

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

Implements Value.

Definition at line 18 of file FloatValue.cpp.

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

## ◆ GetFloat32()

double FloatValue::GetFloat32 | ( |  | ) | const
| override virtual

Will return the data as a double.

Implements Value.

Definition at line 57 of file FloatValue.cpp.

58 {
59 return (double)value;
60 }

## ◆ GetFloat64()

long double FloatValue::GetFloat64 | ( |  | ) | const
| override virtual

Will return the data as a long double.

Implements Value.

Definition at line 52 of file FloatValue.cpp.

53 {
54 return value;
55 }

## ◆ GetInt32()

int FloatValue::GetInt32 | ( |  | ) | const
| override virtual

Will return the data as an int.

Implements Value.

Definition at line 47 of file FloatValue.cpp.

48 {
49 return (int)value;
50 }

## ◆ GetInt64()

long long int FloatValue::GetInt64 | ( |  | ) | const
| override virtual

Will return the data as a long long int.

Implements Value.

Definition at line 42 of file FloatValue.cpp.

43 {
44 return (long long int)value;
45 }

## ◆ GetList()

const std::vector< Value * > & FloatValue::GetList | ( |  | ) | const
| override virtual

Throws HazelnuppValueNotConvertibleException.

Implements Value.

Definition at line 70 of file FloatValue.cpp.

71 {
72 throw HazelnuppValueNotConvertibleException();
73 }

## ◆ GetString()

std::string FloatValue::GetString | ( |  | ) | const
| override virtual

Will return the data as a string.

Implements Value.

Definition at line 62 of file FloatValue.cpp.

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

## ◆ GetValue()

const long double & FloatValue::GetValue | ( |  | ) | const

Will return the raw value.

Definition at line 25 of file FloatValue.cpp.

26 {
27 return value;
28 }

## ◆ operator double()

FloatValue::operator double | ( |  | ) | const

Definition at line 35 of file FloatValue.cpp.

36 {
37 return (double)value;
38 }

## ◆ operator long double()

FloatValue::operator long double | ( |  | ) | const

Definition at line 30 of file FloatValue.cpp.

31 {
32 return value;
33 }

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

- Hazelnupp/FloatValue.h
- Hazelnupp/FloatValue.cpp

DATA_TYPE::FLOAT
@ FLOAT
HazelnuppValueNotConvertibleException
Gets thrown when an attempt is made to retrieve the wrong data type from a value, when the value not ...
Definition: HazelnuppException.h:33
Value::Value
Value(DATA_TYPE type)
Definition: Value.cpp:3
FloatValue::FloatValue
FloatValue(const long double &value)
Definition: FloatValue.cpp:5