LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
ResourceStringFileInfo.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2025 R. Thomas
2 * Copyright 2017 - 2025 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_PE_RESOURCE_STRING_FILE_INFO_H
17#define LIEF_PE_RESOURCE_STRING_FILE_INFO_H
18#include <ostream>
19#include <vector>
20#include <cstdint>
21
22#include "LIEF/visibility.h"
23
24#include "LIEF/Object.hpp"
25#include "LIEF/errors.hpp"
26#include "LIEF/iterators.hpp"
27
29
30namespace LIEF {
31class BinaryStream;
32
33namespace PE {class LIEF_API ResourceStringFileInfo : public Object {
41 public:
42 using elements_t = std::vector<ResourceStringTable>;
43 using it_const_elements = const_ref_iterator<const elements_t&>;
44 using it_elements = ref_iterator<elements_t&>;
45
46 static result<ResourceStringFileInfo> parse(BinaryStream& stream);
47
49
50 ResourceStringFileInfo(const ResourceStringFileInfo&) = default;
51 ResourceStringFileInfo& operator=(const ResourceStringFileInfo&) = default;
52
53 ResourceStringFileInfo(ResourceStringFileInfo&&) = default;
54 ResourceStringFileInfo& operator=(ResourceStringFileInfo&&) = default;
55
56 ~ResourceStringFileInfo() override = default;
57 uint16_t type() const {
62 return type_;
63 }
64 const std::u16string& key() const {
67 return key_;
68 }
69 it_const_elements children() const {
72 return children_;
73 }
74
75 it_elements children() {
76 return children_;
77 }
78 std::string key_u8() const;
81
82 ResourceStringFileInfo& type(uint16_t type) {
83 type_ = type;
84 return *this;
85 }
86
87 ResourceStringFileInfo& key(std::u16string key) {
88 key_ = std::move(key);
89 return *this;
90 }
91
92 void add_child(ResourceStringTable table) {
93 children_.push_back(std::move(table));
94 }
95
96 void accept(Visitor& visitor) const override;
97
98 LIEF_API friend
99 std::ostream& operator<<(std::ostream& os, const ResourceStringFileInfo& info);
100
101 private:
102 uint16_t type_ = 0;
103 std::u16string key_;
104 elements_t children_;
105};
106
107
108
109
110}
111}
112
113
114#endif
Object.hpp
ResourceStringTable.hpp
LIEF::BinaryStream
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:33
LIEF::PE::ResourceStringFileInfo
Representation of the StringFileInfo structure.
Definition ResourceStringFileInfo.hpp:40
LIEF::PE::ResourceStringFileInfo::key
ResourceStringFileInfo & key(std::u16string key)
Definition ResourceStringFileInfo.hpp:87
LIEF::PE::ResourceStringFileInfo::add_child
void add_child(ResourceStringTable table)
Definition ResourceStringFileInfo.hpp:92
LIEF::PE::ResourceStringFileInfo::key
const std::u16string & key() const
Signature of the structure. Must be the unicode string "StringFileInfo".
Definition ResourceStringFileInfo.hpp:66
LIEF::PE::ResourceStringFileInfo::ResourceStringFileInfo
ResourceStringFileInfo()=default
LIEF::PE::ResourceStringFileInfo::operator=
ResourceStringFileInfo & operator=(ResourceStringFileInfo &&)=default
LIEF::PE::ResourceStringFileInfo::operator<<
friend std::ostream & operator<<(std::ostream &os, const ResourceStringFileInfo &info)
LIEF::PE::ResourceStringFileInfo::parse
static result< ResourceStringFileInfo > parse(BinaryStream &stream)
LIEF::PE::ResourceStringFileInfo::ResourceStringFileInfo
ResourceStringFileInfo(const ResourceStringFileInfo &)=default
LIEF::PE::ResourceStringFileInfo::operator=
ResourceStringFileInfo & operator=(const ResourceStringFileInfo &)=default
LIEF::PE::ResourceStringFileInfo::accept
void accept(Visitor &visitor) const override
LIEF::PE::ResourceStringFileInfo::ResourceStringFileInfo
ResourceStringFileInfo(ResourceStringFileInfo &&)=default
LIEF::PE::ResourceStringFileInfo::type
ResourceStringFileInfo & type(uint16_t type)
Definition ResourceStringFileInfo.hpp:82
LIEF::PE::ResourceStringFileInfo::type
uint16_t type() const
The type of data in the version resource.
Definition ResourceStringFileInfo.hpp:61
LIEF::PE::ResourceStringFileInfo::children
it_const_elements children() const
Iterator over the children values.
Definition ResourceStringFileInfo.hpp:71
LIEF::PE::ResourceStringFileInfo::key_u8
std::string key_u8() const
The key as an utf8 string.
LIEF::PE::ResourceStringFileInfo::~ResourceStringFileInfo
~ResourceStringFileInfo() override=default
LIEF::PE::ResourceStringFileInfo::children
it_elements children()
Definition ResourceStringFileInfo.hpp:75
errors.hpp
iterators.hpp
LIEF::PE
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:36
visibility.h
LIEF_API
#define LIEF_API
Definition visibility.h:41