arcsdec::v_1_0_0::Bytes class final

A sequence of bytes read from a specific offset in a file.

The sequence can contain wildcards.

Public static variables

static unsigned int any constexpr
Wildcard for a single byte.

Constructors, destructors, conversion operators

Bytes()
Constructor.
Bytes(const uint32_t offset, const ByteSequence& bytes)
Constructor.

Public functions

auto match(const Bytes& bytes) const -> bool
Match a byte sequence with this instance.
auto match(const ByteSequence& bytes) const -> bool
Match a byte sequence with offset 0 with this instance.
auto match(const ByteSequence& bytes, const uint32_t& offset) const -> bool
Match a byte sequence starting with offset with this instance.
auto offset() const -> uint32_t
Offset of this instance.
auto operator[](ByteSequence::size_type i) const -> ByteSequence::const_reference
Read access to a single byte.
auto sequence() const -> ByteSequence
ByteSequence of this instance.
auto size() const -> ByteSequence::size_type
Total number of bytes contained.
auto swap(Bytes& rhs) -> Bytes&
Swap this instance with another.

Function documentation

arcsdec::v_1_0_0::Bytes::Bytes()

Constructor.

Initiates an empty internal ByteSequence with an offset() of 0.

arcsdec::v_1_0_0::Bytes::Bytes(const uint32_t offset, const ByteSequence& bytes)

Constructor.

Parameters
offset in 0-based offset where bytes occured in the file
bytes in Sequence of bytes

bool arcsdec::v_1_0_0::Bytes::match(const Bytes& bytes) const

Match a byte sequence with this instance.

Parameters
bytes in Byte sequence to be matched
Returns TRUE iff this instance matches bytes, otherwise FALSE

The match is tried starting on positin offset() on this instance and ends on the end of the shorter sequence, either bytes or this instance.

bool arcsdec::v_1_0_0::Bytes::match(const ByteSequence& bytes) const

Match a byte sequence with offset 0 with this instance.

Parameters
bytes in ByteSequence to be matched
Returns TRUE iff this instance matches bytes, otherwise FALSE

This is equivalent to match(bytes, 0).

bool arcsdec::v_1_0_0::Bytes::match(const ByteSequence& bytes, const uint32_t& offset) const

Match a byte sequence starting with offset with this instance.

Parameters
bytes in ByteSequence from a file to be matched
offset in Offset to start of ByteSequence of this instance
Returns TRUE iff this instance matches bytes, otherwise FALSE

The match is tried starting on positin offset on this instance and ends on the end of the shorter sequence, either bytes or this instance.

uint32_t arcsdec::v_1_0_0::Bytes::offset() const

Offset of this instance.

Returns Offset of this instance.

ByteSequence::const_reference arcsdec::v_1_0_0::Bytes::operator[](ByteSequence::size_type i) const

Read access to a single byte.

Returns Read a single byte.

ByteSequence arcsdec::v_1_0_0::Bytes::sequence() const

ByteSequence of this instance.

Returns ByteSequence of this instance.

ByteSequence::size_type arcsdec::v_1_0_0::Bytes::size() const

Total number of bytes contained.

Returns Total number of bytes.

Bytes& arcsdec::v_1_0_0::Bytes::swap(Bytes& rhs)

Swap this instance with another.

Parameters
rhs in The other instance to swap with