summaryrefslogtreecommitdiff
path: root/AK/JsonObject.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-10-29 16:36:50 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-10-29 16:36:50 +0100
commit014f8ca8c4a2b94ed177f9cdbe308aecaadc7f8a (patch)
tree2e3b786d5e8f1189219fc1f7faeef5b88b24d43b /AK/JsonObject.h
parent5442e365c9e9cbb43a4a86a71e92b52a1b4e8d81 (diff)
downloadserenity-014f8ca8c4a2b94ed177f9cdbe308aecaadc7f8a.zip
AK: Allow JsonValue to store 64-bit integers internally
Add dedicated internal types for Int64 and UnsignedInt64. This makes it a bit more straightforward to work with 64-bit numbers (instead of just implicitly storing them as doubles.)
Diffstat (limited to 'AK/JsonObject.h')
-rw-r--r--AK/JsonObject.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/AK/JsonObject.h b/AK/JsonObject.h
index 439f560aae..a69d2255b9 100644
--- a/AK/JsonObject.h
+++ b/AK/JsonObject.h
@@ -120,11 +120,17 @@ void JsonValue::serialize(Builder& builder) const
builder.appendf("%g", m_value.as_double);
break;
#endif
- case Type::Int:
- builder.appendf("%d", m_value.as_int);
+ case Type::Int32:
+ builder.appendf("%d", as_i32());
break;
- case Type::UnsignedInt:
- builder.appendf("%u", m_value.as_uint);
+ case Type::Int64:
+ builder.appendf("%lld", as_i64());
+ break;
+ case Type::UnsignedInt32:
+ builder.appendf("%u", as_u32());
+ break;
+ case Type::UnsignedInt64:
+ builder.appendf("%llu", as_u64());
break;
case Type::Undefined:
builder.append("undefined");