Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
ArchiveSaveCompressedProxy.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
6#include "CoreTypes.h"
7#include "Misc/Compression.h"
8#include "Misc/CompressionFlags.h"
9#include "Serialization/Archive.h"
10#include "UObject/NameTypes.h"
11
12/*----------------------------------------------------------------------------
13 FArchiveSaveCompressedProxy.
14----------------------------------------------------------------------------*/
15
16/**
17 * FArchive Proxy to transparently write out compressed data to an array.
18 */
20{
21 /**
22 * This enum and the following constructor is a workaround for VC compiler bug that prevents using attributes
23 * on constructors without inline implementation. This should be removed when the deprecated ctor is removed.
24 */
26 {
28 };
29 FArchiveSaveCompressedProxy(EVS2015Redirector, TArray<uint8>& InCompressedData, ECompressionFlags InCompressionFlags);
30
31public:
32 /**
33 * Constructor, initializing all member variables and allocating temp memory.
34 *
35 * @param InCompressedData [ref] Array of bytes that is going to hold compressed data
36 * @param InCompressionFormat Compression format to use
37 */
38 UE_DEPRECATED(4.21, "Use the FName version of FArchiveSaveCompressedProxy constructor")
39 FArchiveSaveCompressedProxy(TArray<uint8>& InCompressedData, ECompressionFlags InCompressionFlags)
40 // Make sure to remove the EVS2015Redirector constructor when this constructor is removed
42 {}
43 FArchiveSaveCompressedProxy( TArray<uint8>& InCompressedData, FName InCompressionFormat, ECompressionFlags InCompressionFlags=COMPRESS_None);
44
45 /** Destructor, flushing array if needed. Also frees temporary memory. */
47
48 /**
49 * Flushes tmp data to array.
50 */
51 virtual void Flush();
52
53 /**
54 * Serializes data to archive. This function is called recursively and determines where to serialize
55 * to and how to do so based on internal state.
56 *
57 * @param Data Pointer to serialize to
58 * @param Count Number of bytes to read
59 */
60 virtual void Serialize( void* Data, int64 Count );
61
62 /**
63 * Seeking is only implemented internally for writing out compressed data and asserts otherwise.
64 *
65 * @param InPos Position to seek to
66 */
67 virtual void Seek( int64 InPos );
68
69 /**
70 * @return current position in uncompressed stream in bytes.
71 */
72 virtual int64 Tell();
73
74private:
75 /** Array to write compressed data to. */
77 /** Current index in array. */
79 /** Pointer to start of temporary buffer. */
81 /** Pointer to end of temporary buffer. */
82 uint8* TmpDataEnd;
83 /** Pointer to current position in temporary buffer. */
84 uint8* TmpData;
85 /** Whether to serialize to temporary buffer of array. */
87 /** Number of raw (uncompressed) bytes serialized. */
89 /** Format to use for compression. */
91 /** Flags to use for compression. */
93};
ECompressionFlags
@ COMPRESS_None
#define UE_DEPRECATED(Version, Message)
FArchiveSaveCompressedProxy(EVS2015Redirector, TArray< uint8 > &InCompressedData, ECompressionFlags InCompressionFlags)
virtual void Seek(int64 InPos)
virtual ~FArchiveSaveCompressedProxy()
FArchiveSaveCompressedProxy(TArray< uint8 > &InCompressedData, FName InCompressionFormat, ECompressionFlags InCompressionFlags=COMPRESS_None)
virtual void Serialize(void *Data, int64 Count)
FArchiveSaveCompressedProxy(TArray< uint8 > &InCompressedData, ECompressionFlags InCompressionFlags)