mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:47:34 +00:00
AK: Add Endian.h header to replace NetworkOrdered.h.
This commit is contained in:
parent
ecf6cbbd02
commit
10c6f062b3
20 changed files with 195 additions and 106 deletions
30
AK/Stream.h
30
AK/Stream.h
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Concepts.h>
|
||||
#include <AK/Endian.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/MemMem.h>
|
||||
#include <AK/Span.h>
|
||||
|
@ -74,6 +75,35 @@ class DuplexStream
|
|||
, public OutputStream {
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
InputStream& operator>>(InputStream& stream, LittleEndian<T>& value)
|
||||
{
|
||||
T temporary;
|
||||
stream >> temporary;
|
||||
value = temporary;
|
||||
return stream;
|
||||
}
|
||||
template<typename T>
|
||||
InputStream& operator<<(InputStream& stream, LittleEndian<T> value)
|
||||
{
|
||||
stream << static_cast<T>(value);
|
||||
return stream;
|
||||
}
|
||||
template<typename T>
|
||||
InputStream& operator>>(InputStream& stream, BigEndian<T>& value)
|
||||
{
|
||||
T temporary;
|
||||
stream >> temporary;
|
||||
value = temporary;
|
||||
return stream;
|
||||
}
|
||||
template<typename T>
|
||||
InputStream& operator<<(InputStream& stream, BigEndian<T> value)
|
||||
{
|
||||
stream << static_cast<T>(value);
|
||||
return stream;
|
||||
}
|
||||
|
||||
#if defined(__cpp_concepts) && !defined(__COVERITY__)
|
||||
template<Concepts::Integral Integral>
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue