5#include "Compression/CompressedBuffer.h"
6#include "Containers/Array.h"
7#include "Containers/ContainersFwd.h"
10#include "Memory/CompositeBuffer.h"
11#include "Memory/SharedBuffer.h"
12#include "Misc/AssertionMacros.h"
13#include "Misc/TVariant.h"
14#include "Serialization/CompactBinary.h"
15#include "Templates/Function.h"
16#include "Templates/UnrealTemplate.h"
20template <
typename FuncType>
class TFunctionRef;
25
26
27
28
29
30
31
32
33
34
35
36
52 template <
typename BufferType,
decltype(FCompositeBuffer(DeclVal<BufferType>().MakeOwned()))* =
nullptr>
59 template <
typename BufferType,
decltype(FCompositeBuffer(DeclVal<BufferType>().MakeOwned()))* =
nullptr>
60 inline explicit FBinaryValue(BufferType&& InBuffer,
const FIoHash& InHash)
68 template <
typename... ArgTypes,
decltype(
FBinaryValue(DeclVal<ArgTypes>()...))* =
nullptr>
93 template <
typename BufferType,
decltype(
FBinaryValue(DeclVal<BufferType>().MakeOwned()))* =
nullptr>
96 template <
typename BufferType,
decltype(
FBinaryValue(DeclVal<BufferType>().MakeOwned()))* =
nullptr>
97 inline explicit FCbAttachment(BufferType&& InValue,
const FIoHash& InHash)
104 if (Value.Get<FCompressedBuffer>().IsNull())
106 Value.Emplace<TYPE_OF_NULLPTR>();
114 if (Value.Get<FCompressedBuffer>().IsNull())
116 Value.Emplace<TYPE_OF_NULLPTR>();
139 inline bool IsNull()
const {
return Value.IsType<TYPE_OF_NULLPTR>(); }
142 inline bool IsObject()
const {
return Value.IsType<FObjectValue>(); }
145 inline bool IsBinary()
const {
return Value.IsType<FBinaryValue>(); }
159
160
161
162
163
164
168
169
170
171
172
173
174
175
191 return GetTypeHash(Attachment.GetHash());
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
222
223
224
225
232
233
234
235
242
243
244
245
246
249 SetObject(MoveTemp(InObject), InResolver);
253
254
255
256
257
260 SetObject(MoveTemp(InObject), InObjectHash);
264
265
266
267
268
269
270 inline explicit FCbPackage(
FCbObject InObject,
const FIoHash& InObjectHash, FAttachmentResolver InResolver)
272 SetObject(MoveTemp(InObject), InObjectHash, InResolver);
282 inline bool IsNull()
const {
return !Object && Attachments.IsEmpty(); }
285 inline const FCbObject& GetObject()
const {
return Object; }
291
292
293
294
301
302
303
304
305
308 SetObject(MoveTemp(InObject),
nullptr, &InResolver);
312
313
314
315
316
319 SetObject(MoveTemp(InObject), &InObjectHash,
nullptr);
323
324
325
326
327
328
329 inline void SetObject(
FCbObject InObject,
const FIoHash& InObjectHash, FAttachmentResolver InResolver)
331 SetObject(MoveTemp(InObject), &InObjectHash, &InResolver);
338
339
340
341
342
360 AddAttachment(Attachment, &Resolver);
364
365
366
367
377
378
379
380
381
382
383
387
388
389
390
391
392
393
394
419 if (
const FObjectValue* ObjectValue = Value.TryGet<FObjectValue>())
421 return ObjectValue->Object;
428 if (
const FBinaryValue* BinaryValue = Value.TryGet<FBinaryValue>())
430 return BinaryValue->Buffer.ToShared();
432 return FSharedBuffer();
437 if (
const FBinaryValue* BinaryValue = Value.TryGet<FBinaryValue>())
439 return BinaryValue->Buffer;
441 return FCompositeBuffer::Null;
446 if (
const FCompressedBuffer* CompressedBuffer = Value.TryGet<FCompressedBuffer>())
448 return *CompressedBuffer;
450 return FCompressedBuffer::Null;
uint32 GetTypeHash(const FCbAttachment &Attachment)
FCbAttachment(FCompressedBuffer &&InValue)
TVariant< TYPE_OF_NULLPTR, FObjectValue, FBinaryValue, FCompressedBuffer > Value
void Save(FCbWriter &Writer) const
FCbAttachment(const FCbObject &InValue, const FIoHash &Hash)
const FCompositeBuffer & AsCompositeBinary() const
bool operator==(const FCbAttachment &Attachment) const
const FCompressedBuffer & AsCompressedBinary() const
FCbAttachment(TInPlaceType< FBinaryValue >, ArgTypes &&... Args)
FCbAttachment(FCbObject &&InValue)
FCbObject AsObject() const
bool operator<(const FCbAttachment &Attachment) const
FSharedBuffer AsBinary() const
void Save(FArchive &Ar) const
bool TryLoad(FCbFieldIterator &Fields)
bool operator!=(const FCbAttachment &Attachment) const
bool TryLoad(FArchive &Ar, FCbBufferAllocator Allocator=FUniqueBuffer::Alloc)
FCbAttachment(const FCompressedBuffer &InValue)
FCbAttachment(BufferType &&InValue, const FIoHash &InHash)
FCbAttachment(const FCbObject &InValue)
FCbAttachment(BufferType &&InValue)
bool IsCompressedBinary() const
FCbAttachment(FCbObject &&InValue, const FIoHash &Hash)
FCbPackage(FCbObject InObject, FAttachmentResolver InResolver)
bool TryLoad(FCbFieldIterator &Fields)
bool Equals(const FCbPackage &Package) const
bool operator==(const FCbPackage &Package) const
void AddAttachment(const FCbAttachment &Attachment, FAttachmentResolver *Resolver)
int32 RemoveAttachment(const FCbAttachment &Attachment)
void SetObject(FCbObject Object, const FIoHash *Hash, FAttachmentResolver *Resolver)
const FCbAttachment * FindAttachment(const FCbAttachment &Attachment) const
void SetObject(FCbObject InObject, const FIoHash &InObjectHash)
TArray< FCbAttachment > Attachments
FCbPackage(FCbObject InObject)
FCbPackage(FCbObject InObject, const FIoHash &InObjectHash)
void SetObject(FCbObject InObject)
TConstArrayView< FCbAttachment > GetAttachments() const
void SetObject(FCbObject InObject, const FIoHash &InObjectHash, FAttachmentResolver InResolver)
void Save(FArchive &Ar) const
const FIoHash & GetObjectHash() const
int32 RemoveAttachment(const FIoHash &Hash)
const FCbAttachment * FindAttachment(const FIoHash &Hash) const
FCbPackage(FCbObject InObject, const FIoHash &InObjectHash, FAttachmentResolver InResolver)
bool operator!=(const FCbPackage &Package) const
bool TryLoad(FArchive &Ar, FCbBufferAllocator Allocator=FUniqueBuffer::Alloc)
void AddAttachment(const FCbAttachment &Attachment)
void GatherAttachments(const FCbObject &Object, FAttachmentResolver Resolver)
void Save(FCbWriter &Writer) const
void SetObject(FCbObject InObject, FAttachmentResolver InResolver)
void AddAttachment(const FCbAttachment &Attachment, FAttachmentResolver Resolver)
FBinaryValue(BufferType &&InBuffer)
FBinaryValue(BufferType &&InBuffer, const FIoHash &InHash)
FObjectValue(FCbObject &&Object, const FIoHash *Hash)