23#include "pw_assert/assert.h"
24#include "pw_status/status.h"
25#include "pw_stream/stream.h"
42 PW_ASSERT(!status.
ok());
51 : source_reader_(&source_reader),
70 size_t start()
const {
return start_; }
71 size_t end()
const {
return end_; }
72 size_t current()
const {
return current_; }
73 size_t interval_size()
const {
return end_ - start_; }
74 bool ok()
const {
return status_.
ok(); }
75 Status status()
const {
return status_; }
79 return source_reader_ == other.source_reader_ && start_ == other.start_ &&
80 end_ == other.end_ && current_ == other.current_;
86 size_t DoTell() final {
return current_ - start_; }
88 if (limit == LimitType::kRead) {
89 return end_ - current_;
constexpr bool ok() const
Definition: status.h:214
static constexpr Status Unavailable()
Requested operation can’t finish now, but may at a later time.
Definition: status.h:187
Definition: status_with_size.h:51
Definition: interval_reader.h:36
size_t DoTell() final
Definition: interval_reader.h:86
size_t ConservativeLimit(LimitType limit) const override
Definition: interval_reader.h:87
Status DoSeek(ptrdiff_t offset, Whence origin) final
Virtual Seek() function implemented by derived classes.
StatusWithSize DoRead(ByteSpan destination) final
Virtual Read() function implemented by derived classes.
Whence
Positions from which to seek.
Definition: stream.h:48
constexpr Status OkStatus()
Definition: status.h:297