LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
AuxiliaryFile.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_AUXILIARY_FILE_H
16#define LIEF_PE_AUXILIARY_FILE_H
17
18#include <string_view>
19#include <memory>
20
23#include "LIEF/visibility.h"
24
25
26namespace LIEF::COFF {
27
36 public:
37 LIEF_LOCAL static std::unique_ptr<AuxiliaryFile>
38 parse(const std::vector<uint8_t>& payload);
39
42
43 AuxiliaryFile(std::string file) :
45 filename_(std::move(file)) {}
46
47 AuxiliaryFile(const AuxiliaryFile&) = default;
49
52
53 std::unique_ptr<AuxiliarySymbol> clone() const override {
54 return std::make_unique<AuxiliaryFile>(*this);
55 }
56
58 std::string_view filename() const LIEF_LIFETIMEBOUND {
59 return filename_;
60 }
61
62 AuxiliaryFile& filename(std::string file) {
63 filename_ = std::move(file);
64 return *this;
65 }
66
67 std::string to_string() const override {
68 std::string out = "AuxiliaryFile {\n";
69 out += " " + filename_ + "\n}";
70 return out;
71 }
72
73 ~AuxiliaryFile() override = default;
74
75 static bool classof(const AuxiliarySymbol* sym) {
76 return sym->type() == AuxiliarySymbol::TYPE::FILE;
77 }
78
79 protected:
80 std::string filename_;
81};
82
83}
84
85#endif
AuxiliaryFile & filename(std::string file)
Definition AuxiliaryFile.hpp:62
std::string to_string() const override
Definition AuxiliaryFile.hpp:67
AuxiliaryFile(std::string file)
Definition AuxiliaryFile.hpp:43
AuxiliaryFile(const AuxiliaryFile &)=default
std::string_view filename() const
The associated filename.
Definition AuxiliaryFile.hpp:58
AuxiliaryFile & operator=(AuxiliaryFile &&)=default
AuxiliaryFile(AuxiliaryFile &&)=default
std::unique_ptr< AuxiliarySymbol > clone() const override
Definition AuxiliaryFile.hpp:53
AuxiliaryFile()
Definition AuxiliaryFile.hpp:40
static std::unique_ptr< AuxiliaryFile > parse(const std::vector< uint8_t > &payload)
AuxiliaryFile & operator=(const AuxiliaryFile &)=default
~AuxiliaryFile() override=default
static bool classof(const AuxiliarySymbol *sym)
Definition AuxiliaryFile.hpp:75
span< const uint8_t > payload() const
For unknown type only, return the raw representation of this symbol.
Definition AuxiliarySymbol.hpp:84
TYPE type() const
Definition AuxiliarySymbol.hpp:79
TYPE
Type discriminator for the subclasses.
Definition AuxiliarySymbol.hpp:55
@ FILE
Auxiliary Format 4: Files from the PE-COFF documentation.
Definition AuxiliarySymbol.hpp:68
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Definition AuxiliarySymbol.hpp:29
#define LIEF_API
Definition visibility.h:44
#define LIEF_LOCAL
Definition visibility.h:45