16#ifndef LIEF_PE_RESOURCE_NODE_H
17#define LIEF_PE_RESOURCE_NODE_H
22#include "LIEF/Object.hpp"
23#include "LIEF/visibility.h"
24#include "LIEF/iterators.hpp"
29class ResourceDirectory;
42 using childs_t = std::vector<std::unique_ptr<ResourceNode>>;
63 virtual std::unique_ptr<ResourceNode> clone()
const = 0;
72 const std::u16string&
name()
const {
80 it_const_childs childs()
const {
86 return static_cast<bool>(id() & 0x80000000);
102 return type_ == TYPE::DIRECTORY;
113 return type_ == TYPE::DATA;
116 void id(uint32_t
id) {
119 void name(
const std::string& name);
121 void name(std::u16string name) {
122 name_ = std::move(name);
137 void accept(
Visitor& visitor)
const override;
139 LIEF_API
friend std::ostream& operator<<(std::ostream& os,
const ResourceNode& node);
144 childs_t::iterator insert_child(std::unique_ptr<ResourceNode> child);
145 TYPE type_ = TYPE::UNKNOWN;
147 std::u16string name_;
Class that is used to rebuild a raw PE binary from a PE::Binary object.
Definition PE/Builder.hpp:45
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:47
Class which represents a Data Node in the PE resources tree.
Definition ResourceData.hpp:32
Definition ResourceDirectory.hpp:33
Class which represents a Node in the resource tree.
Definition ResourceNode.hpp:36
bool is_directory() const
True if the current entry is a ResourceDirectory.
Definition ResourceNode.hpp:101
void delete_child(uint32_t id)
Delete the node with the given id
ResourceNode & add_child(const ResourceDirectory &child)
Add a ResourceDirectory to the current node.
const std::u16string & name() const
Name of the entry.
Definition ResourceNode.hpp:72
bool is_data() const
True if the current entry is a ResourceData.
Definition ResourceNode.hpp:112
uint32_t depth() const
Current depth of the Node in the resource tree.
Definition ResourceNode.hpp:90
bool has_name() const
True if the entry uses a name as ID
Definition ResourceNode.hpp:85
void delete_child(const ResourceNode &node)
Delete the given node from the node's children.
uint32_t id() const
Integer that identifies the Type, Name, or Language ID of the entry depending on its depth in the tre...
Definition ResourceNode.hpp:67
it_childs childs()
Iterator on node's children.
Definition ResourceNode.hpp:77
TYPE
Enum that identifies the type of a node in the resource tree.
Definition ResourceNode.hpp:47
ResourceNode & add_child(const ResourceData &child)
Add a ResourceData to the current node.
Definition Visitor.hpp:219
Iterator which returns reference on container's values.
Definition iterators.hpp:48
LIEF namespace.
Definition Abstract/Binary.hpp:32