Leonetienne/Hazelnupp
Simple, easy to use, command line parameter interface
FloatValue.cpp
Go to the documentation of this file.
3#include <sstream>
4
5using namespace Hazelnp;
6
7FloatValue::FloatValue(const long double& value)
8 :
10 value { value }
11{
12 return;
13}
14
16{
17 return new FloatValue(value);
18}
19
20std::string FloatValue::GetAsOsString() const
21{
22 std::stringstream ss;
23 ss << "FloatValue: " << value;
24 return ss.str();
25}
26
27const long double& FloatValue::GetValue() const
28{
29 return value;
30}
31
32FloatValue::operator long double() const
33{
34 return value;
35}
36
37FloatValue::operator double() const
38{
39 return (double)value;
40}
41
42
43
44long long int FloatValue::GetInt64() const
45{
46 return (long long int)value;
47}
48
50{
51 return (int)value;
52}
53
54long double FloatValue::GetFloat64() const
55{
56 return value;
57}
58
60{
61 return (double)value;
62}
63
64std::string FloatValue::GetString() const
65{
66 std::stringstream ss;
67 ss << value;
68
69 return ss.str();
70}
71
72const std::vector<Value*>& FloatValue::GetList() const
73{
75}
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
Gets thrown when an attempt is made to retrieve the wrong data type from a value, when the value not ...
Abstract class for values.
Definition: Value.h:11
DATA_TYPE
The different data types a paramater can be.
Definition: DataType.h:9