LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
ResourceVarFileInfo.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef LIEF_PE_RESOURCE_VAR_FILE_INFO_H
16#define LIEF_PE_RESOURCE_VAR_FILE_INFO_H
17#include <cstdint>
18#include <ostream>
19#include <vector>
20
21#include "LIEF/Object.hpp"
23#include "LIEF/errors.hpp"
24#include "LIEF/iterators.hpp"
25#include "LIEF/visibility.h"
26
27namespace LIEF {
28class BinaryStream;
29namespace PE {
30
39 public:
40 using vars_t = std::vector<ResourceVar>;
41
44
46
48
51
54
55 ~ResourceVarFileInfo() override = default;
56
60 uint16_t type() const {
61 return type_;
62 }
63
65 const std::u16string& key() const {
66 return key_;
67 }
68
70 std::string key_u8() const;
71
74 return vars_;
75 }
76
78 return vars_;
79 }
80
82 type_ = type;
83 return *this;
84 }
85
86 ResourceVarFileInfo& key(std::u16string key) {
87 key_ = std::move(key);
88 return *this;
89 }
90
91 void add_var(ResourceVar var) {
92 vars_.push_back(std::move(var));
93 }
94
95 void accept(Visitor& visitor) const override;
96
97 LIEF_API friend std::ostream& operator<<(std::ostream& os,
98 const ResourceVarFileInfo& entry);
99
100 private:
101 uint16_t type_ = 0;
102 std::u16string key_;
103 vars_t vars_;
104};
105}
106}
107
108#endif
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:34
ResourceVarFileInfo & type(uint16_t type)
Definition ResourceVarFileInfo.hpp:81
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:65
uint16_t type() const
The type of data in the version resource.
Definition ResourceVarFileInfo.hpp:60
void accept(Visitor &visitor) const override
it_const_vars vars() const
Definition ResourceVarFileInfo.hpp:77
std::string key_u8() const
Key as an utf8 string.
ResourceVarFileInfo & key(std::u16string key)
Definition ResourceVarFileInfo.hpp:86
it_vars vars()
Iterator over the embedded variables associated to the structure.
Definition ResourceVarFileInfo.hpp:73
ref_iterator< vars_t & > it_vars
Definition ResourceVarFileInfo.hpp:42
ResourceVarFileInfo & operator=(ResourceVarFileInfo &&)=default
ResourceVarFileInfo & operator=(const ResourceVarFileInfo &)=default
void add_var(ResourceVar var)
Definition ResourceVarFileInfo.hpp:91
ResourceVarFileInfo(ResourceVarFileInfo &&)=default
~ResourceVarFileInfo() override=default
std::vector< ResourceVar > vars_t
Definition ResourceVarFileInfo.hpp:40
const_ref_iterator< const vars_t & > it_const_vars
Definition ResourceVarFileInfo.hpp:43
ResourceVarFileInfo(const ResourceVarFileInfo &)=default
This class represents an element of the ResourceVarFileInfo structure It typically contains a list of...
Definition ResourceVar.hpp:32
Definition Visitor.hpp:211
Iterator which returns reference on container's values.
Definition iterators.hpp:120
Wrapper that contains an Object (T) or an error.
Definition errors.hpp:78
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:31
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:385
#define LIEF_API
Definition visibility.h:44