Skip to content
Snippets Groups Projects
Commit 04028cfb authored by Teena Chakkalayil Hassan's avatar Teena Chakkalayil Hassan
Browse files

Added conversion of JSON number format to int.

parent 0abe5e4f
No related branches found
No related tags found
No related merge requests found
......@@ -429,6 +429,8 @@ class PayloadEntryProxy//{{{
/// Conversion to std::string (explicit or implicit)
IPAACA_HEADER_EXPORT operator std::string();
/// Conversion to int (explicit or implicit)
IPAACA_HEADER_EXPORT operator int();
/// Conversion to long (explicit or implicit)
IPAACA_HEADER_EXPORT operator long();
/// Conversion to double (explicit or implicit)
......@@ -468,12 +470,18 @@ class PayloadEntryProxy//{{{
IPAACA_HEADER_EXPORT std::string to_str();
//long to_int() { return operator long(); ;
/// [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)")]]
IPAACA_HEADER_EXPORT long to_long();
/// [DECPRECATED] use normal type conversion syntax instead
[[deprecated("Use operator double() instead (i.e. explicit or implicit cast)")]]
IPAACA_HEADER_EXPORT double to_float();
/// [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)")]]
IPAACA_HEADER_EXPORT bool to_bool();
/// Append a supported type to a list-type payload value
......
......@@ -364,6 +364,10 @@ IPAACA_EXPORT PayloadEntryProxy::operator std::string()
{
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()
{
return json_value_cast<long>(json_value);
......@@ -380,6 +384,10 @@ IPAACA_EXPORT std::string PayloadEntryProxy::to_str()
{
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()
{
return json_value_cast<long>(json_value);
......@@ -388,6 +396,10 @@ IPAACA_EXPORT double PayloadEntryProxy::to_float()
{
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()
{
return json_value_cast<bool>(json_value);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment