7#include "resource_view.hpp"
11#include <unordered_map>
28 [[nodiscard]]
size_t offset() const noexcept
override {
return 0; }
30 [[nodiscard]]
size_t size() const noexcept
override {
return _bytes.size(); }
32 [[nodiscard]] std::byte
const *
data() const noexcept
override {
return _bytes.data(); }
34 [[nodiscard]] std::span<std::byte const>
bytes() const noexcept
override {
return _bytes; }
36 [[nodiscard]] std::string_view
string_view() const noexcept
override {
return {
reinterpret_cast<char const*
>(
data()),
size()}; }
39 return std::make_unique<static_resource_view>(location);
64 std::span<std::byte const> _bytes;
A read-only memory mapping of a resource.
Definition resource_view.hpp:18
A resource that was included in the executable.
Definition static_resource_view.hpp:17
static void add_static_resource(std::string const &key, std::span< std::byte const > value) noexcept
Add static resource.
std::string_view string_view() const noexcept override
Get a span to the memory mapping.
Definition static_resource_view.hpp:36
size_t size() const noexcept override
Size of the memory mapping.
Definition static_resource_view.hpp:30
std::span< std::byte const > bytes() const noexcept override
Get a span to the memory mapping.
Definition static_resource_view.hpp:34
static std::span< std::byte const > get_static_resource(std::string const &key)
Get the data of a static resource.
std::byte const * data() const noexcept override
Pointer to the memory mapping.
Definition static_resource_view.hpp:32
size_t offset() const noexcept override
Offset into the resource file.
Definition static_resource_view.hpp:28