10#include <aws/io/stream.h>
30 Begin = AWS_SSB_BEGIN,
50 explicit operator bool() const noexcept {
return IsValid(); }
55 virtual bool IsValid() const noexcept = 0;
58 aws_input_stream *GetUnderlyingStream() noexcept {
return &m_underlying_stream; }
65 bool Read(
ByteBuf &dest) {
return aws_input_stream_read(&m_underlying_stream, &dest) == 0; }
75 return aws_input_stream_seek(&m_underlying_stream, offset, (aws_stream_seek_basis)seekBasis) == 0;
85 return aws_input_stream_get_status(&m_underlying_stream, &status) == 0;
95 return aws_input_stream_get_length(&m_underlying_stream, &length) == 0;
139 virtual int64_t GetLengthImpl() const noexcept = 0;
159 virtual int64_t PeekImpl() const noexcept = 0;
162 static
int s_Seek(aws_input_stream *stream, int64_t offset, enum aws_stream_seek_basis basis);
163 static
int s_Read(aws_input_stream *stream, aws_byte_buf *dest);
164 static
int s_GetStatus(aws_input_stream *stream, aws_stream_status *status);
165 static
int s_GetLength(struct aws_input_stream *stream, int64_t *out_length);
166 static
void s_Acquire(aws_input_stream *stream);
167 static
void s_Release(aws_input_stream *stream);
169 static aws_input_stream_vtable s_vtable;
179 std::shared_ptr<Aws::Crt::Io::IStream> stream,
182 bool IsValid()
const noexcept override;
185 bool ReadImpl(
ByteBuf &buffer)
noexcept override;
186 bool ReadSomeImpl(
ByteBuf &buffer)
noexcept override;
188 int64_t GetLengthImpl()
const noexcept override;
190 int64_t PeekImpl()
const noexcept override;
193 std::shared_ptr<Aws::Crt::Io::IStream> m_stream;
#define AWS_CRT_CPP_API
Definition Exports.h:36
Definition RefCounted.h:29
aws_stream_status StreamStatus
Definition Stream.h:18
StreamSeekBasis
Definition Stream.h:29
aws_off_t OffsetType
Definition Stream.h:23
aws_allocator Allocator
Definition Allocator.h:14
AWS_CRT_CPP_API Allocator * ApiAllocator() noexcept
Definition Allocator.cpp:24
aws_byte_buf ByteBuf
Definition Types.h:30
Definition Allocator.h:11