Added custom Exception HazelnuppValueNotConvertibleException
This commit is contained in:
parent
dbc02fab2e
commit
83285a297a
@ -1,4 +1,5 @@
|
|||||||
#include "FloatValue.h"
|
#include "FloatValue.h"
|
||||||
|
#include "HazelnuppException.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
FloatValue::FloatValue(const long double& value)
|
FloatValue::FloatValue(const long double& value)
|
||||||
@ -68,5 +69,5 @@ std::string FloatValue::GetString() const
|
|||||||
|
|
||||||
const std::vector<Value*>& FloatValue::GetList() const
|
const std::vector<Value*>& FloatValue::GetList() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
@ -33,7 +33,7 @@ public:
|
|||||||
//! Will return the data as a string
|
//! Will return the data as a string
|
||||||
std::string GetString() const override;
|
std::string GetString() const override;
|
||||||
|
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
const std::vector<Value*>& GetList() const override;
|
const std::vector<Value*>& GetList() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -26,6 +26,13 @@ public:
|
|||||||
HazelnuppInvalidKeyException(const std::string& msg) : HazelnuppException(msg) {};
|
HazelnuppInvalidKeyException(const std::string& msg) : HazelnuppException(msg) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class HazelnuppValueNotConvertibleException : public HazelnuppException
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HazelnuppValueNotConvertibleException() : HazelnuppException() {};
|
||||||
|
HazelnuppValueNotConvertibleException(const std::string& msg) : HazelnuppException(msg) {};
|
||||||
|
};
|
||||||
|
|
||||||
class HazelnuppConstraintException : public HazelnuppException
|
class HazelnuppConstraintException : public HazelnuppException
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "IntValue.h"
|
#include "IntValue.h"
|
||||||
|
#include "HazelnuppException.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
IntValue::IntValue(const long long int& value)
|
IntValue::IntValue(const long long int& value)
|
||||||
@ -68,5 +69,5 @@ std::string IntValue::GetString() const
|
|||||||
|
|
||||||
const std::vector<Value*>& IntValue::GetList() const
|
const std::vector<Value*>& IntValue::GetList() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
//! Will return the data as a string
|
//! Will return the data as a string
|
||||||
std::string GetString() const override;
|
std::string GetString() const override;
|
||||||
|
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
const std::vector<Value*>& GetList() const override;
|
const std::vector<Value*>& GetList() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "ListValue.h"
|
#include "ListValue.h"
|
||||||
|
#include "HazelnuppException.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
ListValue::ListValue() :
|
ListValue::ListValue() :
|
||||||
@ -65,27 +66,27 @@ ListValue::operator std::vector<Value*>() const
|
|||||||
|
|
||||||
long long int ListValue::GetInt64() const
|
long long int ListValue::GetInt64() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ListValue::GetInt32() const
|
int ListValue::GetInt32() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
long double ListValue::GetFloat64() const
|
long double ListValue::GetFloat64() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
double ListValue::GetFloat32() const
|
double ListValue::GetFloat32() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ListValue::GetString() const
|
std::string ListValue::GetString() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<Value*>& ListValue::GetList() const
|
const std::vector<Value*>& ListValue::GetList() const
|
||||||
|
@ -22,17 +22,17 @@ public:
|
|||||||
|
|
||||||
operator std::vector<Value*>() const;
|
operator std::vector<Value*>() const;
|
||||||
|
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
long long int GetInt64() const override;
|
long long int GetInt64() const override;
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
int GetInt32() const override;
|
int GetInt32() const override;
|
||||||
|
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
long double GetFloat64() const override;
|
long double GetFloat64() const override;
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
double GetFloat32() const override;
|
double GetFloat32() const override;
|
||||||
|
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
std::string GetString() const override;
|
std::string GetString() const override;
|
||||||
|
|
||||||
//! Will return this values list
|
//! Will return this values list
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "StringValue.h"
|
#include "StringValue.h"
|
||||||
|
#include "HazelnuppException.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
StringValue::StringValue(const std::string& value)
|
StringValue::StringValue(const std::string& value)
|
||||||
@ -35,22 +36,22 @@ StringValue::operator std::string() const
|
|||||||
|
|
||||||
long long int StringValue::GetInt64() const
|
long long int StringValue::GetInt64() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
int StringValue::GetInt32() const
|
int StringValue::GetInt32() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
long double StringValue::GetFloat64() const
|
long double StringValue::GetFloat64() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
double StringValue::GetFloat32() const
|
double StringValue::GetFloat32() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string StringValue::GetString() const
|
std::string StringValue::GetString() const
|
||||||
@ -60,5 +61,5 @@ std::string StringValue::GetString() const
|
|||||||
|
|
||||||
const std::vector<Value*>& StringValue::GetList() const
|
const std::vector<Value*>& StringValue::GetList() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
@ -19,20 +19,20 @@ public:
|
|||||||
|
|
||||||
operator std::string() const;
|
operator std::string() const;
|
||||||
|
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
long long int GetInt64() const override;
|
long long int GetInt64() const override;
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
int GetInt32() const override;
|
int GetInt32() const override;
|
||||||
|
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
long double GetFloat64() const override;
|
long double GetFloat64() const override;
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
double GetFloat32() const override;
|
double GetFloat32() const override;
|
||||||
|
|
||||||
//! Will return this value as a string
|
//! Will return this value as a string
|
||||||
std::string GetString() const override;
|
std::string GetString() const override;
|
||||||
|
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
const std::vector<Value*>& GetList() const override;
|
const std::vector<Value*>& GetList() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "VoidValue.h"
|
#include "VoidValue.h"
|
||||||
|
#include "HazelnuppException.h"
|
||||||
|
|
||||||
VoidValue::VoidValue()
|
VoidValue::VoidValue()
|
||||||
:
|
:
|
||||||
@ -21,30 +22,30 @@ std::string VoidValue::GetAsOsString() const
|
|||||||
|
|
||||||
long long int VoidValue::GetInt64() const
|
long long int VoidValue::GetInt64() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
int VoidValue::GetInt32() const
|
int VoidValue::GetInt32() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
long double VoidValue::GetFloat64() const
|
long double VoidValue::GetFloat64() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
double VoidValue::GetFloat32() const
|
double VoidValue::GetFloat32() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string VoidValue::GetString() const
|
std::string VoidValue::GetString() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<Value*>& VoidValue::GetList() const
|
const std::vector<Value*>& VoidValue::GetList() const
|
||||||
{
|
{
|
||||||
throw std::bad_cast();
|
throw HazelnuppValueNotConvertibleException();
|
||||||
}
|
}
|
||||||
|
@ -13,19 +13,19 @@ public:
|
|||||||
//! Will return a string suitable for an std::ostream;
|
//! Will return a string suitable for an std::ostream;
|
||||||
std::string GetAsOsString() const override;
|
std::string GetAsOsString() const override;
|
||||||
|
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
long long int GetInt64() const override;
|
long long int GetInt64() const override;
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
int GetInt32() const override;
|
int GetInt32() const override;
|
||||||
|
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
long double GetFloat64() const override;
|
long double GetFloat64() const override;
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
double GetFloat32() const override;
|
double GetFloat32() const override;
|
||||||
|
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
std::string GetString() const override;
|
std::string GetString() const override;
|
||||||
|
|
||||||
//! Throws std::bad_cast
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
const std::vector<Value*>& GetList() const;
|
const std::vector<Value*>& GetList() const;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user