openMSX
Public Member Functions | List of all members
openmsx::InputBuffer Class Reference

This class is complementary to the OutputBuffer class. More...

#include <SerializeBuffer.hh>

Public Member Functions

 InputBuffer (std::span< const uint8_t > buf_)
 Construct new InputBuffer, typically the buf_ parameter will come from a MemBuffer object.
 
void read (void *result, size_t len)
 Read the given number of bytes.
 
void skip (size_t len)
 Skip the given number of bytes.
 
const uint8_t * getCurrentPos () const
 Return a pointer to the current position in the buffer.
 

Detailed Description

This class is complementary to the OutputBuffer class.

Instead of filling an initially empty buffer it starts from a filled buffer and allows to retrieve items starting from the start of the buffer.

Definition at line 174 of file SerializeBuffer.hh.

Constructor & Destructor Documentation

◆ InputBuffer()

openmsx::InputBuffer::InputBuffer ( std::span< const uint8_t >  buf_)
inline

Construct new InputBuffer, typically the buf_ parameter will come from a MemBuffer object.

Definition at line 180 of file SerializeBuffer.hh.

Member Function Documentation

◆ getCurrentPos()

const uint8_t * openmsx::InputBuffer::getCurrentPos ( ) const
inline

Return a pointer to the current position in the buffer.

This is useful if you don't want to copy the data, but e.g. use it as input for an uncompress algorithm. You can later use skip() to actually consume the data.

Definition at line 209 of file SerializeBuffer.hh.

Referenced by openmsx::MemInputArchive::loadStr(), and openmsx::MemInputArchive::serialize_blob().

◆ read()

void openmsx::InputBuffer::read ( void *  result,
size_t  len 
)
inline

Read the given number of bytes.

This 'consumes' the read bytes, so a future read() will continue where this read stopped.

Definition at line 187 of file SerializeBuffer.hh.

Referenced by openmsx::MemInputArchive::load(), openmsx::MemInputArchive::load(), and openmsx::MemInputArchive::serialize().

◆ skip()

void openmsx::InputBuffer::skip ( size_t  len)
inline

Skip the given number of bytes.

This is similar to a read(), but it will only consume the data, not copy it.

Definition at line 198 of file SerializeBuffer.hh.

Referenced by openmsx::MemInputArchive::loadStr(), openmsx::MemInputArchive::serialize_blob(), and openmsx::MemInputArchive::skipSection().


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