C/C++ API Reference
Loading...
Searching...
No Matches
pw::stream::CountingNullStream Class Referencefinal

Overview

Same as pw::stream::NullStream, but tracks the number of bytes written.

Inheritance diagram for pw::stream::CountingNullStream:
pw::stream::SeekableReaderWriter pw::stream::RelativeSeekableReaderWriter pw::stream::ReaderWriter pw::stream::Stream

Public Member Functions

size_t bytes_written () const
 
- Public Member Functions inherited from pw::stream::SeekableReaderWriter
SeekableReaderas_seekable_reader ()
 
const SeekableReaderas_seekable_reader () const
 
 operator SeekableReader & ()
 
 operator const SeekableReader & () const
 
SeekableWriteras_seekable_writer ()
 
const SeekableWriteras_seekable_writer () const
 
 operator SeekableWriter & ()
 
 operator const SeekableWriter & () const
 
- Public Member Functions inherited from pw::stream::RelativeSeekableReaderWriter
 operator RelativeSeekableReader & ()
 
 operator const RelativeSeekableReader & () const
 
 operator RelativeSeekableWriter & ()
 
 operator const RelativeSeekableWriter & () const
 
- Public Member Functions inherited from pw::stream::ReaderWriter
Readeras_reader ()
 
const Readeras_reader () const
 
 operator Reader & ()
 
 operator const Reader & () const
 
Writeras_writer ()
 
const Writeras_writer () const
 
 operator Writer & ()
 
 operator const Writer & () const
 
- Public Member Functions inherited from pw::stream::Stream
constexpr bool readable () const
 
constexpr bool writable () const
 
constexpr bool seekable () const
 
constexpr bool seekable (Whence origin) const
 True if the stream supports seeking from the specified origin.
 
Result< ByteSpanRead (ByteSpan dest)
 
Result< ByteSpanRead (void *dest, size_t size_bytes)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
Result< ByteSpanReadExact (ByteSpan const buffer)
 
Status Write (ConstByteSpan data)
 
Status Write (const void *data, size_t size_bytes)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
Status Write (const std::byte b)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
Status Seek (ptrdiff_t offset, Whence origin=kBeginning)
 
size_t Tell ()
 
size_t ConservativeReadLimit () const
 
size_t ConservativeWriteLimit () const
 

Private Member Functions

Status DoWrite (ConstByteSpan data) final
 Virtual Write() function implemented by derived classes.
 
StatusWithSize DoRead (ByteSpan) final
 Virtual Read() function implemented by derived classes.
 
Status DoSeek (ptrdiff_t, Whence) final
 Virtual Seek() function implemented by derived classes.
 

Additional Inherited Members

- Public Types inherited from pw::stream::Stream
enum  Whence : uint8_t { kBeginning = 0b001 , kCurrent = 0b010 , kEnd = 0b100 }
 Positions from which to seek. More...
 
- Static Public Attributes inherited from pw::stream::Stream
static constexpr size_t kUnlimited = std::numeric_limits<size_t>::max()
 Value returned from read/write limit if unlimited.
 
static constexpr size_t kUnknownPosition = std::numeric_limits<size_t>::max()
 Returned by Tell() if getting the position is not supported.
 
- Protected Types inherited from pw::stream::Stream
enum class  LimitType : bool { kRead , kWrite }
 

Member Function Documentation

◆ bytes_written()

size_t pw::stream::CountingNullStream::bytes_written ( ) const
inline
Returns
The number of bytes provided to previous Write calls.

◆ DoRead()

StatusWithSize pw::stream::CountingNullStream::DoRead ( ByteSpan  destination)
inlinefinalprivatevirtual

Virtual Read() function implemented by derived classes.

Implements pw::stream::Stream.

◆ DoSeek()

Status pw::stream::CountingNullStream::DoSeek ( ptrdiff_t  offset,
Whence  origin 
)
inlinefinalprivatevirtual

Virtual Seek() function implemented by derived classes.

Implements pw::stream::Stream.

◆ DoWrite()

Status pw::stream::CountingNullStream::DoWrite ( ConstByteSpan  data)
inlinefinalprivatevirtual

Virtual Write() function implemented by derived classes.

Implements pw::stream::Stream.


The documentation for this class was generated from the following file: