LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
UnknownCommand.hpp
Go to the documentation of this file.
1/* Copyright 2024 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_MACHO_UNKNOWN_COMMAND_H
16#define LIEF_MACHO_UNKNOWN_COMMAND_H
17#include <ostream>
18
19#include "LIEF/visibility.h"
20
22
23namespace LIEF {
24namespace MachO {
25
26namespace details {
27struct load_command;
28}
29
30
33
34 public:
35 UnknownCommand() = delete;
36 UnknownCommand(const details::load_command& command) :
37 LoadCommand(command),
38 original_command_(static_cast<uint64_t>(command_))
39 {
40 command_ = LoadCommand::TYPE::LIEF_UNKNOWN;
41 }
42
43 UnknownCommand& operator=(const UnknownCommand& copy) = default;
44 UnknownCommand(const UnknownCommand& copy) = default;
45
46 std::unique_ptr<LoadCommand> clone() const override {
47 return std::unique_ptr<UnknownCommand>(new UnknownCommand(*this));
48 }
49
50 ~UnknownCommand() override = default;
51
53 uint64_t original_command() const {
54 return original_command_;
55 }
56
57 void accept(Visitor& visitor) const override;
58
59 std::ostream& print(std::ostream& os) const override;
60
61 static bool classof(const LoadCommand* cmd) {
62 return cmd->command() == LoadCommand::TYPE::LIEF_UNKNOWN;
63 }
64
65 private:
66 uint64_t original_command_ = 0;
67};
68
69}
70}
71#endif
Based class for the Mach-O load commands.
Definition LoadCommand.hpp:36
LoadCommand::TYPE command() const
Command type.
Definition LoadCommand.hpp:122
Generic class when the command is not recognized by LIEF.
Definition UnknownCommand.hpp:32
UnknownCommand(const details::load_command &command)
Definition UnknownCommand.hpp:36
void accept(Visitor &visitor) const override
uint64_t original_command() const
The original LC_ int that is not supported by LIEF.
Definition UnknownCommand.hpp:53
UnknownCommand & operator=(const UnknownCommand &copy)=default
std::unique_ptr< LoadCommand > clone() const override
Definition UnknownCommand.hpp:46
std::ostream & print(std::ostream &os) const override
static bool classof(const LoadCommand *cmd)
Definition UnknownCommand.hpp:61
UnknownCommand(const UnknownCommand &copy)=default
~UnknownCommand() override=default
Definition Visitor.hpp:224
LIEF namespace.
Definition Abstract/Binary.hpp:32
#define LIEF_API
Definition visibility.h:41