1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:47:35 +00:00

AK: Add JsonValue(unsigned) ctor and as_string().

This commit is contained in:
Andreas Kling 2019-06-18 08:55:58 +02:00
parent 114768562a
commit 1a761ea4fd
2 changed files with 19 additions and 0 deletions

View file

@ -65,6 +65,17 @@ JsonValue::JsonValue(int value)
m_value.as_int = value;
}
JsonValue::JsonValue(unsigned value)
{
if (value > INT32_MAX) {
m_type = Type::Double;
m_value.as_double = value;
} else {
m_type = Type::Int;
m_value.as_int = (int)value;
}
}
JsonValue::JsonValue(double value)
: m_type(Type::Double)
{