Skip to content
Snippets Groups Projects
Commit 190b9e69 authored by Hendrik Buschmeier's avatar Hendrik Buschmeier
Browse files

Merge branch 'json-payload-int' into 'master'

Added conversion of JSON number format to int.

See merge request !1
parents 0abe5e4f 04028cfb
No related branches found
No related tags found
1 merge request!1Added conversion of JSON number format to int.
...@@ -429,6 +429,8 @@ class PayloadEntryProxy//{{{ ...@@ -429,6 +429,8 @@ class PayloadEntryProxy//{{{
/// Conversion to std::string (explicit or implicit) /// Conversion to std::string (explicit or implicit)
IPAACA_HEADER_EXPORT operator std::string(); IPAACA_HEADER_EXPORT operator std::string();
/// Conversion to int (explicit or implicit)
IPAACA_HEADER_EXPORT operator int();
/// Conversion to long (explicit or implicit) /// Conversion to long (explicit or implicit)
IPAACA_HEADER_EXPORT operator long(); IPAACA_HEADER_EXPORT operator long();
/// Conversion to double (explicit or implicit) /// Conversion to double (explicit or implicit)
...@@ -468,12 +470,18 @@ class PayloadEntryProxy//{{{ ...@@ -468,12 +470,18 @@ class PayloadEntryProxy//{{{
IPAACA_HEADER_EXPORT std::string to_str(); IPAACA_HEADER_EXPORT std::string to_str();
//long to_int() { return operator long(); ; //long to_int() { return operator long(); ;
/// [DECPRECATED] use normal type conversion syntax instead /// [DECPRECATED] use normal type conversion syntax instead
[[deprecated("Use operator int() instead (i.e. explicit or implicit cast)")]]
IPAACA_HEADER_EXPORT int to_int();
/// [DECPRECATED] use normal type conversion syntax instead
[[deprecated("Use operator long() instead (i.e. explicit or implicit cast)")]] [[deprecated("Use operator long() instead (i.e. explicit or implicit cast)")]]
IPAACA_HEADER_EXPORT long to_long(); IPAACA_HEADER_EXPORT long to_long();
/// [DECPRECATED] use normal type conversion syntax instead /// [DECPRECATED] use normal type conversion syntax instead
[[deprecated("Use operator double() instead (i.e. explicit or implicit cast)")]] [[deprecated("Use operator double() instead (i.e. explicit or implicit cast)")]]
IPAACA_HEADER_EXPORT double to_float(); IPAACA_HEADER_EXPORT double to_float();
/// [DECPRECATED] use normal type conversion syntax instead /// [DECPRECATED] use normal type conversion syntax instead
[[deprecated("Use operator double() instead (i.e. explicit or implicit cast)")]]
IPAACA_HEADER_EXPORT double to_double();
/// [DECPRECATED] use normal type conversion syntax instead
[[deprecated("Use operator bool() instead (i.e. explicit or implicit cast)")]] [[deprecated("Use operator bool() instead (i.e. explicit or implicit cast)")]]
IPAACA_HEADER_EXPORT bool to_bool(); IPAACA_HEADER_EXPORT bool to_bool();
/// Append a supported type to a list-type payload value /// Append a supported type to a list-type payload value
......
...@@ -364,6 +364,10 @@ IPAACA_EXPORT PayloadEntryProxy::operator std::string() ...@@ -364,6 +364,10 @@ IPAACA_EXPORT PayloadEntryProxy::operator std::string()
{ {
return json_value_cast<std::string>(json_value); return json_value_cast<std::string>(json_value);
} }
IPAACA_EXPORT PayloadEntryProxy::operator int()
{
return json_value_cast<int>(json_value);
}
IPAACA_EXPORT PayloadEntryProxy::operator long() IPAACA_EXPORT PayloadEntryProxy::operator long()
{ {
return json_value_cast<long>(json_value); return json_value_cast<long>(json_value);
...@@ -380,6 +384,10 @@ IPAACA_EXPORT std::string PayloadEntryProxy::to_str() ...@@ -380,6 +384,10 @@ IPAACA_EXPORT std::string PayloadEntryProxy::to_str()
{ {
return json_value_cast<std::string>(json_value); return json_value_cast<std::string>(json_value);
} }
IPAACA_EXPORT int PayloadEntryProxy::to_int()
{
return json_value_cast<int>(json_value);
}
IPAACA_EXPORT long PayloadEntryProxy::to_long() IPAACA_EXPORT long PayloadEntryProxy::to_long()
{ {
return json_value_cast<long>(json_value); return json_value_cast<long>(json_value);
...@@ -388,6 +396,10 @@ IPAACA_EXPORT double PayloadEntryProxy::to_float() ...@@ -388,6 +396,10 @@ IPAACA_EXPORT double PayloadEntryProxy::to_float()
{ {
return json_value_cast<double>(json_value); return json_value_cast<double>(json_value);
} }
IPAACA_EXPORT double PayloadEntryProxy::to_double()
{
return json_value_cast<double>(json_value);
}
IPAACA_EXPORT bool PayloadEntryProxy::to_bool() IPAACA_EXPORT bool PayloadEntryProxy::to_bool()
{ {
return json_value_cast<bool>(json_value); return json_value_cast<bool>(json_value);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment