1#ifndef __FACADE_ICO_HPP
2#define __FACADE_ICO_HPP
58 using Entry = std::pair<IconDirEntry, std::vector<std::uint8_t>>;
61 std::vector<Entry> _entries;
72 Icon(
const void *ptr, std::size_t size) { this->parse(ptr, size); }
73 Icon(
const std::vector<std::uint8_t> &vec) { this->parse(vec); }
74 Icon(
const std::string &filename) { this->parse(filename); }
75 Icon(
const Icon &other) : _entries(other._entries) {}
78 this->_entries = other._entries;
84 return this->get_entry(index);
88 return this->get_entry(index);
92 std::size_t size(
void)
const;
99 void parse(
const void *ptr, std::size_t size);
103 void parse(
const std::vector<std::uint8_t> &vec);
107 void parse(
const std::string &filename);
113 Entry &get_entry(std::size_t index);
118 const Entry &get_entry(std::size_t index)
const;
122 void set_entry(std::size_t index,
const Entry &data);
126 void set_entry(std::size_t index,
const IconDirEntry &entry,
const std::vector<std::uint8_t> &data);
131 EntryType entry_type(std::size_t index)
const;
136 std::vector<std::uint8_t> to_file()
const;
141 void save(
const std::string &filename)
const;
145 void resize(std::size_t size);
150 Entry &insert_entry(std::size_t index,
const Entry &entry);
154 Entry &insert_entry(std::size_t index,
const IconDirEntry &entry,
const std::vector<std::uint8_t> &data);
157 Entry &append_entry(
const Entry &entry);
160 Entry &append_entry(
const IconDirEntry &entry,
const std::vector<std::uint8_t> &data);
164 void remove_entry(std::size_t index);
A Windows icon file.
Definition: ico.hpp:55
Icon(const std::string &filename)
Definition: ico.hpp:74
std::pair< IconDirEntry, std::vector< std::uint8_t > > Entry
A C++ representation of a bitmap entry within the icon file.
Definition: ico.hpp:58
Icon(const Icon &other)
Definition: ico.hpp:75
Icon(const std::vector< std::uint8_t > &vec)
Definition: ico.hpp:73
Icon(const void *ptr, std::size_t size)
Definition: ico.hpp:72
Entry & operator[](std::size_t index)
Syntactic sugar to get an entry within the icon file.
Definition: ico.hpp:83
Icon()
Definition: ico.hpp:71
EntryType
A simple enumeration to differentiate between PNG sections and bitmap sections.
Definition: ico.hpp:66
Icon & operator=(const Icon &other)
Definition: ico.hpp:77
const Entry & operator[](std::size_t index) const
Syntactic sugar to get a const entry within the icon file.
Definition: ico.hpp:87
A collection of exceptions thrown by the library.
Definition: exception.hpp:14
Code functionality for dealing with PNG images.
The C header for an icon bitmap entry.
Definition: ico.hpp:27
std::uint16_t planes
Definition: ico.hpp:32
std::uint8_t reserved
Definition: ico.hpp:31
std::uint16_t bit_count
Definition: ico.hpp:33
std::uint32_t bytes
Definition: ico.hpp:34
std::uint32_t offset
Definition: ico.hpp:35
std::uint8_t height
Definition: ico.hpp:29
std::uint8_t width
Definition: ico.hpp:28
std::uint8_t color_count
Definition: ico.hpp:30
The C header for an icon directory, the root of an icon file.
Definition: ico.hpp:43
std::uint16_t count
Definition: ico.hpp:46
std::uint16_t type
Definition: ico.hpp:45
std::uint16_t reserved
Definition: ico.hpp:44
Functions relating to the needs of images in the program.