16#ifndef LIEF_PE_RESOURCE_STRING_TABLE_H
17#define LIEF_PE_RESOURCE_STRING_TABLE_H
51 return !
key.empty() || !
value.empty();
54 operator bool()
const {
91 const std::u16string&
key()
const {
114 std::optional<std::u16string>
get(
const std::u16string&
key)
const {
116 std::find_if(entries_.begin(), entries_.end(),
117 [&
key](
const entry_t& entry) { return entry.key == key; });
118 if (it == entries_.end()) {
125 std::optional<std::string>
get(std::string_view
key)
const;
128 key_ = std::move(value);
138 entries_.push_back(std::move(entry));
142 entries_.push_back(
entry_t{std::move(
key), std::move(value)});
147 std::optional<std::string>
operator[](std::string_view str)
const {
151 std::optional<std::u16string>
operator[](
const std::u16string& str)
const {
161 std::vector<entry_t> entries_;
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:35
std::optional< std::string > get(std::string_view key) const
ResourceStringTable()=default
std::optional< std::u16string > operator[](const std::u16string &str) const
Definition ResourceStringTable.hpp:151
ResourceStringTable & key(std::u16string value)
Definition ResourceStringTable.hpp:127
ref_iterator< entries_t & > it_entries
Definition ResourceStringTable.hpp:70
ResourceStringTable & operator=(const ResourceStringTable &)=default
ResourceStringTable & type(uint16_t value)
Definition ResourceStringTable.hpp:132
ResourceStringTable(const ResourceStringTable &)=default
~ResourceStringTable() override=default
std::optional< std::string > operator[](std::string_view str) const
Definition ResourceStringTable.hpp:147
std::string key_u8() const
The key as an utf8 string.
const_ref_iterator< const entries_t & > it_const_entries
Definition ResourceStringTable.hpp:71
ResourceStringTable(ResourceStringTable &&)=default
void add_entry(entry_t entry)
Definition ResourceStringTable.hpp:137
void add_entry(std::u16string key, std::u16string value)
Definition ResourceStringTable.hpp:141
friend std::ostream & operator<<(std::ostream &os, const ResourceStringTable &table)
const std::u16string & key() const
An 8-digit hexadecimal number stored as a Unicode string. The four most significant digits represent ...
Definition ResourceStringTable.hpp:91
ResourceStringTable & operator=(ResourceStringTable &&)=default
std::vector< entry_t > entries_t
Definition ResourceStringTable.hpp:69
void accept(Visitor &visitor) const override
it_const_entries entries() const
Definition ResourceStringTable.hpp:110
static result< ResourceStringTable > parse(BinaryStream &stream)
std::optional< std::u16string > get(const std::u16string &key) const
Definition ResourceStringTable.hpp:114
uint16_t type() const
The type of data in the version resource:
Definition ResourceStringTable.hpp:98
it_entries entries()
Iterator over the different entry_t element of this table.
Definition ResourceStringTable.hpp:106
Definition Visitor.hpp:212
Iterator which returns reference on container's values.
Definition iterators.hpp:121
Wrapper that contains an Object (T) or an error.
Definition errors.hpp:79
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF namespace.
Definition Abstract/Binary.hpp:42
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:386
An entry in this table which is composed of an UTF-16 key and an UTF-16 value.
Definition ResourceStringTable.hpp:40
std::string value_u8() const
Value in utf8 representation.
std::string key_u8() const
Key in utf8 representation.
friend std::ostream & operator<<(std::ostream &os, const entry_t &entry)
Definition ResourceStringTable.hpp:62
std::u16string value
Definition ResourceStringTable.hpp:42
std::string to_string() const
Definition ResourceStringTable.hpp:58
bool is_defined() const
Definition ResourceStringTable.hpp:50
std::u16string key
Definition ResourceStringTable.hpp:41
#define LIEF_API
Definition visibility.h:45