4#include <Foundation/Basics.h>
5#include <Foundation/Containers/ArrayBase.h>
6#include <Foundation/Containers/HashTable.h>
7#include <Foundation/Containers/Map.h>
8#include <Foundation/Containers/Set.h>
9#include <Foundation/Containers/SmallArray.h>
10#include <Foundation/Math/Math.h>
11#include <Foundation/Memory/EndianHelper.h>
13using plTypeVersion = plUInt16;
15template <plUInt16 Size,
typename AllocatorWrapper>
34 virtual plUInt64
ReadBytes(
void* pReadBuffer, plUInt64 uiBytesToRead) = 0;
38 plResult ReadWordValue(T* pWordValue);
42 plResult ReadDWordValue(T* pDWordValue);
46 plResult ReadQWordValue(T* pQWordValue);
49 template <
typename ArrayType,
typename ValueType>
53 template <
typename ValueType, plUInt16 uiSize,
typename AllocatorWrapper>
57 template <
typename ValueType, plUInt32 uiSize>
58 plResult ReadArray(ValueType (&array)[uiSize]);
61 template <
typename KeyType,
typename Comparer>
65 template <
typename KeyType,
typename ValueType,
typename Comparer>
69 template <
typename KeyType,
typename ValueType,
typename Hasher>
82 plUInt8 uiTempBuffer[1024];
84 plUInt64 uiBytesSkipped = 0;
86 while (uiBytesSkipped < uiBytesToSkip)
90 plUInt64 uiBytesRead = ReadBytes(uiTempBuffer, uiBytesToRead);
92 uiBytesSkipped += uiBytesRead;
95 if (uiBytesRead < uiBytesToRead)
99 return uiBytesSkipped;
102 PL_ALWAYS_INLINE plTypeVersion ReadVersion(plTypeVersion expectedMaxVersion);
129 template <
typename T>
130 plResult WriteWordValue(
const T* pWordValue);
133 template <
typename T>
134 plResult WriteDWordValue(
const T* pDWordValue);
137 template <
typename T>
138 plResult WriteQWordValue(
const T* pQWordValue);
141 PL_ALWAYS_INLINE
void WriteVersion(plTypeVersion version);
144 template <
typename ArrayType,
typename ValueType>
148 template <
typename ValueType, plUInt16 uiSize>
152 template <
typename ValueType, plUInt32 uiSize>
153 plResult WriteArray(
const ValueType (&array)[uiSize]);
156 template <
typename KeyType,
typename Comparer>
160 template <
typename KeyType,
typename ValueType,
typename Comparer>
164 template <
typename KeyType,
typename ValueType,
typename Hasher>
172#include <Foundation/IO/Implementation/Stream_inl.h>
175#include <Foundation/IO/Implementation/StreamOperations_inl.h>
177#include <Foundation/IO/Implementation/StreamOperationsMath_inl.h>
179#include <Foundation/IO/Implementation/StreamOperationsOther_inl.h>
Base class for all array containers. Implements all the basic functionality that only requires a poin...
Definition ArrayBase.h:19
Implementation of a hashtable which stores key/value pairs.
Definition HashTable.h:157
An associative container. Similar to STL::map.
Definition Map.h:193
A set container that only stores whether an element resides in it or not. Similar to STL::set.
Definition Set.h:13
Implementation of a dynamically growing array with in-place storage and small memory overhead.
Definition SmallArray.h:17
Definition SmallArray.h:219
Interface for binary in (read) streams.
Definition Stream.h:22
virtual ~plStreamReader()
Virtual destructor to ensure correct cleanup.
virtual plUInt64 SkipBytes(plUInt64 uiBytesToSkip)
Helper method to skip a number of bytes (implementations of the stream reader may implement this more...
Definition Stream.h:80
plStreamReader()
Constructor.
virtual plUInt64 ReadBytes(void *pReadBuffer, plUInt64 uiBytesToRead)=0
Reads a raw number of bytes into the read buffer, this is the only method which has to be implemented...
Interface for binary out (write) streams.
Definition Stream.h:107
virtual plResult WriteBytes(const void *pWriteBuffer, plUInt64 uiBytesToWrite)=0
Writes a raw number of bytes from the buffer, this is the only method which has to be implemented to ...
virtual ~plStreamWriter()
Virtual destructor to ensure correct cleanup.
plStreamWriter()
Constructor.
virtual plResult Flush()
Flushes the stream, may be implemented (not necessary to implement the interface correctly) so that u...
Definition Stream.h:123
plStringBuilder is a class that is meant for creating and modifying strings.
Definition StringBuilder.h:35
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
constexpr PL_ALWAYS_INLINE T Min(T f1, T f2)
Returns the smaller value, f1 or f2.
Definition Math_inl.h:27
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54