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
5namespace 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}
Specializations for floating point values (uses long double)
Definition: FloatValue.h:10
~FloatValue() override
Definition: FloatValue.h:13
double GetFloat32() const override
Will return the data as a double.
Definition: FloatValue.cpp:59
const long double & GetValue() const
Will return the raw value.
Definition: FloatValue.cpp:27
int GetInt32() const override
Will return the data as an int.
Definition: FloatValue.cpp:49
const std::vector< Value * > & GetList() const override
Throws HazelnuppValueNotConvertibleException.
Definition: FloatValue.cpp:72
FloatValue(const long double &value)
Definition: FloatValue.cpp:7
std::string GetAsOsString() const override
Will return a string suitable for an std::ostream;.
Definition: FloatValue.cpp:20
long long int GetInt64() const override
Will return the data as a long long int.
Definition: FloatValue.cpp:44
Value * Deepcopy() const override
Will return a deeopopy of this object.
Definition: FloatValue.cpp:15
long double GetFloat64() const override
Will return the data as a long double.
Definition: FloatValue.cpp:54
std::string GetString() const override
Will return the data as a string.
Definition: FloatValue.cpp:64
Abstract class for values.
Definition: Value.h:11