class DataExtractor

Defined at line 16 of file ../../src/developer/debug/zxdb/common/data_extractor.h

Public Methods

std::optional<int64_t> ReadSleb128 ()

Reads a DWARF signed or unsigned "LEB128"-encoded value from the stream. This encoding is a

UTF-8-like variable-length integer encoding.

To encode, see the toplevel AppendULeb() function in leb.h.

Defined at line 9 of file ../../src/developer/debug/zxdb/common/data_extractor.cc

void DataExtractor ()

Defined at line 18 of file ../../src/developer/debug/zxdb/common/data_extractor.h

void DataExtractor (cpp20::span<const uint8_t> data)

Defined at line 19 of file ../../src/developer/debug/zxdb/common/data_extractor.h

size_t cur ()

Returns the current position in the buffer.

Defined at line 22 of file ../../src/developer/debug/zxdb/common/data_extractor.h

bool done ()

Returns true is there is more data to read.

Defined at line 25 of file ../../src/developer/debug/zxdb/common/data_extractor.h

std::optional<uint64_t> ReadUleb128 ()

Defined at line 31 of file ../../src/developer/debug/zxdb/common/data_extractor.cc

template <typename T>
std::optional<T> Read ()

Reads the given value, returning it if there is room, and advancing the current location. If

there is not enough bytes, the current position will remain unchanged and a nullopt will be

returned.

Normally one would read an explicitly sized value so the result doesn't depend on the current

machine:

auto result = extractor.Read

<uint32

_t>();

Defined at line 36 of file ../../src/developer/debug/zxdb/common/data_extractor.h

bool CanRead (size_t bytes)

Rturns true if there are at least the number of remaining bytes in the buffer.

Defined at line 44 of file ../../src/developer/debug/zxdb/common/data_extractor.h

void Advance (size_t bytes)

Advances the current location by the given number of bytes. If it advances past the end, it

will stop there.

Defined at line 51 of file ../../src/developer/debug/zxdb/common/data_extractor.h

void Seek (size_t new_offset)

Sets the current location to the given absolute index. If it advances past the end, it will

stop there.

Defined at line 55 of file ../../src/developer/debug/zxdb/common/data_extractor.h

bool ReadBytes (size_t bytes, void * dest)

Copies the given number of bytes into the |dest| buffer and advances the current position.

Returns true on success. False means there weren't enough bytes to read.

Defined at line 59 of file ../../src/developer/debug/zxdb/common/data_extractor.h