LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
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
17#include <LIEF/iterators.hpp>
18#include <LIEF/visibility.h>
19
20#include <memory>
21#include <string>
22
23namespace LIEF {
24namespace objc {
25
26namespace details {
27class Property;
28class PropertyIt;
29}
30
33 public:
34 class Iterator final
35 : public iterator_facade_base<Iterator, std::bidirectional_iterator_tag,
36 Property, std::ptrdiff_t, const Property*,
37 const Property&> {
38 public:
39 using implementation = details::PropertyIt;
40 using iterator_facade_base::operator++;
41 using iterator_facade_base::operator--;
42
44
45 LIEF_API Iterator(std::unique_ptr<details::PropertyIt> impl);
46
49
51 LIEF_API Iterator& operator=(Iterator&&) noexcept;
52
54
55 friend LIEF_API bool operator==(const Iterator& LHS, const Iterator& RHS);
56
57 friend bool operator!=(const Iterator& LHS, const Iterator& RHS) {
58 return !(LHS == RHS);
59 }
60
61 // NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
63
64 // NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
66
67 LIEF_API const Property& operator*() const;
68
69 // NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
71
74 LIEF_API std::unique_ptr<Property> yield();
75
76 private:
77 void load() const;
78
79 std::unique_ptr<details::PropertyIt> impl_;
80 mutable std::unique_ptr<Property> cached_;
81 };
82
83 public:
84 Property(std::unique_ptr<details::Property> impl);
85
87 std::string name() const;
88
90 std::string attribute() const;
91
93
94 private:
95 std::unique_ptr<details::Property> impl_;
96};
97
98}
99}
100#endif
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition iterators.hpp:729
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
const Property & operator*() const
details::PropertyIt implementation
Definition Property.hpp:39
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)
Definition ObjC/Class.hpp:32
Namespace related to ObjC metadata.
Definition MachO/Binary.hpp:42
LIEF namespace.
Definition Abstract/Binary.hpp:40
#define LIEF_API
Definition visibility.h:45