aboutsummaryrefslogtreecommitdiff
path: root/libbutl/json/serializer.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'libbutl/json/serializer.ixx')
-rw-r--r--libbutl/json/serializer.ixx36
1 files changed, 33 insertions, 3 deletions
diff --git a/libbutl/json/serializer.ixx b/libbutl/json/serializer.ixx
index 50fe397..a719ef6 100644
--- a/libbutl/json/serializer.ixx
+++ b/libbutl/json/serializer.ixx
@@ -1,3 +1,5 @@
+#include <cstring> // strlen()
+
namespace butl
{
namespace json
@@ -72,7 +74,7 @@ namespace butl
inline void buffer_serializer::
member_name (const char* n, bool c)
{
- next (event::name, {n, n != nullptr ? strlen (n) : 0}, c);
+ next (event::name, {n, n != nullptr ? std::strlen (n) : 0}, c);
}
inline void buffer_serializer::
@@ -81,6 +83,20 @@ namespace butl
next (event::name, {n.c_str (), n.size ()}, c);
}
+ inline void buffer_serializer::
+ member_begin_object (const char* n, bool c)
+ {
+ member_name (n, c);
+ begin_object ();
+ }
+
+ inline void buffer_serializer::
+ member_begin_object (const std::string& n, bool c)
+ {
+ member_name (n, c);
+ begin_object ();
+ }
+
template <typename T>
inline void buffer_serializer::
member (const char* n, const T& v, bool c)
@@ -104,6 +120,20 @@ namespace butl
}
inline void buffer_serializer::
+ member_begin_array (const char* n, bool c)
+ {
+ member_name (n, c);
+ begin_array ();
+ }
+
+ inline void buffer_serializer::
+ member_begin_array (const std::string& n, bool c)
+ {
+ member_name (n, c);
+ begin_array ();
+ }
+
+ inline void buffer_serializer::
end_array ()
{
next (event::end_array);
@@ -113,7 +143,7 @@ namespace butl
value (const char* v, bool c)
{
if (v != nullptr)
- next (event::string, {v, strlen (v)}, c);
+ next (event::string, {v, std::strlen (v)}, c);
else
next (event::null);
}
@@ -157,7 +187,7 @@ namespace butl
// Use event::number (which doesn't involve any quoting) with a disabled
// check.
//
- next (event::number, {v, strlen (v)}, false /* check */);
+ next (event::number, {v, std::strlen (v)}, false /* check */);
}
inline void buffer_serializer::