diff options
| author | Stefan Boberg <[email protected]> | 2022-03-23 16:15:08 +0100 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2022-03-23 16:15:08 +0100 |
| commit | cfbe2e251e2cf174ff2474bc70f4e6b9551c4af2 (patch) | |
| tree | 9d6da6e33484be16cd0251b3781408deb14e2340 /zencore | |
| parent | added xmake file for zentest-appstub (diff) | |
| parent | Fixed wrong route pattern. (diff) | |
| download | zen-cfbe2e251e2cf174ff2474bc70f4e6b9551c4af2.tar.xz zen-cfbe2e251e2cf174ff2474bc70f4e6b9551c4af2.zip | |
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'zencore')
| -rw-r--r-- | zencore/compactbinary.cpp | 7 | ||||
| -rw-r--r-- | zencore/include/zencore/compactbinary.h | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/zencore/compactbinary.cpp b/zencore/compactbinary.cpp index 808e4f39a..cb628af4b 100644 --- a/zencore/compactbinary.cpp +++ b/zencore/compactbinary.cpp @@ -1701,6 +1701,13 @@ CompactBinaryToJson(const CbObjectView& Object, StringBuilderBase& Builder) Writer.WriteField(Object.AsFieldView()); } +void +CompactBinaryToJson(const CbArrayView& Array, StringBuilderBase& Builder) +{ + CbJsonWriter Writer(Builder); + Writer.WriteField(Array.AsFieldView()); +} + ////////////////////////////////////////////////////////////////////////// #if ZEN_WITH_TESTS 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(); } |