#ifndef LLVM_SUPPORT_BINARYITEMSTREAM_H
#define LLVM_SUPPORT_BINARYITEMSTREAM_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/BinaryStream.h"
#include "llvm/Support/BinaryStreamError.h"
#include "llvm/Support/Error.h"
#include <cstddef>
#include <cstdint>
namespace llvm {
template <typename T> struct BinaryItemTraits { … };
template <typename T, typename Traits = BinaryItemTraits<T>>
class BinaryItemStream : public BinaryStream {
public:
explicit BinaryItemStream(llvm::endianness Endian) : … { … }
llvm::endianness getEndian() const override { … }
Error readBytes(uint64_t Offset, uint64_t Size,
ArrayRef<uint8_t> &Buffer) override { … }
Error readLongestContiguousChunk(uint64_t Offset,
ArrayRef<uint8_t> &Buffer) override { … }
void setItems(ArrayRef<T> ItemArray) { … }
uint64_t getLength() override { … }
private:
void computeItemOffsets() { … }
Expected<uint32_t> translateOffsetIndex(uint64_t Offset) { … }
llvm::endianness Endian;
ArrayRef<T> Items;
std::vector<uint64_t> ItemEndOffsets;
};
}
#endif