Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
StructuredArchiveChildReader.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "HAL/Platform.h"
6#include "Misc/Build.h"
7#include "Misc/Optional.h"
8#include "Serialization/StructuredArchive.h"
9#include "Serialization/StructuredArchiveSlots.h"
10
13
14/**
15 * FStructuredArchiveChildReader
16 *
17 * Utility class for easily creating a structured archive that covers the data hierarchy underneath
18 * the given slot
19 *
20 * Allows serialization code to get an archive instance for the current location, so that it can return to it
21 * later on after the master archive has potentially moved on into a different location in the file.
22 */
24{
25public:
26 explicit FStructuredArchiveChildReader(FStructuredArchiveSlot InSlot);
28
29 // Non-copyable
34
35 FORCEINLINE FStructuredArchiveSlot GetRoot() const
36 {
37 return Root.GetValue();
38 }
39
40private:
43 TOptional<FStructuredArchiveSlot> Root;
44};
45
47
48FORCEINLINE FStructuredArchiveChildReader::FStructuredArchiveChildReader(FStructuredArchiveSlot InSlot)
49 : OwnedFormatter(nullptr)
50 , StructuredArchive(nullptr)
51{
52 StructuredArchive = new FStructuredArchive(InSlot.StructuredArchive.Formatter);
53 Root.Emplace(StructuredArchive->Open());
54}
55
56FORCEINLINE FStructuredArchiveChildReader::~FStructuredArchiveChildReader()
57{
58 delete StructuredArchive;
59}
60
61#endif
#define WITH_TEXT_ARCHIVE_SUPPORT
Definition Build.h:170
#define FORCEINLINE
Definition Platform.h:644
FStructuredArchiveChildReader(FStructuredArchiveSlot InSlot)
FStructuredArchiveFormatter * OwnedFormatter
FStructuredArchiveChildReader & operator=(const FStructuredArchiveChildReader &)=delete
TOptional< FStructuredArchiveSlot > Root
FORCEINLINE FStructuredArchiveSlot GetRoot() const
FStructuredArchiveChildReader(FStructuredArchiveChildReader &&)=delete
FStructuredArchiveChildReader(const FStructuredArchiveChildReader &)=delete
FStructuredArchiveChildReader & operator=(FStructuredArchiveChildReader &&)=delete