aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2022-03-23 13:45:49 +0100
committerPer Larsson <[email protected]>2022-03-23 13:45:49 +0100
commite41d74d85c9d0132d864b4ac6f1a3ba10194ce99 (patch)
tree9859ab2779abd385d77f588283ec2103262e0555 /zencore/include
parentSkip zenserver-test exec.basic test since it tries to access a non-existent f... (diff)
downloadzen-e41d74d85c9d0132d864b4ac6f1a3ba10194ce99.tar.xz
zen-e41d74d85c9d0132d864b4ac6f1a3ba10194ce99.zip
Added ToJson for compact binary array.
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/compactbinary.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/zencore/include/zencore/compactbinary.h b/zencore/include/zencore/compactbinary.h
index 66fa3065d..8985144dd 100644
--- a/zencore/include/zencore/compactbinary.h
+++ b/zencore/include/zencore/compactbinary.h
@@ -870,6 +870,11 @@ private:
};
/**
+ * Serialize a compact binary array to JSON.
+ */
+ZENCORE_API void CompactBinaryToJson(const CbArrayView& Object, StringBuilderBase& Builder);
+
+/**
* Array of CbField that have no names.
*
* Accessing a field of the array requires iteration. Access by index is not provided because the
@@ -941,6 +946,12 @@ public:
/** Returns a view of the array, including the type and name when present. */
using CbFieldView::GetView;
+ StringBuilderBase& ToJson(StringBuilderBase& Builder) const
+ {
+ CompactBinaryToJson(*this, Builder);
+ return Builder;
+ }
+
private:
friend inline CbFieldViewIterator begin(const CbArrayView& Array) { return Array.CreateViewIterator(); }
friend inline CbFieldViewIterator end(const CbArrayView&) { return CbFieldViewIterator(); }