LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
ObjC/Property.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_PROPERTY_H
16#define LIEF_OBJC_PROPERTY_H
18#include "LIEF/iterators.hpp"
19#include "LIEF/visibility.h"
20
21#include <memory>
22#include <string>
23
24
25namespace LIEF::objc {
26
27namespace details {
28class Property;
29class PropertyIt;
30}
31
34 public:
35 class Iterator final
36 : public iterator_facade_base<Iterator, std::bidirectional_iterator_tag,
37 Property, std::ptrdiff_t, const Property*,
38 const Property&> {
39 public:
40 using implementation = details::PropertyIt;
41 using iterator_facade_base::operator++;
42 using iterator_facade_base::operator--;
43
45
46 LIEF_API Iterator(std::unique_ptr<details::PropertyIt> impl);
47
50
52 LIEF_API Iterator& operator=(Iterator&&) noexcept;
53
55
56 friend LIEF_API bool operator==(const Iterator& LHS, const Iterator& RHS);
57
58 friend bool operator!=(const Iterator& LHS, const Iterator& RHS) {
59 return !(LHS == RHS);
60 }
61
62 // NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
64
65 // NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
67
69
70 // NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
71 LIEF_API const Property* operator->() const LIEF_LIFETIMEBOUND;
72
75 LIEF_API std::unique_ptr<Property> yield();
76
77 private:
78 void load() const;
79
80 std::unique_ptr<details::PropertyIt> impl_;
81 mutable std::unique_ptr<Property> cached_;
82 };
83
84 public:
85 Property(std::unique_ptr<details::Property> impl);
86
88 std::string name() const;
89
91 std::string attribute() const;
92
94
95 private:
96 std::unique_ptr<details::Property> impl_;
97};
98
99}
100
101#endif
std::unique_ptr< Property > yield()
Transfer ownership of the property at the current position to the caller. Returns nullptr if the iter...
Iterator(std::unique_ptr< details::PropertyIt > impl)
Iterator & operator=(const Iterator &)
const Property & operator*() const
details::PropertyIt implementation
Definition ObjC/Property.hpp:40
Iterator(Iterator &&) noexcept
std::string attribute() const
(raw) property's attributes (e.g. T@"NSString",C,D,N)
std::string name() const
Name of the property.
Property(std::unique_ptr< details::Property > impl)
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Definition Category.hpp:32
Namespace related to ObjC metadata.
Definition MachO/Binary.hpp:46
#define LIEF_API
Definition visibility.h:45