16#ifndef LIEF_PE_RESOURCE_STRING_TABLE_H
17#define LIEF_PE_RESOURCE_STRING_TABLE_H
50 return !
key.empty() || !
value.empty();
53 operator bool()
const {
90 const std::u16string&
key()
const {
113 std::optional<std::u16string>
get(
const std::u16string&
key)
const {
115 std::find_if(entries_.begin(), entries_.end(),
116 [&
key](
const entry_t& entry) { return entry.key == key; });
117 if (it == entries_.end()) {
124 std::optional<std::string>
get(
const std::string&
key)
const;
127 key_ = std::move(value);
137 entries_.push_back(std::move(entry));
141 entries_.push_back(
entry_t{std::move(
key), std::move(value)});
146 std::optional<std::string>
operator[](
const std::string& str)
const {
150 std::optional<std::u16string>
operator[](
const std::u16string& str)
const {
160 std::vector<entry_t> entries_;
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:35
ResourceStringTable()=default
std::optional< std::u16string > operator[](const std::u16string &str) const
Definition ResourceStringTable.hpp:150
ResourceStringTable & key(std::u16string value)
Definition ResourceStringTable.hpp:126
ref_iterator< entries_t & > it_entries
Definition ResourceStringTable.hpp:69
ResourceStringTable & operator=(const ResourceStringTable &)=default
std::optional< std::string > get(const std::string &key) const
ResourceStringTable & type(uint16_t value)
Definition ResourceStringTable.hpp:131
ResourceStringTable(const ResourceStringTable &)=default
~ResourceStringTable() override=default
std::string key_u8() const
The key as an utf8 string.
const_ref_iterator< const entries_t & > it_const_entries
Definition ResourceStringTable.hpp:70
ResourceStringTable(ResourceStringTable &&)=default
void add_entry(entry_t entry)
Definition ResourceStringTable.hpp:136
void add_entry(std::u16string key, std::u16string value)
Definition ResourceStringTable.hpp:140
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:90
ResourceStringTable & operator=(ResourceStringTable &&)=default
std::optional< std::string > operator[](const std::string &str) const
Definition ResourceStringTable.hpp:146
std::vector< entry_t > entries_t
Definition ResourceStringTable.hpp:68
void accept(Visitor &visitor) const override
it_const_entries entries() const
Definition ResourceStringTable.hpp:109
static result< ResourceStringTable > parse(BinaryStream &stream)
std::optional< std::u16string > get(const std::u16string &key) const
Definition ResourceStringTable.hpp:113
uint16_t type() const
The type of data in the version resource:
Definition ResourceStringTable.hpp:97
it_entries entries()
Iterator over the different entry_t element of this table.
Definition ResourceStringTable.hpp:105
Definition Visitor.hpp:212
Iterator which returns reference on container's values.
Definition iterators.hpp:47
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: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:317
An entry in this table which is composed of an UTF-16 key and an UTF-16 value.
Definition ResourceStringTable.hpp:39
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:61
std::u16string value
Definition ResourceStringTable.hpp:41
std::string to_string() const
Definition ResourceStringTable.hpp:57
bool is_defined() const
Definition ResourceStringTable.hpp:49
std::u16string key
Definition ResourceStringTable.hpp:40
#define LIEF_API
Definition visibility.h:45