LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
SubClient.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 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_SUB_CLIENT_H
16#define LIEF_MACHO_SUB_CLIENT_H
17#include <string>
18#include <ostream>
19
20#include "LIEF/visibility.h"
21
23
24namespace LIEF {
25namespace MachO {
26
27class BinaryParser;
28
29namespace details {
30struct sub_client_command;
31}
32class LIEF_API SubClient : public LoadCommand {
44 friend class BinaryParser;
45 public:
46 SubClient() = default;
47 SubClient(const details::sub_client_command& cmd);
48
49 SubClient& operator=(const SubClient& copy) = default;
50 SubClient(const SubClient& copy) = default;
51
52 std::unique_ptr<LoadCommand> clone() const override {
53 return std::unique_ptr<SubClient>(new SubClient(*this));
54 }
55 const std::string& client() const {
58 return client_;
59 }
60
61 void client(std::string u) {
62 client_ = std::move(u);
63 }
64
65 ~SubClient() override = default;
66
67 void accept(Visitor& visitor) const override;
68
69 std::ostream& print(std::ostream& os) const override;
70
71 static bool classof(const LoadCommand* cmd) {
72 return cmd->command() == LoadCommand::TYPE::SUB_CLIENT;
73 }
74
75 private:
76 std::string client_;
77};
78
79}
80}
81#endif
Class used to parse a single binary (i.e. non-FAT)
Definition BinaryParser.hpp:75
Based class for the Mach-O load commands.
Definition LoadCommand.hpp:37
LoadCommand::TYPE command() const
Command type.
Definition LoadCommand.hpp:125
Class that represents the SubClient command. Accodring to the Mach-O loader.h documentation:
Definition SubClient.hpp:43
std::ostream & print(std::ostream &os) const override
SubClient & operator=(const SubClient &copy)=default
std::unique_ptr< LoadCommand > clone() const override
Definition SubClient.hpp:52
SubClient()=default
const std::string & client() const
Name of the client.
Definition SubClient.hpp:57
void client(std::string u)
Definition SubClient.hpp:61
SubClient(const details::sub_client_command &cmd)
void accept(Visitor &visitor) const override
~SubClient() override=default
SubClient(const SubClient &copy)=default
static bool classof(const LoadCommand *cmd)
Definition SubClient.hpp:71
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