LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
RPathCommand.hpp
1/* Copyright 2017 - 2021 J. Rieck (based on R. Thomas's work)
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_RPATH_COMMAND_H
17#define LIEF_MACHO_RPATH_COMMAND_H
18#include <string>
19#include <ostream>
20
21#include "LIEF/visibility.h"
22
23#include "LIEF/MachO/LoadCommand.hpp"
24
25namespace LIEF {
26namespace MachO {
27
28namespace details {
29struct rpath_command;
30}
31
36class LIEF_API RPathCommand : public LoadCommand {
37 public:
38 RPathCommand() = default;
39 RPathCommand(const details::rpath_command& rpathCmd);
40
41 RPathCommand& operator=(const RPathCommand& copy) = default;
42 RPathCommand(const RPathCommand& copy) = default;
43
44 std::unique_ptr<LoadCommand> clone() const override {
45 return std::unique_ptr<RPathCommand>(new RPathCommand(*this));
46 }
47
48 ~RPathCommand() override = default;
49
51 const std::string& path() const {
52 return path_;
53 }
54
55 void path(std::string path) {
56 path_ = std::move(path);
57 }
58
59 void accept(Visitor& visitor) const override;
60
61 std::ostream& print(std::ostream& os) const override;
62
63 static bool classof(const LoadCommand* cmd) {
64 return cmd->command() == LoadCommand::TYPE::RPATH;
65 }
66
67 private:
68 std::string path_;
69};
70
71}
72}
73#endif
Based class for the Mach-O load commands.
Definition LoadCommand.hpp:36
Class that represents the LC_RPATH command.
Definition RPathCommand.hpp:36
const std::string & path() const
The rpath value as a string.
Definition RPathCommand.hpp:51
Definition Visitor.hpp:219
LIEF namespace.
Definition Abstract/Binary.hpp:32