LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
SourceVersion.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 * Copyright 2017 - 2026 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_SOURCE_VERSION_COMMAND_H
17#define LIEF_MACHO_SOURCE_VERSION_COMMAND_H
18#include <array>
19#include <memory>
20#include <ostream>
21
22#include "LIEF/visibility.h"
23
25
26
27namespace LIEF::MachO {
28
29namespace details {
30struct source_version_command;
31}
32
37
38 public:
40 using version_t = std::array<uint32_t, 5>;
41
42 SourceVersion() = default;
43 SourceVersion(const details::source_version_command& version_cmd);
44
45 SourceVersion& operator=(const SourceVersion& copy) = default;
46 SourceVersion(const SourceVersion& copy) = default;
47
48 std::unique_ptr<LoadCommand> clone() const override {
49 return std::make_unique<SourceVersion>(*this);
50 }
51
52 ~SourceVersion() override = default;
53
56 return version_;
57 }
58 void version(const version_t& version) {
59 version_ = version;
60 }
61
62 void accept(Visitor& visitor) const override;
63
64 std::ostream& print(std::ostream& os) const override;
65
66 static bool classof(const LoadCommand* cmd) {
68 }
69
70 private:
71 version_t version_ = {0};
72};
73
74}
75
76#endif
LoadCommand::TYPE command() const
Command type.
Definition LoadCommand.hpp:132
@ SOURCE_VERSION
Definition LoadCommand.hpp:91
SourceVersion & operator=(const SourceVersion &copy)=default
void accept(Visitor &visitor) const override
std::ostream & print(std::ostream &os) const override
void version(const version_t &version)
Definition SourceVersion.hpp:58
SourceVersion(const details::source_version_command &version_cmd)
SourceVersion(const SourceVersion &copy)=default
static bool classof(const LoadCommand *cmd)
Definition SourceVersion.hpp:66
std::unique_ptr< LoadCommand > clone() const override
Definition SourceVersion.hpp:48
const version_t & version() const
Return the version as an array.
Definition SourceVersion.hpp:55
~SourceVersion() override=default
std::array< uint32_t, 5 > version_t
Version is an array of 5 integers.
Definition SourceVersion.hpp:40
Definition Visitor.hpp:212
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Definition endianness_support.hpp:59
Namespace related to the LIEF's Mach-O module.
Definition Abstract/Header.hpp:36
#define LIEF_API
Definition visibility.h:45