IntValue.cpp
Go to the documentation of this file.
#include "IntValue.h"
#include "HazelnuppException.h"
#include <sstream>
using namespace Hazelnp;
IntValue::IntValue(const long long int& value)
:
Value(DATA_TYPE::INT),
value { value }
{
return;
}
Value* IntValue::Deepcopy() const
{
return new IntValue(value);
}
std::string IntValue::GetAsOsString() const
{
std::stringstream ss;
ss << "IntValue: " << value;
return ss.str();
}
const long long int& IntValue::GetValue() const
{
return value;
}
IntValue::operator long long int() const
{
return value;
}
IntValue::operator int() const
{
return (int)value;
}
long long int IntValue::GetInt64() const
{
return value;
}
int IntValue::GetInt32() const
{
return (int)value;
}
long double IntValue::GetFloat64() const
{
return (long double)value;
}
double IntValue::GetFloat32() const
{
return (double)value;
}
std::string IntValue::GetString() const
{
std::stringstream ss;
ss << value;
return ss.str();
}
const std::vector<Value*>& IntValue::GetList() const
{
throw HazelnuppValueNotConvertibleException();
}
HazelnuppException.h
Hazelnp::IntValue::GetAsOsString
std::string GetAsOsString() const override
Will return a string suitable for an std::ostream;.
Definition: IntValue.cpp:20
Hazelnp
Definition: DataType.h:3
Hazelnp::IntValue::GetFloat32
double GetFloat32() const override
Will return the data as a double.
Definition: IntValue.cpp:59
IntValue.h
Hazelnp::IntValue::IntValue
IntValue(const long long int &value)
Definition: IntValue.cpp:7
Hazelnp::Value
Abstract class for values.
Definition: Value.h:10
Hazelnp::IntValue::GetInt32
int GetInt32() const override
Will return the data as an int.
Definition: IntValue.cpp:49
Hazelnp::IntValue::GetList
const std::vector< Value * > & GetList() const override
Throws HazelnuppValueNotConvertibleException.
Definition: IntValue.cpp:72
Hazelnp::IntValue::GetFloat64
long double GetFloat64() const override
Will return the data as a long double.
Definition: IntValue.cpp:54
Hazelnp::IntValue::GetString
std::string GetString() const override
Will return the data as a string.
Definition: IntValue.cpp:64
Hazelnp::IntValue::GetInt64
long long int GetInt64() const override
Will return the data as a long long int.
Definition: IntValue.cpp:44
Hazelnp::IntValue::GetValue
const long long int & GetValue() const
Will return the raw value.
Definition: IntValue.cpp:27
Hazelnp::IntValue::Deepcopy
Value * Deepcopy() const override
Will return a deeopopy of this object.
Definition: IntValue.cpp:15
Hazelnp::DATA_TYPE::INT
@ INT
Hazelnp::DATA_TYPE
DATA_TYPE
The different data types a paramater can be.
Definition: DataType.h:7
Hazelnp::HazelnuppValueNotConvertibleException
Gets thrown when an attempt is made to retrieve the wrong data type from a value, when the value not ...
Definition: HazelnuppException.h:35