LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
UUIDCommand.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_MACHO_UUID_COMMAND_H
16#define LIEF_MACHO_UUID_COMMAND_H
17#include <array>
18#include <memory>
19#include <ostream>
20
21#include "LIEF/visibility.h"
22
24
25
26namespace LIEF::MachO {
27
28namespace details {
29struct uuid_command;
30}
31
32using uuid_t = std::array<uint8_t, 16>;
33
36 public:
37 UUIDCommand() = default;
38 UUIDCommand(const details::uuid_command& cmd);
39
40 UUIDCommand& operator=(const UUIDCommand& copy) = default;
41 UUIDCommand(const UUIDCommand& copy) = default;
42
43 std::unique_ptr<LoadCommand> clone() const override {
44 return std::make_unique<UUIDCommand>(*this);
45 }
46
47 ~UUIDCommand() override = default;
48
51 return uuid_;
52 }
53
54 void uuid(const uuid_t& uuid) {
55 uuid_ = uuid;
56 }
57
58 void accept(Visitor& visitor) const override;
59
60 std::ostream& print(std::ostream& os) const override;
61
62 static bool classof(const LoadCommand* cmd) {
63 return cmd->command() == LoadCommand::TYPE::UUID;
64 }
65
66 private:
67 uuid_t uuid_ = {0};
68};
69
70}
71
72#endif
LoadCommand::TYPE command() const
Command type.
Definition LoadCommand.hpp:131
@ UUID
Definition LoadCommand.hpp:74
const uuid_t & uuid() const
The UUID as a 16-bytes array.
Definition UUIDCommand.hpp:50
std::ostream & print(std::ostream &os) const override
static bool classof(const LoadCommand *cmd)
Definition UUIDCommand.hpp:62
void accept(Visitor &visitor) const override
void uuid(const uuid_t &uuid)
Definition UUIDCommand.hpp:54
UUIDCommand & operator=(const UUIDCommand &copy)=default
std::unique_ptr< LoadCommand > clone() const override
Definition UUIDCommand.hpp:43
UUIDCommand(const UUIDCommand &copy)=default
~UUIDCommand() override=default
UUIDCommand(const details::uuid_command &cmd)
Definition Visitor.hpp:211
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Definition endianness_support.hpp:62
Namespace related to the LIEF's Mach-O module.
Definition Abstract/Header.hpp:35
std::array< uint8_t, 16 > uuid_t
Definition UUIDCommand.hpp:32
#define LIEF_API
Definition visibility.h:44