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
Protocol.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_PROTOCOL_H
16
#define LIEF_OBJC_PROTOCOL_H
17
#include <
LIEF/visibility.h
>
18
#include <
LIEF/iterators.hpp
>
19
20
#include <
LIEF/ObjC/Method.hpp
>
21
#include <
LIEF/ObjC/Property.hpp
>
22
#include <
LIEF/ObjC/DeclOpt.hpp
>
23
24
#include <memory>
25
#include <string>
26
27
namespace
LIEF
{
28
namespace
objc
{
29
30
namespace
details
{
31
class
Protocol;
32
class
ProtocolIt;
33
}
34
36
class
LIEF_API
Protocol
{
37
public
:
38
class
Iterator
final
39
:
public
iterator_facade_base
<Iterator, std::bidirectional_iterator_tag,
40
Protocol, std::ptrdiff_t, const Protocol*,
41
const Protocol&> {
42
public
:
43
using
implementation
= details::ProtocolIt;
44
using
iterator_facade_base::operator++;
45
using
iterator_facade_base::operator--;
46
47
LIEF_API
Iterator
();
48
49
LIEF_API
Iterator
(std::unique_ptr<details::ProtocolIt> impl);
50
51
LIEF_API
Iterator
(
const
Iterator
&);
52
LIEF_API
Iterator
&
operator=
(
const
Iterator
&);
53
54
LIEF_API
Iterator
(
Iterator
&&) noexcept;
55
LIEF_API
Iterator
& operator=(
Iterator
&&) noexcept;
56
57
LIEF_API
~
Iterator
();
58
59
friend
LIEF_API
bool
operator==(const
Iterator
& LHS, const
Iterator
& RHS);
60
61
friend
bool
operator!=(const
Iterator
& LHS, const
Iterator
& RHS) {
62
return
!(LHS == RHS);
63
}
64
65
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
66
LIEF_API
Iterator
&
operator++
();
67
68
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
69
LIEF_API
Iterator
&
operator--
();
70
71
LIEF_API
const
Protocol
&
operator*
()
const
;
72
73
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
74
LIEF_API
const
Protocol
*
operator->
()
const
;
75
78
LIEF_API
std::unique_ptr<Protocol>
yield
();
79
80
private
:
81
void
load()
const
;
82
83
std::unique_ptr<details::ProtocolIt> impl_;
84
mutable
std::unique_ptr<Protocol> cached_;
85
};
86
87
public
:
88
using
methods_it
=
iterator_range<Method::Iterator>
;
89
using
properties_it
=
iterator_range<Property::Iterator>
;
90
91
Protocol
(std::unique_ptr<details::Protocol> impl);
92
94
std::string
mangled_name
()
const
;
95
97
methods_it
optional_methods
()
const
;
98
100
methods_it
required_methods
()
const
;
101
103
properties_it
properties
()
const
;
104
108
std::string
to_decl
(
const
DeclOpt
& opt =
DeclOpt
())
const
;
109
110
~Protocol
();
111
112
private
:
113
std::unique_ptr<details::Protocol> impl_;
114
};
115
116
}
117
}
118
#endif
DeclOpt.hpp
Method.hpp
Property.hpp
LIEF::iterator_facade_base
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition
iterators.hpp:729
LIEF::iterator_range
Definition
iterators.hpp:601
LIEF::objc::Protocol::Iterator::operator*
const Protocol & operator*() const
LIEF::objc::Protocol::Iterator::operator++
Iterator & operator++()
LIEF::objc::Protocol::Iterator::Iterator
Iterator(Iterator &&) noexcept
LIEF::objc::Protocol::Iterator::Iterator
Iterator(std::unique_ptr< details::ProtocolIt > impl)
LIEF::objc::Protocol::Iterator::operator->
const Protocol * operator->() const
LIEF::objc::Protocol::Iterator::Iterator
Iterator(const Iterator &)
LIEF::objc::Protocol::Iterator::operator=
Iterator & operator=(const Iterator &)
LIEF::objc::Protocol::Iterator::yield
std::unique_ptr< Protocol > yield()
Transfer ownership of the protocol at the current position to the caller. Returns nullptr if the iter...
LIEF::objc::Protocol::Iterator::operator--
Iterator & operator--()
LIEF::objc::Protocol::Iterator::Iterator
Iterator()
LIEF::objc::Protocol::Iterator::implementation
details::ProtocolIt implementation
Definition
Protocol.hpp:43
LIEF::objc::Protocol::to_decl
std::string to_decl(const DeclOpt &opt=DeclOpt()) const
Generate a header-like string for this specific protocol.
LIEF::objc::Protocol::optional_methods
methods_it optional_methods() const
Iterator over the methods that could be overridden.
LIEF::objc::Protocol::required_methods
methods_it required_methods() const
Iterator over the methods of this protocol that must be implemented.
LIEF::objc::Protocol::properties
properties_it properties() const
Iterator over the properties defined in this protocol.
LIEF::objc::Protocol::Protocol
Protocol(std::unique_ptr< details::Protocol > impl)
LIEF::objc::Protocol::methods_it
iterator_range< Method::Iterator > methods_it
Definition
Protocol.hpp:88
LIEF::objc::Protocol::mangled_name
std::string mangled_name() const
Mangled name of the protocol.
LIEF::objc::Protocol::~Protocol
~Protocol()
LIEF::objc::Protocol::properties_it
iterator_range< Property::Iterator > properties_it
Definition
Protocol.hpp:89
iterators.hpp
LIEF::objc::details
Definition
ObjC/Class.hpp:32
LIEF::objc
Namespace related to ObjC metadata.
Definition
MachO/Binary.hpp:42
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
LIEF::objc::DeclOpt
This structure wraps options to tweak the generated output of functions like LIEF::objc::Metadata::to...
Definition
DeclOpt.hpp:22
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
Generated by
1.17.0