Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
BufferArchive.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "Containers/Array.h"
7#include "Containers/UnrealString.h"
8#include "UObject/NameTypes.h"
9#include "Serialization/MemoryWriter.h"
10
11/**
12 * Buffer archiver.
13 */
14template <int IndexSize>
15class TBufferArchive : public TMemoryWriter<IndexSize>, public TArray<uint8, TSizedDefaultAllocator<IndexSize>>
16{
17 static_assert(IndexSize == 32 || IndexSize == 64, "Only 32-bit and 64-bit index sizes supported");
18
19public:
20 using ArrayType = TArray<uint8, TSizedDefaultAllocator<IndexSize>>;
21
22 TBufferArchive( bool bIsPersistent = false, const FName InArchiveName = NAME_None )
23 : TMemoryWriter<IndexSize>( *static_cast<ArrayType*>(this), bIsPersistent, false, InArchiveName )
24 {}
25 /**
26 * Returns the name of the Archive. Useful for getting the name of the package a struct or object
27 * is in when a loading error occurs.
28 *
29 * This is overridden for the specific Archive Types
30 **/
31 virtual FString GetArchiveName() const
32 {
33 if constexpr (IndexSize == 64)
34 {
35 return TEXT("FBufferArchive64 ") + this->ArchiveName.ToString();
36 }
37 else
38 {
39 return TEXT("FBufferArchive ") + this->ArchiveName.ToString();
40 }
41 }
42};
43
44// FBufferArchive and FBufferArchive64 are implemented as derived classes rather than aliases
45// so that forward declarations will work.
46
48{
49 using Super = TBufferArchive<32>;
50
51public:
52 using Super::Super;
53};
54
56{
57 using Super = TBufferArchive<64>;
58
59public:
60 using Super::Super;
61};
62
63
64template <>
66{
68};
69
70template <>
72{
74};
#define TEXT(x)
Definition Platform.h:1108
TBufferArchive(bool bIsPersistent=false, const FName InArchiveName=NAME_None)
virtual FString GetArchiveName() const