LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
ResourceVarFileInfo.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_VAR_FILE_INFO_H
17#define LIEF_PE_RESOURCE_VAR_FILE_INFO_H
18#include <ostream>
19#include <cstdint>
20#include <vector>
21
22#include "LIEF/visibility.h"
23#include "LIEF/Object.hpp"
24#include "LIEF/errors.hpp"
25#include "LIEF/iterators.hpp"
27
28namespace LIEF {
29class BinaryStream;
30namespace PE {
31
40 public:
41 using vars_t = std::vector<ResourceVar>;
42
45
47
49
52
55
56 ~ResourceVarFileInfo() override = default;
57
61 uint16_t type() const {
62 return type_;
63 }
64
66 const std::u16string& key() const {
67 return key_;
68 }
69
71 std::string key_u8() const;
72
75 return vars_;
76 }
77
79 return vars_;
80 }
81
83 type_ = type;
84 return *this;
85 }
86
87 ResourceVarFileInfo& key(std::u16string key) {
88 key_ = std::move(key);
89 return *this;
90 }
91
92 void add_var(ResourceVar var) {
93 vars_.push_back(std::move(var));
94 }
95
96 void accept(Visitor& visitor) const override;
97
98 LIEF_API friend
99 std::ostream& operator<<(std::ostream& os, const ResourceVarFileInfo& entry);
100
101 private:
102 uint16_t type_ = 0;
103 std::u16string key_;
104 vars_t vars_;
105};
106}
107}
108
109#endif
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:33
ResourceVarFileInfo & type(uint16_t type)
Definition ResourceVarFileInfo.hpp:82
static result< ResourceVarFileInfo > parse(BinaryStream &stream)
friend std::ostream & operator<<(std::ostream &os, const ResourceVarFileInfo &entry)
const std::u16string & key() const
Signature of the structure. Must be the unicode string "VarFileInfo".
Definition ResourceVarFileInfo.hpp:66
uint16_t type() const
The type of data in the version resource.
Definition ResourceVarFileInfo.hpp:61
void accept(Visitor &visitor) const override
it_const_vars vars() const
Definition ResourceVarFileInfo.hpp:78
std::string key_u8() const
Key as an utf8 string.
ResourceVarFileInfo & key(std::u16string key)
Definition ResourceVarFileInfo.hpp:87
it_vars vars()
Iterator over the embedded variables associated to the structure.
Definition ResourceVarFileInfo.hpp:74
ref_iterator< vars_t & > it_vars
Definition ResourceVarFileInfo.hpp:43
ResourceVarFileInfo & operator=(ResourceVarFileInfo &&)=default
ResourceVarFileInfo & operator=(const ResourceVarFileInfo &)=default
void add_var(ResourceVar var)
Definition ResourceVarFileInfo.hpp:92
ResourceVarFileInfo(ResourceVarFileInfo &&)=default
~ResourceVarFileInfo() override=default
std::vector< ResourceVar > vars_t
Definition ResourceVarFileInfo.hpp:41
const_ref_iterator< const vars_t & > it_const_vars
Definition ResourceVarFileInfo.hpp:44
ResourceVarFileInfo(const ResourceVarFileInfo &)=default
This class represents an element of the ResourceVarFileInfo structure It typically contains a list of...
Definition ResourceVar.hpp:33
Definition Visitor.hpp:210
Iterator which returns reference on container's values.
Definition iterators.hpp:46
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF namespace.
Definition Abstract/Binary.hpp:40
ref_iterator< CT, U, typename decay_t< CT >::const_iterator > const_ref_iterator
Iterator which return const ref on container's values.
Definition iterators.hpp:257
tl::expected< T, lief_errors > result
Wrapper that contains an Object (T) or an error.
Definition errors.hpp:75
#define LIEF_API
Definition visibility.h:41