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

FloatValue.h
Go to the documentation of this file.
1 #pragma once
2 #include "Value.h"
3 #include <ostream>
4
5 namespace Hazelnp
6 {
7 /** Specializations for floating point values (uses long double)
8 */
9 class FloatValue : public Value
10 {
11 public:
12 FloatValue(const long double& value);
13 ~FloatValue() override {};
14
15 //! Will return a deeopopy of this object
16 Value* Deepcopy() const override;
17
18 //! Will return a string suitable for an std::ostream;
19 std::string GetAsOsString() const override;
20
21 //! Will return the raw value
22 const long double& GetValue() const;
23
24 operator long double() const;
25 operator double() const;
26
27 //! Will return the data as a long long int
28 long long int GetInt64() const override;
29 //! Will return the data as an int
30 int GetInt32() const override;
31
32 //! Will return the data as a long double
33 long double GetFloat64() const override;
34 //! Will return the data as a double
35 double GetFloat32() const override;
36
37 //! Will return the data as a string
38 std::string GetString() const override;
39
40 //! Throws HazelnuppValueNotConvertibleException
41 const std::vector<Value*>& GetList() const override;
42
43 private:
44 long double value;
45 };
46 }
Hazelnp::FloatValue::GetFloat64
long double GetFloat64() const override
Will return the data as a long double.
Definition: FloatValue.cpp:54
Hazelnp
Definition: CmdArgsInterface.h:9
Hazelnp::FloatValue::~FloatValue
~FloatValue() override
Definition: FloatValue.h:13
Hazelnp::FloatValue::GetString
std::string GetString() const override
Will return the data as a string.
Definition: FloatValue.cpp:64
Hazelnp::FloatValue::GetList
const std::vector< Value * > & GetList() const override
Throws HazelnuppValueNotConvertibleException.
Definition: FloatValue.cpp:72
Hazelnp::FloatValue::GetInt64
long long int GetInt64() const override
Will return the data as a long long int.
Definition: FloatValue.cpp:44
Hazelnp::FloatValue::GetAsOsString
std::string GetAsOsString() const override
Will return a string suitable for an std::ostream;.
Definition: FloatValue.cpp:20
Hazelnp::FloatValue::GetValue
const long double & GetValue() const
Will return the raw value.
Definition: FloatValue.cpp:27
Hazelnp::FloatValue
Specializations for floating point values (uses long double)
Definition: FloatValue.h:9
Hazelnp::Value
Abstract class for values.
Definition: Value.h:10
Hazelnp::FloatValue::Deepcopy
Value * Deepcopy() const override
Will return a deeopopy of this object.
Definition: FloatValue.cpp:15
Hazelnp::FloatValue::GetFloat32
double GetFloat32() const override
Will return the data as a double.
Definition: FloatValue.cpp:59
Hazelnp::FloatValue::FloatValue
FloatValue(const long double &value)
Definition: FloatValue.cpp:7
Value.h
Hazelnp::FloatValue::GetInt32
int GetInt32() const override
Will return the data as an int.
Definition: FloatValue.cpp:49