LIEF: Library to Instrument Executable Formats
Version 1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
ObjC
ObjC/Method.hpp
Go to the documentation of this file.
1
/* Copyright 2022 - 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_OBJC_METHOD_H
16
#define LIEF_OBJC_METHOD_H
17
#include <
LIEF/visibility.h
>
18
19
#include <cstdint>
20
#include <memory>
21
#include <string>
22
23
namespace
LIEF
{
24
namespace
objc
{
25
26
namespace
details
{
27
class
Method;
28
class
MethodIt;
29
}
30
32
class
LIEF_API
Method
{
33
public
:
34
class
LIEF_API
Iterator
{
35
public
:
36
using
iterator_category
= std::bidirectional_iterator_tag;
37
using
value_type
= std::unique_ptr<Method>;
38
using
difference_type
= std::ptrdiff_t;
39
using
pointer
=
Method
*;
40
using
reference
= std::unique_ptr<Method>&;
41
using
implementation
= details::MethodIt;
42
43
class
LIEF_API
PointerProxy {
44
// Inspired from LLVM's iterator_facade_base
45
friend
class
Iterator
;
46
47
public
:
48
pointer
operator->
()
const
{
49
return
R.get();
50
}
51
52
private
:
53
value_type
R;
54
55
template
<
typename
RefT>
56
PointerProxy
(RefT&& R) :
57
R(
std
::forward<RefT>(R)) {
58
}
// NOLINT(bugprone-forwarding-reference-overload)
59
};
60
61
Iterator
(
const
Iterator
&);
62
Iterator
(
Iterator
&&) noexcept;
63
Iterator
(
std
::unique_ptr<
details
::MethodIt> impl);
64
~
Iterator
();
65
66
friend
LIEF_API
bool
operator==(const
Iterator
& LHS, const
Iterator
& RHS);
67
68
friend
LIEF_API
bool
operator!=(const
Iterator
& LHS, const
Iterator
& RHS) {
69
return
!(LHS == RHS);
70
}
71
72
Iterator
&
operator++
();
73
Iterator
&
operator--
();
74
75
Iterator
operator--
(
int
) {
76
Iterator
tmp = *
static_cast<
Iterator
*
>
(
this
);
77
--*
static_cast<
Iterator
*
>
(
this
);
78
return
tmp;
79
}
80
81
Iterator
operator++
(
int
) {
82
Iterator
tmp = *
static_cast<
Iterator
*
>
(
this
);
83
++*
static_cast<
Iterator
*
>
(
this
);
84
return
tmp;
85
}
86
87
std::unique_ptr<Method>
operator*
()
const
;
88
89
PointerProxy
operator->
()
const
{
90
return
static_cast<
const
Iterator
*
>
(
this
)->
operator
*();
91
}
92
93
private
:
94
std::unique_ptr<details::MethodIt> impl_;
95
};
96
97
public
:
98
Method
(std::unique_ptr<details::Method> impl);
99
101
std::string
name
()
const
;
102
104
std::string
mangled_type
()
const
;
105
107
uintptr_t
address
()
const
;
108
110
bool
is_instance
()
const
;
111
112
~Method
();
113
114
private
:
115
std::unique_ptr<details::Method> impl_;
116
};
117
118
}
119
}
120
#endif
LIEF::objc::Method::Iterator::PointerProxy
Definition
ObjC/Method.hpp:43
LIEF::objc::Method::Iterator::PointerProxy::Iterator
friend class Iterator
Definition
ObjC/Method.hpp:45
LIEF::objc::Method::Iterator::PointerProxy::operator->
pointer operator->() const
Definition
ObjC/Method.hpp:48
LIEF::objc::Method::Iterator::pointer
Method * pointer
Definition
ObjC/Method.hpp:39
LIEF::objc::Method::Iterator::Iterator
Iterator(Iterator &&) noexcept
LIEF::objc::Method::Iterator::difference_type
std::ptrdiff_t difference_type
Definition
ObjC/Method.hpp:38
LIEF::objc::Method::Iterator::Iterator
Iterator(const Iterator &)
LIEF::objc::Method::Iterator::value_type
std::unique_ptr< Method > value_type
Definition
ObjC/Method.hpp:37
LIEF::objc::Method::Iterator::operator*
std::unique_ptr< Method > operator*() const
LIEF::objc::Method::Iterator::operator++
Iterator operator++(int)
Definition
ObjC/Method.hpp:81
LIEF::objc::Method::Iterator::operator--
Iterator & operator--()
LIEF::objc::Method::Iterator::iterator_category
std::bidirectional_iterator_tag iterator_category
Definition
ObjC/Method.hpp:36
LIEF::objc::Method::Iterator::implementation
details::MethodIt implementation
Definition
ObjC/Method.hpp:41
LIEF::objc::Method::Iterator::operator++
Iterator & operator++()
LIEF::objc::Method::Iterator::reference
std::unique_ptr< Method > & reference
Definition
ObjC/Method.hpp:40
LIEF::objc::Method::Iterator::operator--
Iterator operator--(int)
Definition
ObjC/Method.hpp:75
LIEF::objc::Method::Iterator::operator->
PointerProxy operator->() const
Definition
ObjC/Method.hpp:89
LIEF::objc::Method::~Method
~Method()
LIEF::objc::Method::is_instance
bool is_instance() const
Whether it's an instance method.
LIEF::objc::Method::Method
Method(std::unique_ptr< details::Method > impl)
LIEF::objc::Method::name
std::string name() const
Name of the method.
LIEF::objc::Method::mangled_type
std::string mangled_type() const
Prototype of the method in its mangled representation (e.g. @16@0:8).
LIEF::objc::Method::address
uintptr_t address() const
Virtual address where this method is implemented in the binary.
LIEF::objc::details
Definition
ObjC/Class.hpp:32
LIEF::objc
Namespace related to ObjC metadata.
Definition
MachO/Binary.hpp:41
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
std
Definition
string.h:155
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:43
Generated by
1.17.0