Go to the documentation of this file.
9 #ifndef EAGINE_EMBED_HPP
10 #define EAGINE_EMBED_HPP
33 bool packed =
false) noexcept
60 return {comp.decompress(_res_blk, buf)};
68 return unpack(ctx.compressor(), ctx.scratch_space());
74 return unpack(mco.main_context());
107 return get_embedded_resource(res_id, src_path);
112 #endif // EAGINE_EMBED_HPP
Class for a single-instance object providing useful information ans services.
Definition: main_ctx.hpp:45
basic_string_span< const char > string_view
Alias for const string views.
Definition: string_span.hpp:116
auto unpack(main_ctx_object &mco) const -> memory::const_block
Unpacks this resource using compressor from a main context object.
Definition: embed.hpp:73
auto unpack(main_ctx &ctx) const -> memory::const_block
Unpacks this resource into a buffer using compressor from main context.
Definition: embed.hpp:67
static auto copy_into(const_block source, buffer &dest) -> block
Copies the content of source block to destination buffer.
Definition: copy.hpp:33
Base class for main context objects.
Definition: main_ctx_object.hpp:71
Common code is placed in this namespace.
Definition: eagine.hpp:21
basic_block< true > const_block
Alias for const byte memory span.
Definition: block.hpp:32
Class providing access to a const resource block embedded into the executable.
Definition: embed.hpp:25
constexpr embedded_resource() noexcept=default
Default constructor.
Reallocatable owning byte buffer.
Definition: buffer.hpp:22
Non-owning view of a contiguous range of memory with ValueType elements.
Definition: flatten_fwd.hpp:16
auto unpack(data_compressor &comp, memory::buffer &buf) const -> memory::const_block
Unpacks this resource into a buffer using the provided compressor.
Definition: embed.hpp:57
static auto as_chars(const embedded_resource &res) noexcept
Converts the embedded resource block to a const span of characters.
Definition: embed.hpp:86
Class implementing data compression and decompresson.
Definition: compression.hpp:37
constexpr auto source_path() const noexcept -> string_view
Returns the path of the file this resource data comes from.
Definition: embed.hpp:39
constexpr auto is_packed() const noexcept -> bool
Indicates if the resource is packed and needs to be decompressed.
Definition: embed.hpp:45
static constexpr auto as_chars(block blk) noexcept
Converts a block into a span of characters.
Definition: block.hpp:48
static auto embed(identifier res_id, string_view src_path) noexcept -> embedded_resource
Triggers the embedding of data from a file on the specified path.
Definition: embed.hpp:105