KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PADS_IO::BINARY_CURSOR Class Reference

Bounds-checked little-endian read cursor over a PADS binary buffer. More...

#include <pads_binary_utils.h>

Public Member Functions

 BINARY_CURSOR (const std::vector< uint8_t > &aData)
 
size_t Size () const
 
bool InBounds (size_t aOffset, size_t aCount) const
 
uint8_t U8At (size_t aOffset) const
 
uint16_t U16At (size_t aOffset) const
 
uint32_t U32At (size_t aOffset) const
 
int32_t I32At (size_t aOffset) const
 
double F64At (size_t aOffset) const
 
float F32At (size_t aOffset) const
 
std::string StringAt (size_t aOffset, size_t aMaxLen) const
 

Private Member Functions

void check (size_t aOffset, size_t aCount) const
 

Private Attributes

const std::vector< uint8_t > & m_data
 

Detailed Description

Bounds-checked little-endian read cursor over a PADS binary buffer.

The *At accessors throw IO_ERROR on an out-of-range read rather than indexing past the buffer.

The cursor holds a reference to the caller's buffer, which must outlive the cursor.

Definition at line 236 of file pads_binary_utils.h.

Constructor & Destructor Documentation

◆ BINARY_CURSOR()

PADS_IO::BINARY_CURSOR::BINARY_CURSOR ( const std::vector< uint8_t > & aData)
inlineexplicit

Definition at line 239 of file pads_binary_utils.h.

References m_data.

Member Function Documentation

◆ check()

void PADS_IO::BINARY_CURSOR::check ( size_t aOffset,
size_t aCount ) const
inlineprivate

Definition at line 290 of file pads_binary_utils.h.

References InBounds(), m_data, and THROW_IO_ERROR.

Referenced by F32At(), F64At(), U16At(), U32At(), and U8At().

◆ F32At()

float PADS_IO::BINARY_CURSOR::F32At ( size_t aOffset) const
inline

Definition at line 275 of file pads_binary_utils.h.

References check(), PADS_IO::getF32LE(), and m_data.

◆ F64At()

double PADS_IO::BINARY_CURSOR::F64At ( size_t aOffset) const
inline

Definition at line 269 of file pads_binary_utils.h.

References check(), PADS_IO::getF64LE(), and m_data.

◆ I32At()

int32_t PADS_IO::BINARY_CURSOR::I32At ( size_t aOffset) const
inline

Definition at line 267 of file pads_binary_utils.h.

References U32At().

◆ InBounds()

bool PADS_IO::BINARY_CURSOR::InBounds ( size_t aOffset,
size_t aCount ) const
inline

Definition at line 244 of file pads_binary_utils.h.

References m_data.

Referenced by check().

◆ Size()

size_t PADS_IO::BINARY_CURSOR::Size ( ) const
inline

Definition at line 241 of file pads_binary_utils.h.

References m_data.

Referenced by BOOST_AUTO_TEST_CASE().

◆ StringAt()

std::string PADS_IO::BINARY_CURSOR::StringAt ( size_t aOffset,
size_t aMaxLen ) const
inline

Definition at line 284 of file pads_binary_utils.h.

References m_data, and PADS_IO::readFixedString().

◆ U16At()

uint16_t PADS_IO::BINARY_CURSOR::U16At ( size_t aOffset) const
inline

Definition at line 255 of file pads_binary_utils.h.

References check(), PADS_IO::getU16LE(), and m_data.

◆ U32At()

uint32_t PADS_IO::BINARY_CURSOR::U32At ( size_t aOffset) const
inline

Definition at line 261 of file pads_binary_utils.h.

References check(), PADS_IO::getU32LE(), and m_data.

Referenced by I32At().

◆ U8At()

uint8_t PADS_IO::BINARY_CURSOR::U8At ( size_t aOffset) const
inline

Definition at line 249 of file pads_binary_utils.h.

References check(), PADS_IO::getU8(), and m_data.

Referenced by PADS_IO::viaRecordValid().

Member Data Documentation

◆ m_data

const std::vector<uint8_t>& PADS_IO::BINARY_CURSOR::m_data
private

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