9#ifndef LLDB_UTILITY_DATAENCODER_H
10#define LLDB_UTILITY_DATAENCODER_H
17#include "llvm/ADT/ArrayRef.h"
18#include "llvm/ADT/StringRef.h"
109 uint32_t
PutUnsigned(uint32_t offset, uint32_t byte_size, uint64_t value);
128 uint32_t
PutU8(uint32_t offset, uint8_t value);
129 uint32_t
PutU16(uint32_t offset, uint16_t value);
130 uint32_t
PutU32(uint32_t offset, uint32_t value);
131 uint32_t
PutU64(uint32_t offset, uint64_t value);
165 void AppendData(llvm::ArrayRef<uint8_t> data);
192 uint32_t
PutData(uint32_t offset,
const void *src, uint32_t src_len);
229 uint32_t
PutCString(uint32_t offset,
const char *cstr);
250 llvm::ArrayRef<uint8_t>
GetData()
const;
267 return size - offset;
288 std::shared_ptr<lldb_private::DataBufferHeap>
m_data_sp;
An binary data encoding class.
DataEncoder()
Default constructor.
const lldb::ByteOrder m_byte_order
The byte order of the data we are encoding to.
lldb::ByteOrder GetByteOrder() const
uint32_t BytesLeft(uint32_t offset) const
uint32_t PutU8(uint32_t offset, uint8_t value)
Encode an unsigned integer at offset offset.
void AppendCString(llvm::StringRef data)
Append a C string to the end of the owned data.
std::shared_ptr< lldb_private::DataBufferHeap > GetDataBuffer()
Get a shared copy of the heap based memory buffer owned by this object.
uint32_t PutUnsigned(uint32_t offset, uint32_t byte_size, uint64_t value)
Encode an unsigned integer of size byte_size to offset.
uint32_t PutAddress(uint32_t offset, lldb::addr_t addr)
Encode an address in the existing buffer at offset bytes into the buffer.
llvm::ArrayRef< uint8_t > GetData() const
Get a access to the bytes that this references.
void AppendAddress(lldb::addr_t addr)
Append an address sized integer to the end of the owned data.
void AppendU32(uint32_t value)
uint32_t PutU64(uint32_t offset, uint64_t value)
uint32_t PutCString(uint32_t offset, const char *cstr)
Put a C string to offset.
std::shared_ptr< lldb_private::DataBufferHeap > m_data_sp
The shared pointer to data that can grow as data is added.
const uint8_t m_addr_size
The address size to use when encoding pointers or addresses.
bool ValidOffset(uint32_t offset) const
Test the validity of offset.
size_t GetByteSize() const
Get the number of bytes contained in this object.
uint32_t PutU32(uint32_t offset, uint32_t value)
void AppendU8(uint8_t value)
Append a unsigned integer to the end of the owned data.
DataEncoder(const DataEncoder &)=delete
void AppendData(llvm::StringRef data)
Append a bytes to the end of the owned data.
void AppendU16(uint16_t value)
void AppendU64(uint64_t value)
uint8_t GetAddressByteSize() const
The address size to use when encoding pointers or addresses.
const DataEncoder & operator=(const DataEncoder &)=delete
bool ValidOffsetForDataOfSize(uint32_t offset, uint32_t length) const
Test the availability of length bytes of data from offset.
uint32_t PutU16(uint32_t offset, uint16_t value)
uint32_t PutData(uint32_t offset, const void *src, uint32_t src_len)
Encode an arbitrary number of bytes.
A class that represents a running process on the host machine.
ByteOrder
Byte ordering definitions.