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/iterators.hpp"
19#include "LIEF/visibility.h"
20
21#include <string>
22#include <memory>
23#include <cstdint>
24
25namespace LIEF {
26namespace pdb {
27class Type;
28namespace types {
29
30namespace details {
31class Method;
32class MethodIt;
33}
34
38 public:
39 class Iterator final
40 : public iterator_facade_base<Iterator, std::forward_iterator_tag, Method,
41 std::ptrdiff_t, const Method*, const Method&> {
42 public:
43 using implementation = details::MethodIt;
44 using iterator_facade_base::operator++;
45
47
48 LIEF_API Iterator(std::unique_ptr<details::MethodIt> impl);
49
52
54 LIEF_API Iterator& operator=(Iterator&&) noexcept;
55
57
58 friend LIEF_API bool operator==(const Iterator& LHS, const Iterator& RHS);
59
60 friend bool operator!=(const Iterator& LHS, const Iterator& RHS) {
61 return !(LHS == RHS);
62 }
63
64 // NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
66
67 LIEF_API const Method& operator*() const;
68
69 // NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
70 LIEF_API const Method* operator->() const;
71
74 LIEF_API std::unique_ptr<Method> yield();
75
76 private:
77 void load() const;
78
79 std::unique_ptr<details::MethodIt> impl_;
80 mutable std::unique_ptr<Method> cached_;
81 };
82
83 public:
85 enum class TYPE {
86 VANILLA = 0x00,
87 VIRTUAL = 0x01,
88 STATIC = 0x02,
89 FRIEND = 0x03,
90 INTRODUCING_VIRTUAL =
91 0x04,
92 PURE_VIRTUAL = 0x05,
93 PURE_INTRODUCING_VIRTUAL =
94 0x06,
95 };
96
98 enum class ACCESS : uint8_t {
99 NONE = 0,
100 PRIVATE = 1,
101 PROTECTED = 2,
102 PUBLIC = 3,
103 };
104
105 Method(std::unique_ptr<details::Method> impl);
106
108 std::string name() const;
109
111 TYPE type() const;
112
114 ACCESS access() const;
115
117
118 private:
119 std::unique_ptr<details::Method> impl_;
120};
121
122}
123}
124}
125#endif
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition iterators.hpp:729
This is the base class for any PDB type.
Definition PDB/Type.hpp:37
Iterator(std::unique_ptr< details::MethodIt > impl)
std::unique_ptr< Method > yield()
Transfer ownership of the method at the current position to the caller. Returns nullptr if the iterat...
const Method & operator*() const
details::MethodIt implementation
Definition PDB/types/Method.hpp:43
Iterator(Iterator &&) noexcept
const Method * operator->() const
Iterator & operator=(const Iterator &)
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:98
TYPE
The type (or property) of the method.
Definition PDB/types/Method.hpp:85
Definition PDB/types/Attribute.hpp:30
Definition PDB/types/Array.hpp:23
Definition BuildMetadata.hpp:24
LIEF namespace.
Definition Abstract/Binary.hpp:40
#define LIEF_API
Definition visibility.h:45