LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
PDB/types/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_PDB_TYPE_METHOD_H
16#define LIEF_PDB_TYPE_METHOD_H
17
18#include "LIEF/visibility.h"
19
20#include <string>
21#include <memory>
22#include <cstdint>
23
24namespace LIEF {
25namespace pdb {
26class Type;
27namespace types {
28
29namespace details {
30class Method;
31class MethodIt;
32}
33
37 public:
39 public:
40 using iterator_category = std::forward_iterator_tag;
41 using value_type = std::unique_ptr<Method>;
42 using difference_type = std::ptrdiff_t;
43 using pointer = Method*;
44 using reference = Method&;
45 using implementation = details::MethodIt;
46
47 class LIEF_API PointerProxy {
48 // Inspired from LLVM's iterator_facade_base
49 friend class Iterator;
50
51 public:
53 return R.get();
54 }
55
56 private:
57 value_type R;
58
59 template<typename RefT>
60 PointerProxy(RefT&& R) :
61 R(std::forward<RefT>(R)) {
62 } // NOLINT(bugprone-forwarding-reference-overload)
63 };
65 Iterator(Iterator&&) noexcept;
66 Iterator(std::unique_ptr<details::MethodIt> impl);
68
69 friend LIEF_API bool operator==(const Iterator& LHS, const Iterator& RHS);
70
71 friend LIEF_API bool operator!=(const Iterator& LHS, const Iterator& RHS) {
72 return !(LHS == RHS);
73 }
74
76
78 Iterator tmp = *static_cast<Iterator*>(this);
79 ++*static_cast<Iterator*>(this);
80 return tmp;
81 }
82
83 std::unique_ptr<Method> operator*() const;
84
86 return static_cast<const Iterator*>(this)->operator*();
87 }
88
89 private:
90 std::unique_ptr<details::MethodIt> impl_;
91 };
92
93 public:
95 enum class TYPE {
96 VANILLA = 0x00,
97 VIRTUAL = 0x01,
98 STATIC = 0x02,
99 FRIEND = 0x03,
100 INTRODUCING_VIRTUAL =
101 0x04,
102 PURE_VIRTUAL = 0x05,
103 PURE_INTRODUCING_VIRTUAL =
104 0x06,
105 };
106
108 enum class ACCESS : uint8_t {
109 NONE = 0,
110 PRIVATE = 1,
111 PROTECTED = 2,
112 PUBLIC = 3,
113 };
114
115 Method(std::unique_ptr<details::Method> impl);
116
118 std::string name() const;
119
121 TYPE type() const;
122
124 ACCESS access() const;
125
127
128 private:
129 std::unique_ptr<details::Method> impl_;
130};
131
132}
133}
134}
135#endif
This is the base class for any PDB type.
Definition PDB/Type.hpp:34
Definition PDB/types/Method.hpp:47
pointer operator->() const
Definition PDB/types/Method.hpp:52
friend class Iterator
Definition PDB/types/Method.hpp:49
std::unique_ptr< Method > value_type
Definition PDB/types/Method.hpp:41
std::ptrdiff_t difference_type
Definition PDB/types/Method.hpp:42
PointerProxy operator->() const
Definition PDB/types/Method.hpp:85
Method * pointer
Definition PDB/types/Method.hpp:43
std::unique_ptr< Method > operator*() const
Method & reference
Definition PDB/types/Method.hpp:44
details::MethodIt implementation
Definition PDB/types/Method.hpp:45
Iterator(Iterator &&) noexcept
Iterator operator++(int)
Definition PDB/types/Method.hpp:77
std::forward_iterator_tag iterator_category
Definition PDB/types/Method.hpp:40
TYPE type() const
Type/Properties of the method (virtual, static, etc.).
Method(std::unique_ptr< details::Method > impl)
std::string name() const
Name of the method.
ACCESS access() const
Visibility access (public, private, ...).
ACCESS
Visibility access for the method.
Definition PDB/types/Method.hpp:108
TYPE
The type (or property) of the method.
Definition PDB/types/Method.hpp:95
Definition PDB/types/Attribute.hpp:29
Definition PDB/types/Array.hpp:23
Definition BuildMetadata.hpp:24
LIEF namespace.
Definition Abstract/Binary.hpp:40
Definition string.h:155
#define LIEF_API
Definition visibility.h:43