Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
CompactBinaryContainerSerialization.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Serialization/CompactBinary.h"
6#include "Serialization/CompactBinaryWriter.h"
7#include "Templates/Tuple.h"
8
9template <typename... Types>
10inline FCbWriter& operator<<(FCbWriter& Writer, const TTuple<Types...>& Tuple)
11{
12 Writer.BeginArray();
13 VisitTupleElements([&Writer](auto&& ElementValue) { Writer << ElementValue; }, Tuple);
14 Writer.EndArray();
15 return Writer;
16}
17
18template <typename... Types>
19inline bool LoadFromCompactBinary(FCbFieldView Field, TTuple<Types...>& Tuple)
20{
21 bool bOk = Field.AsArrayView().Num() == sizeof...(Types);
22 FCbFieldViewIterator ElementIterator = Field.CreateViewIterator();
23
24 VisitTupleElements([&ElementIterator, &bOk](auto&& ElementValue)
25 {
26 bOk = LoadFromCompactBinary(ElementIterator++, ElementValue) & bOk;
27 },
28 Tuple
29 );
30 return bOk;
31}
bool LoadFromCompactBinary(FCbFieldView Field, TTuple< Types... > &Tuple)