LIEF: Library to Instrument Executable Formats
Version 0.17.4
Toggle main menu visibility
Loading...
Searching...
No Matches
install
linux
x86_64
sdk
static
include
LIEF
PDB
PDB/Type.hpp
Go to the documentation of this file.
1
/* Copyright 2022 - 2025 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_H
16
#define LIEF_PDB_TYPE_H
17
#include <memory>
18
19
#include "
LIEF/visibility.h
"
20
21
namespace
LIEF
{
22
namespace
pdb
{
23
24
namespace
details
{
25
class
Type;
26
class
TypeIt;
27
}
28
30
class
LIEF_API
Type {
31
public
:
32
class
LIEF_API
Iterator
{
33
public
:
34
using
iterator_category
= std::forward_iterator_tag;
35
using
value_type
= std::unique_ptr<Type>;
36
using
difference_type
= std::ptrdiff_t;
37
using
pointer
= Type*;
38
using
reference
= Type&;
39
using
implementation
= details::TypeIt;
40
41
class
LIEF_API
PointerProxy {
42
// Inspired from LLVM's iterator_facade_base
43
friend
class
Iterator
;
44
public
:
45
pointer
operator->
()
const
{
return
R.get(); }
46
47
private
:
48
value_type
R;
49
50
template
<
typename
RefT>
51
PointerProxy
(RefT &&R) : R(std::forward<RefT>(R)) {}
// NOLINT(bugprone-forwarding-reference-overload)
52
};
53
54
Iterator
(
const
Iterator
&);
55
Iterator
(
Iterator
&&) noexcept;
56
Iterator
(std::unique_ptr<
details
::TypeIt> impl);
57
~
Iterator
();
58
59
friend
LIEF_API
bool
operator==(const
Iterator
& LHS, const
Iterator
& RHS);
60
61
friend
LIEF_API
bool
operator!=(const
Iterator
& LHS, const
Iterator
& RHS) {
62
return
!(LHS == RHS);
63
}
64
65
Iterator
&
operator++
();
66
67
Iterator
operator++
(
int
) {
68
Iterator
tmp = *
static_cast<
Iterator
*
>
(
this
);
69
++*
static_cast<
Iterator
*
>
(
this
);
70
return
tmp;
71
}
72
73
std::unique_ptr<Type>
operator*
()
const
;
74
75
PointerProxy
operator->
()
const
{
76
return
static_cast<
const
Iterator
*
>
(
this
)->
operator
*();
77
}
78
79
private
:
80
std::unique_ptr<details::TypeIt> impl_;
81
};
82
83
enum class
KIND
{
84
UNKNOWN = 0,
85
CLASS,
86
POINTER,
87
SIMPLE,
88
ENUM,
89
FUNCTION,
90
MODIFIER,
91
BITFIELD,
92
ARRAY,
93
UNION,
94
STRUCTURE,
95
INTERFACE,
96
};
97
98
KIND
kind
()
const
;
99
100
template
<
class
T>
101
const
T*
as
()
const
{
102
if
(T::classof(
this
)) {
103
return
static_cast<
const
T*
>
(
this
);
104
}
105
return
nullptr
;
106
}
107
108
static
std::unique_ptr<Type>
create
(std::unique_ptr<details::Type> impl);
109
110
virtual
~Type
();
111
112
protected
:
113
Type(std::unique_ptr<details::Type> impl);
114
std::unique_ptr<details::Type> impl_;
115
};
116
117
}
118
}
119
#endif
120
LIEF::pdb::Type::Iterator::PointerProxy
Definition
PDB/Type.hpp:41
LIEF::pdb::Type::Iterator::PointerProxy::operator->
pointer operator->() const
Definition
PDB/Type.hpp:45
LIEF::pdb::Type::Iterator::PointerProxy::Iterator
friend class Iterator
Definition
PDB/Type.hpp:43
LIEF::pdb::Type::Iterator::Iterator
Iterator(const Iterator &)
LIEF::pdb::Type::Iterator::Iterator
Iterator(Iterator &&) noexcept
LIEF::pdb::Type::Iterator::operator->
PointerProxy operator->() const
Definition
PDB/Type.hpp:75
LIEF::pdb::Type::Iterator::pointer
Type * pointer
Definition
PDB/Type.hpp:37
LIEF::pdb::Type::Iterator::operator++
Iterator & operator++()
LIEF::pdb::Type::Iterator::value_type
std::unique_ptr< Type > value_type
Definition
PDB/Type.hpp:35
LIEF::pdb::Type::Iterator::reference
Type & reference
Definition
PDB/Type.hpp:38
LIEF::pdb::Type::Iterator::iterator_category
std::forward_iterator_tag iterator_category
Definition
PDB/Type.hpp:34
LIEF::pdb::Type::Iterator::operator*
std::unique_ptr< Type > operator*() const
LIEF::pdb::Type::Iterator::implementation
details::TypeIt implementation
Definition
PDB/Type.hpp:39
LIEF::pdb::Type::Iterator::difference_type
std::ptrdiff_t difference_type
Definition
PDB/Type.hpp:36
LIEF::pdb::Type::Iterator::operator++
Iterator operator++(int)
Definition
PDB/Type.hpp:67
LIEF::pdb::Type::as
const T * as() const
Definition
PDB/Type.hpp:101
LIEF::pdb::Type::KIND
KIND
Definition
PDB/Type.hpp:83
LIEF::pdb::Type::~Type
virtual ~Type()
LIEF::pdb::Type::create
static std::unique_ptr< Type > create(std::unique_ptr< details::Type > impl)
LIEF::pdb::Type::kind
KIND kind() const
LIEF::pdb::details
Definition
BuildMetadata.hpp:26
LIEF::pdb
Definition
BuildMetadata.hpp:24
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:41
Generated by
1.17.0