aboutsummaryrefslogtreecommitdiff
path: root/libbutl/json/serializer.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-03-28 10:02:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-03-28 10:02:45 +0200
commit96dfc87c05110c3d857fe6d1c6eaeb139e91826c (patch)
tree1ab30f6a88f428b89f3e19a94c7755bf63a4d1b7 /libbutl/json/serializer.ixx
parentd37263139e511b3dbfea2bd355f5edd779a71324 (diff)
Add member_begin_{object,array}() shortcuts to JSON serializer
Diffstat (limited to 'libbutl/json/serializer.ixx')
-rw-r--r--libbutl/json/serializer.ixx28
1 files changed, 28 insertions, 0 deletions
diff --git a/libbutl/json/serializer.ixx b/libbutl/json/serializer.ixx
index 50fe397..ac6ea22 100644
--- a/libbutl/json/serializer.ixx
+++ b/libbutl/json/serializer.ixx
@@ -81,6 +81,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 +118,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);