16#ifndef LIEF_PE_RESOURCES_MANAGER_H
17#define LIEF_PE_RESOURCES_MANAGER_H
70 using icons_t = std::vector<ResourceIcon>;
84 return !
string.empty();
87 operator bool()
const {
93 os << std::to_string(str.
id) <<
", " << str.
string_u8();
106 resources_(other.resources_)
111 if (&other !=
this) {
113 resources_ = other.resources_;
198 std::vector<std::string>
html()
const;
209 std::string
print(uint32_t depth = 0)
const;
217 void print_tree(
const ResourceNode& node, std::ostringstream& stream,
218 uint32_t current_depth, uint32_t max_depth,
219 const ResourceNode* parent =
nullptr, std::string header =
"",
220 bool is_last =
false)
const;
Object & operator=(const Object &other)
std::vector< std::unique_ptr< ResourceDialog > > dialogs_t
Definition ResourceDialog.hpp:45
Definition ResourceIcon.hpp:38
Class which represents a Node in the resource tree.
Definition ResourceNode.hpp:46
std::vector< ResourceIcon > icons_t
Definition ResourcesManager.hpp:70
void add_icon(const ResourceIcon &icon)
Add an icon to the resources.
bool has_version() const
true if resources contain a LIEF::PE::ResourceVersion
Definition ResourcesManager.hpp:155
bool has_html() const
true if the resources contain html
Definition ResourcesManager.hpp:193
std::vector< ResourceVersion > version() const
Return a list of version info (VS_VERSIONINFO).
it_const_accelerators accelerator() const
Return the list of the accelerator in the resource.
it_const_dialogs dialogs() const
Return the list of the dialogs present in the resource.
ResourceNode * get_node_type(TYPE type)
Return the ResourceNode associated with the given TYPE or a nullptr if not found;.
Definition ResourcesManager.hpp:126
bool has_type(TYPE type) const
true if the resource has the given TYPE node
Definition ResourcesManager.hpp:137
~ResourcesManager() override=default
bool has_icons() const
true if resources contain a LIEF::PE::ResourceIcon
Definition ResourcesManager.hpp:163
bool has_manifest() const
true if resources contain the Manifest element
Definition ResourcesManager.hpp:142
std::vector< string_entry_t > strings_table_t
Definition ResourcesManager.hpp:98
std::vector< ResourceAccelerator > accelerators_t
Definition ResourcesManager.hpp:73
std::string print(uint32_t depth=0) const
Print the resource tree to the given depth.
const_ref_iterator< const dialogs_t &, const ResourceDialog * > it_const_dialogs
Definition ResourcesManager.hpp:67
void change_icon(const ResourceIcon &original, const ResourceIcon &newone)
ResourcesManager(ResourceNode &rsrc)
Definition ResourcesManager.hpp:101
std::vector< TYPE > get_types() const
List of TYPE present in the resources.
const_ref_iterator< accelerators_t > it_const_accelerators
Definition ResourcesManager.hpp:74
it_const_icons icons() const
Return the list of the icons present in the resources.
TYPE
The different types of resources From https://learn.microsoft.com/en-us/windows/win32/menurc/resource...
Definition ResourcesManager.hpp:41
@ VERSION
Definition ResourcesManager.hpp:55
@ MANIFEST
Definition ResourcesManager.hpp:62
@ GROUP_ICON
Definition ResourcesManager.hpp:54
@ HTML
Definition ResourcesManager.hpp:61
@ DIALOG
Definition ResourcesManager.hpp:46
@ STRING
Definition ResourcesManager.hpp:47
@ ACCELERATOR
Definition ResourcesManager.hpp:50
@ ICON
Definition ResourcesManager.hpp:44
bool has_string_table() const
true if the resources contain a string table
Definition ResourcesManager.hpp:185
const_ref_iterator< icons_t > it_const_icons
Definition ResourcesManager.hpp:71
std::string manifest() const
Return the manifest as a std::string or an empty string if not found or corrupted.
ResourcesManager(const ResourcesManager &other)
Definition ResourcesManager.hpp:104
bool has_accelerator() const
true if the resources contain accelerator info
Definition ResourcesManager.hpp:201
friend std::ostream & operator<<(std::ostream &os, const ResourcesManager &m)
ResourceDialog::dialogs_t dialogs_t
Definition ResourcesManager.hpp:66
ResourcesManager & operator=(ResourcesManager &&)=default
bool has_dialogs() const
true if resources contain dialogs
Definition ResourcesManager.hpp:177
strings_table_t string_table() const
Return the list of the strings embedded in the string table (RT_STRING).
const ResourceNode * get_node_type(TYPE type) const
void accept(Visitor &visitor) const override
ResourcesManager & operator=(const ResourcesManager &other)
Definition ResourcesManager.hpp:110
ResourcesManager()=delete
std::vector< std::string > html() const
Return the list of the html resources.
ResourcesManager(ResourcesManager &&)=default
void manifest(const std::string &manifest)
Change or set the manifest. If the manifest node path does not exist, all required nodes are created.
Definition VectorStream.hpp:29
Definition Visitor.hpp:212
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
const char * to_string(CODE_PAGES e)
@ MENU
Definition AcceleratorCodes.hpp:38
LIEF namespace.
Definition Abstract/Binary.hpp:41
ref_iterator< CT, U, typename decay_t< CT >::const_iterator > const_ref_iterator
Iterator which returns a const ref on container's values.
Definition iterators.hpp:320
This structure represent an entry in the string table (RT_STRING).
Definition ResourcesManager.hpp:77
std::string string_u8() const
friend std::ostream & operator<<(std::ostream &os, const string_entry_t &str)
Definition ResourcesManager.hpp:91
std::u16string string
Definition ResourcesManager.hpp:78
bool is_defined() const
Definition ResourcesManager.hpp:83
uint32_t id
Definition ResourcesManager.hpp:79
#define LIEF_API
Definition visibility.h:45