3#include <Foundation/Containers/Bitfield.h>
4#include <Foundation/Containers/HybridArray.h>
5#include <Foundation/Strings/String.h>
6#include <Foundation/Strings/StringBuilder.h>
7#include <Foundation/Types/Bitflags.h>
8#include <Foundation/Types/Enum.h>
16 plUInt8 uiValue = bValue ? 1 : 0;
24 PL_VERIFY(inout_stream.
ReadBytes(&uiValue,
sizeof(plUInt8)) ==
sizeof(plUInt8),
"End of stream reached.");
25 out_bValue = (uiValue != 0);
39 PL_VERIFY(inout_stream.
ReadBytes(&out_uiValue,
sizeof(plUInt8)) ==
sizeof(plUInt8),
"End of stream reached.");
45 return inout_stream.
WriteBytes(pArray,
sizeof(plUInt8) * uiCount);
50 const plUInt64 uiNumBytes =
sizeof(plUInt8) * uiCount;
51 if (inout_stream.
ReadBytes(pArray, uiNumBytes) == uiNumBytes)
72 return inout_stream.
WriteBytes(pArray,
sizeof(plUInt16) * uiCount);
77 const plUInt64 uiNumBytes =
sizeof(plUInt16) * uiCount;
78 if (inout_stream.
ReadBytes(pArray, uiNumBytes) == uiNumBytes)
99 return inout_stream.
WriteBytes(pArray,
sizeof(plUInt32) * uiCount);
104 const plUInt64 uiNumBytes =
sizeof(plUInt32) * uiCount;
105 if (inout_stream.
ReadBytes(pArray, uiNumBytes) == uiNumBytes)
126 return inout_stream.
WriteBytes(pArray,
sizeof(plUInt64) * uiCount);
131 const plUInt64 uiNumBytes =
sizeof(plUInt64) * uiCount;
132 if (inout_stream.
ReadBytes(pArray, uiNumBytes) == uiNumBytes)
148 PL_VERIFY(inout_stream.
ReadBytes(
reinterpret_cast<plUInt8*
>(&ref_iValue),
sizeof(plInt8)) ==
sizeof(plInt8),
"End of stream reached.");
154 return inout_stream.
WriteBytes(pArray,
sizeof(plInt8) * uiCount);
159 const plUInt64 uiNumBytes =
sizeof(plInt8) * uiCount;
160 if (inout_stream.
ReadBytes(pArray, uiNumBytes) == uiNumBytes)
181 return inout_stream.
WriteBytes(pArray,
sizeof(plInt16) * uiCount);
186 const plUInt64 uiNumBytes =
sizeof(plInt16) * uiCount;
187 if (inout_stream.
ReadBytes(pArray, uiNumBytes) == uiNumBytes)
208 return inout_stream.
WriteBytes(pArray,
sizeof(plInt32) * uiCount);
213 const plUInt64 uiNumBytes =
sizeof(plInt32) * uiCount;
214 if (inout_stream.
ReadBytes(pArray, uiNumBytes) == uiNumBytes)
235 return inout_stream.
WriteBytes(pArray,
sizeof(plInt64) * uiCount);
240 const plUInt64 uiNumBytes =
sizeof(plInt64) * uiCount;
241 if (inout_stream.
ReadBytes(pArray, uiNumBytes) == uiNumBytes)
264 return inout_stream.
WriteBytes(pArray,
sizeof(
float) * uiCount);
269 const plUInt64 uiNumBytes =
sizeof(float) * uiCount;
270 if (inout_stream.
ReadBytes(pArray, uiNumBytes) == uiNumBytes)
291 return inout_stream.
WriteBytes(pArray,
sizeof(
double) * uiCount);
296 const plUInt64 uiNumBytes =
sizeof(double) * uiCount;
297 if (inout_stream.
ReadBytes(pArray, uiNumBytes) == uiNumBytes)
312template <plUInt16 Size,
typename AllocatorWrapper>
319template <plUInt16 Size,
typename AllocatorWrapper>
324 out_sValue = std::move(builder);
347 typename T::StorageType storedValue = T::Default;
348 inout_stream >> storedValue;
367 typename T::StorageType storedValue = T::Default;
368 inout_stream >> storedValue;
Interface for binary in (read) streams.
Definition Stream.h:22
plResult ReadWordValue(T *pWordValue)
Helper method to read a word value correctly (copes with potentially different endianess)
Definition Stream_inl.h:85
plResult ReadQWordValue(T *pQWordValue)
Helper method to read a qword value correctly (copes with potentially different endianess)
Definition Stream_inl.h:107
plResult ReadDWordValue(T *pDWordValue)
Helper method to read a dword value correctly (copes with potentially different endianess)
Definition Stream_inl.h:96
plResult ReadString(plStringBuilder &ref_sBuilder)
Reads a string into an plStringBuilder.
Definition Stream.cpp:10
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 ...
plResult WriteDWordValue(const T *pDWordValue)
Helper method to write a dword value correctly (copes with potentially different endianess)
Definition Stream_inl.h:126
plResult WriteWordValue(const T *pWordValue)
Helper method to write a word value correctly (copes with potentially different endianess)
Definition Stream_inl.h:118
plResult WriteString(const plStringView sStringView)
Writes a string.
Definition Stream.cpp:51
plResult WriteQWordValue(const T *pQWordValue)
Helper method to write a qword value correctly (copes with potentially different endianess)
Definition Stream_inl.h:134
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
The plBitflags class allows you to work with type-safe bitflags.
Definition Bitflags.h:82
PL_ALWAYS_INLINE void SetValue(StorageType value)
Overwrites the flags with a new value.
Definition Bitflags.h:205
PL_ALWAYS_INLINE StorageType GetValue() const
Returns the stored value as the underlying integer type.
Definition Bitflags.h:199
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
PL_ALWAYS_INLINE StorageType GetValue() const
Returns the enum value as an integer.
Definition Enum.h:98
PL_ALWAYS_INLINE void SetValue(StorageType value)
Sets the enum value through an integer.
Definition Enum.h:104
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
void AssertSuccess(const char *szMsg=nullptr, const char *szDetails=nullptr) const
Asserts that the function succeeded. In case of failure, the program will terminate.
Definition Status.cpp:7
plStringView GetView() const
Returns a string view to this string's data.
Definition StringBase_inl.h:329