HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
resource_view.hpp
1// Copyright Take Vos 2019-2020.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include <span>
8#include <variant>
9#include <functional>
10#include <cstddef>
11#include <string_view>
12
13namespace hi::inline v1 {
14class URL;
15
19public:
20 resource_view() = default;
21 virtual ~resource_view() = default;
22 resource_view(resource_view const &other) = default;
23 resource_view(resource_view &&other) = default;
24 resource_view &operator=(resource_view const &other) = default;
25 resource_view &operator=(resource_view &&other) = default;
26
30 [[nodiscard]] virtual std::size_t offset() const noexcept = 0;
31
34 [[nodiscard]] virtual std::span<std::byte const> bytes() const noexcept = 0;
35
38 [[nodiscard]] virtual std::string_view string_view() const noexcept = 0;
39
40 operator std::span<std::byte const>() const noexcept
41 {
42 return bytes();
43 }
44
47 [[nodiscard]] virtual std::size_t size() const noexcept = 0;
48
51 [[nodiscard]] virtual std::byte const *data() const noexcept = 0;
52};
53
54} // namespace hi::inline v1
STL namespace.
A read-only memory mapping of a resource.
Definition resource_view.hpp:18
virtual std::size_t offset() const noexcept=0
Offset into the resource file.
virtual std::size_t size() const noexcept=0
Size of the memory mapping.