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