8class ReadOnlyBinaryStream {
12 ::std::string mOwnedBuffer;
13 ::std::string_view mView;
18 ReadOnlyBinaryStream(::std::string_view
buffer,
bool copyBuffer)
21 mHasOverflowed(
false) {
23 mOwnedBuffer = std::string(
buffer);
30 if (mHasOverflowed || mView.size() != mReadPointer) {
31 return nonstd::make_unexpected(
41 virtual ~ReadOnlyBinaryStream();
43 virtual ::Bedrock::Result<void> read(
void* target, uint64 num);
49 MCAPI ::Bedrock::Result<bool> getBool();
51 MCAPI ::Bedrock::Result<uchar> getByte();
53 MCAPI ::Bedrock::Result<double> getDouble();
55 MCAPI ::Bedrock::Result<float> getFloat();
59 MCAPI ::Bedrock::Result<int> getSignedBigEndianInt();
61 MCAPI ::Bedrock::Result<schar> getSignedByte();
63 MCAPI ::Bedrock::Result<int> getSignedInt();
65 MCAPI ::Bedrock::Result<int64> getSignedInt64();
67 MCAPI ::Bedrock::Result<short> getSignedShort();
69 MCAPI ::Bedrock::Result<::std::string> getString(uint64 maxLength);
71 MCAPI ::Bedrock::Result<void> getString(::std::string& outStringStream, uint64 maxLength);
73 MCAPI ::Bedrock::Result<uchar> getUnsignedChar();
75 MCAPI ::Bedrock::Result<uint> getUnsignedInt();
77 MCAPI ::Bedrock::Result<uint64> getUnsignedInt64();
79 MCAPI ::Bedrock::Result<ushort> getUnsignedShort();
81 MCAPI ::Bedrock::Result<uint> getUnsignedVarInt();
83 MCAPI ::Bedrock::Result<uint64> getUnsignedVarInt64();
85 MCAPI ::Bedrock::Result<int> getVarInt();
87 MCAPI ::Bedrock::Result<int64> getVarInt64();
99 MCAPI ::Bedrock::Result<void> $read(
void* target, uint64 num);