LIEF: Library to Instrument Executable Formats
Version 2.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/compiler_attributes.hpp
"
18
#include "
LIEF/iterators.hpp
"
19
#include "
LIEF/visibility.h
"
20
21
#include <cstdint>
22
#include <memory>
23
#include <string>
24
25
26
namespace
LIEF::objc
{
27
28
namespace
details
{
29
class
Method;
30
class
MethodIt;
31
}
32
34
class
LIEF_API
Method
{
35
public
:
36
class
Iterator
final
37
:
public
iterator_facade_base<Iterator, std::bidirectional_iterator_tag,
38
Method, std::ptrdiff_t, const Method*,
39
const Method&> {
40
public
:
41
using
implementation
= details::MethodIt;
42
using
iterator_facade_base::operator++;
43
using
iterator_facade_base::operator--;
44
45
LIEF_API
Iterator
();
46
47
LIEF_API
Iterator
(std::unique_ptr<details::MethodIt> impl);
48
49
LIEF_API
Iterator
(
const
Iterator
&);
50
LIEF_API
Iterator
&
operator=
(
const
Iterator
&);
51
52
LIEF_API
Iterator
(
Iterator
&&) noexcept;
53
LIEF_API
Iterator
& operator=(
Iterator
&&) noexcept;
54
55
LIEF_API
~
Iterator
();
56
57
friend
LIEF_API
bool
operator==(const
Iterator
& LHS, const
Iterator
& RHS);
58
59
friend
bool
operator!=(const
Iterator
& LHS, const
Iterator
& RHS) {
60
return
!(LHS == RHS);
61
}
62
63
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
64
LIEF_API
Iterator
&
operator++
();
65
66
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
67
LIEF_API
Iterator
&
operator--
();
68
69
LIEF_API
const
Method
&
operator*
() const
LIEF_LIFETIMEBOUND
;
70
71
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
72
LIEF_API
const
Method
* operator->() const
LIEF_LIFETIMEBOUND
;
73
76
LIEF_API
std::unique_ptr<
Method
>
yield
();
77
78
private:
79
void
load() const;
80
81
std::unique_ptr<
details
::MethodIt> impl_;
82
mutable std::unique_ptr<
Method
> cached_;
83
};
84
85
public:
86
Method
(std::unique_ptr<
details
::
Method
> impl);
87
89
std::
string
name
() const;
90
92
std::
string
mangled_type
() const;
93
95
uintptr_t
address
() const;
96
98
bool
is_instance
() const;
99
100
~
Method
();
101
102
private:
103
std::unique_ptr<
details
::
Method
> impl_;
104
};
105
106
}
107
108
#endif
LIEF::objc::Method::Iterator::Iterator
Iterator(Iterator &&) noexcept
LIEF::objc::Method::Iterator::Iterator
Iterator(const Iterator &)
LIEF::objc::Method::Iterator::Iterator
Iterator(std::unique_ptr< details::MethodIt > impl)
LIEF::objc::Method::Iterator::Iterator
Iterator()
LIEF::objc::Method::Iterator::operator*
const Method & operator*() const
LIEF::objc::Method::Iterator::operator--
Iterator & operator--()
LIEF::objc::Method::Iterator::operator=
Iterator & operator=(const Iterator &)
LIEF::objc::Method::Iterator::implementation
details::MethodIt implementation
Definition
ObjC/Method.hpp:41
LIEF::objc::Method::Iterator::operator++
Iterator & operator++()
LIEF::objc::Method::Iterator::yield
std::unique_ptr< Method > yield()
Transfer ownership of the method at the current position to the caller. Returns nullptr if the iterat...
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.
compiler_attributes.hpp
LIEF_LIFETIMEBOUND
#define LIEF_LIFETIMEBOUND
Definition
compiler_attributes.hpp:72
iterators.hpp
LIEF::objc::details
Definition
Category.hpp:32
LIEF::objc
Namespace related to ObjC metadata.
Definition
MachO/Binary.hpp:46
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
Generated by
1.19.0