34namespace fs = std::filesystem;
47 char m_data[(1<<20) - 12];
56 std::fill_n(m_ext, std::size(m_ext), 0);
57 std::fill_n(m_data, std::size(m_data), 0);
66 Icon(
char* ext,
char* data, uint64_t size)
70 std::copy(ext, ext+3, m_ext);
72 std::copy(data, data+size, m_data);
86 uint64_t space_available = ns_reserved::FIM_RESERVED_OFFSET_ICON_END - ns_reserved::FIM_RESERVED_OFFSET_ICON_BEGIN;
87 uint64_t space_required =
sizeof(
Icon);
88 return_if(space_available < space_required, Error(
"E::Not enough space to fit icon data: {} vs {}", space_available, space_required));
90 , ns_reserved::FIM_RESERVED_OFFSET_ICON_BEGIN
91 , ns_reserved::FIM_RESERVED_OFFSET_ICON_END
92 ,
reinterpret_cast<char const*
>(&icon)
107 uint64_t offset_begin = ns_reserved::FIM_RESERVED_OFFSET_ICON_BEGIN;
108 uint64_t size = ns_reserved::FIM_RESERVED_OFFSET_ICON_END - offset_begin;
109 Pop(
ns_reserved::read(path_file_binary, offset_begin,
reinterpret_cast<char*
>(&icon), size));
Enhanced error handling framework built on std::expected.
Simplified macros for common control flow patterns with optional logging.
Application icon image storage in reserved space.
Value< Icon > read(fs::path const &path_file_binary)
Reads the Icon struct from the target binary.
Value< void > write(fs::path const &path_file_binary, Icon const &icon)
Writes the Icon struct to the target binary.
Value< void > write(fs::path const &path_file_binary, uint64_t offset_begin, uint64_t offset_end, const char *data, uint64_t length) noexcept
Writes data to a file in binary format.
Value< std::streamsize > read(fs::path const &path_file_binary, uint64_t offset, char *data, uint64_t length) noexcept
Reads data from a file in binary format.
Enhanced expected type with integrated logging capabilities.
Stores icon data in reserved space.
Icon(char *ext, char *data, uint64_t size)
Constructs an icon with the specified data.
Icon()
Default constructor, initializes to empty icon.