winapi_common
resource.hpp
1 // Copyright (c) 2020 Egor Tensin <Egor.Tensin@gmail.com>
2 // This file is part of the "winapi-common" project.
3 // For details, see https://github.com/egor-tensin/winapi-common.
4 // Distributed under the MIT License.
5 
6 #pragma once
7 
8 #include "buffer.hpp"
9 
10 #include <cstddef>
11 
12 namespace winapi {
13 
15 struct Resource {
16  // This is just a pointer to static data.
17 
18  Resource() = default;
19 
20  Resource(const void* data, std::size_t nb) : data{data}, nb{nb} {}
21 
23  Buffer copy() const { return {data, nb}; }
24 
25  const void* data = nullptr;
26  std::size_t nb = 0;
27 };
28 
29 } // namespace winapi
Binary data container.
Definition: buffer.hpp:24
Resources embedded in a PE (Portable Executable).
Definition: resource.hpp:15
Buffer copy() const
Definition: resource.hpp:23