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