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