LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
DyldEnvironment.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 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_MACHO_DYLD_ENVIROMENT_COMMAND_H
17#define LIEF_MACHO_DYLD_ENVIROMENT_COMMAND_H
18#include <string>
19#include <ostream>
20
21#include "LIEF/visibility.h"
22
24
25namespace LIEF {
26namespace MachO {
27
28namespace details {
29struct dylinker_command;
30}
35 public:
36 DyldEnvironment() = default;
37 DyldEnvironment(const details::dylinker_command& cmd);
38
39 DyldEnvironment& operator=(const DyldEnvironment& copy) = default;
40 DyldEnvironment(const DyldEnvironment& copy) = default;
41
42 std::unique_ptr<LoadCommand> clone() const override {
43 return std::unique_ptr<DyldEnvironment>(new DyldEnvironment(*this));
44 }
45
46 ~DyldEnvironment() override = default;
47
48 std::ostream& print(std::ostream& os) const override;
49 const std::string& value() const {
52 return value_;
53 }
54
55 void value(std::string value) {
56 value_ = std::move(value);
57 }
58
59 void accept(Visitor& visitor) const override;
60
61 static bool classof(const LoadCommand* cmd) {
62 return cmd->command() == LoadCommand::TYPE::DYLD_ENVIRONMENT;
63 }
64
65 private:
66 std::string value_;
67};
68
69}
70}
71#endif
Class that represents a LC_DYLD_ENVIRONMENT command which is used by the Mach-O linker/loader to init...
Definition DyldEnvironment.hpp:34
DyldEnvironment(const DyldEnvironment &copy)=default
DyldEnvironment(const details::dylinker_command &cmd)
void value(std::string value)
Definition DyldEnvironment.hpp:55
~DyldEnvironment() override=default
DyldEnvironment()=default
static bool classof(const LoadCommand *cmd)
Definition DyldEnvironment.hpp:61
DyldEnvironment & operator=(const DyldEnvironment &copy)=default
std::unique_ptr< LoadCommand > clone() const override
Definition DyldEnvironment.hpp:42
std::ostream & print(std::ostream &os) const override
void accept(Visitor &visitor) const override
const std::string & value() const
The actual environment variable.
Definition DyldEnvironment.hpp:51
Based class for the Mach-O load commands.
Definition LoadCommand.hpp:37
LoadCommand::TYPE command() const
Command type.
Definition LoadCommand.hpp:124
Definition endianness_support.hpp:59
Namespace related to the LIEF's Mach-O module.
Definition Abstract/Header.hpp:36
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41