Bytes class final
#include <descriptor.hpp>
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
offsetwith 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:: Bytes:: Bytes()
Constructor.
Initiates an empty internal ByteSequence with an offset() of 0.
arcsdec:: 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:: 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:: 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:: 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.
ByteSequence::const_reference arcsdec:: Bytes:: operator[](ByteSequence::size_type i) const
Read access to a single byte.
| Parameters | |
|---|---|
| i in | Index position |
| Returns | Read a single byte. |
ByteSequence
arcsdec:: Bytes:: sequence() const
ByteSequence of this instance.
| Returns | ByteSequence of this instance. |
|---|
ByteSequence::size_type arcsdec:: Bytes:: size() const
Total number of bytes contained.
| Returns | Total number of bytes. |
|---|