LIEF: Library to Instrument Executable Formats
Version 1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
PDB
PDB/Type.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_H
16
#define LIEF_PDB_TYPE_H
17
#include <cstdint>
18
#include <memory>
19
#include <string>
20
21
#include "
LIEF/compiler_attributes.hpp
"
22
#include "
LIEF/iterators.hpp
"
23
#include "
LIEF/visibility.h
"
24
#include "
LIEF/optional.hpp
"
25
#include "
LIEF/DebugDeclOpt.hpp
"
26
27
namespace
LIEF
{
28
namespace
pdb
{
29
30
namespace
details
{
31
class
Type;
32
class
TypeIt;
33
}
34
36
class
LIEF_API
Type
{
37
public
:
38
class
Iterator
final
39
:
public
iterator_facade_base
<Iterator, std::forward_iterator_tag, Type,
40
std::ptrdiff_t, const Type*, const Type&> {
41
public
:
42
using
implementation
= details::TypeIt;
43
using
iterator_facade_base::operator++;
44
45
LIEF_API
Iterator
();
46
47
LIEF_API
Iterator
(std::unique_ptr<details::TypeIt> impl);
48
49
LIEF_API
Iterator
(
const
Iterator
&);
50
LIEF_API
Iterator
&
operator=
(
const
Iterator
&);
51
52
LIEF_API
Iterator
(
Iterator
&&) noexcept;
53
LIEF_API
Iterator
& operator=(
Iterator
&&) noexcept;
54
55
LIEF_API
~
Iterator
();
56
57
friend
LIEF_API
bool
operator==(const
Iterator
& LHS, const
Iterator
& RHS);
58
59
friend
bool
operator!=(const
Iterator
& LHS, const
Iterator
& RHS) {
60
return
!(LHS == RHS);
61
}
62
63
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
64
LIEF_API
Iterator
&
operator++
();
65
66
LIEF_API
const
Type
&
operator*
() const
LIEF_LIFETIMEBOUND
;
67
68
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
69
LIEF_API
const
Type
* operator->() const
LIEF_LIFETIMEBOUND
;
70
73
LIEF_API
std::unique_ptr<
Type
>
yield
();
74
75
private:
76
void
load() const;
77
78
std::unique_ptr<
details
::TypeIt> impl_;
79
mutable std::unique_ptr<
Type
> cached_;
80
};
81
82
LIEF_LOCAL
Type
(std::unique_ptr<
details
::
Type
> impl);
83
84
enum class
KIND
{
85
UNKNOWN = 0,
86
CLASS,
87
POINTER,
88
SIMPLE,
89
ENUM,
90
FUNCTION,
91
MODIFIER,
92
BITFIELD,
93
ARRAY,
94
UNION,
95
STRUCTURE,
96
INTERFACE,
97
};
98
99
KIND
kind
()
const
;
100
103
optional<uint64_t>
size
()
const
;
104
106
optional<std::string>
name
()
const
;
107
109
std::string
to_decl
(
const
DeclOpt
& opt =
DeclOpt
())
const
;
110
111
template
<
class
T>
112
const
T*
as
()
const
{
113
if
(T::classof(
this
)) {
114
return
static_cast<
const
T*
>
(
this
);
115
}
116
return
nullptr
;
117
}
118
119
static
std::unique_ptr<Type>
120
create
(std::unique_ptr<details::Type> impl
LIEF_LIFETIMEBOUND
);
121
122
virtual
~Type
();
123
124
protected
:
125
std::unique_ptr<details::Type> impl_;
126
};
127
128
}
129
}
130
#endif
DebugDeclOpt.hpp
LIEF::DeclOpt
Configuration options for generated code from debug info.
Definition
DebugDeclOpt.hpp:36
LIEF::iterator_facade_base
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition
iterators.hpp:729
LIEF::optional
Definition
optional.hpp:23
LIEF::pdb::Type::Iterator::Iterator
Iterator(const Iterator &)
LIEF::pdb::Type::Iterator::Iterator
Iterator(Iterator &&) noexcept
LIEF::pdb::Type::Iterator::operator=
Iterator & operator=(const Iterator &)
LIEF::pdb::Type::Iterator::operator++
Iterator & operator++()
LIEF::pdb::Type::Iterator::Iterator
Iterator()
LIEF::pdb::Type::Iterator::Iterator
Iterator(std::unique_ptr< details::TypeIt > impl)
LIEF::pdb::Type::Iterator::operator*
const Type & operator*() const
LIEF::pdb::Type::Iterator::yield
std::unique_ptr< Type > yield()
Transfer ownership of the type at the current position to the caller. Returns nullptr if the iterator...
LIEF::pdb::Type::Iterator::implementation
details::TypeIt implementation
Definition
PDB/Type.hpp:42
LIEF::pdb::Type::as
const T * as() const
Definition
PDB/Type.hpp:112
LIEF::pdb::Type::Type
Type(std::unique_ptr< details::Type > impl)
LIEF::pdb::Type::to_decl
std::string to_decl(const DeclOpt &opt=DeclOpt()) const
Generates a C/C++ definition for this type.
LIEF::pdb::Type::KIND
KIND
Definition
PDB/Type.hpp:84
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::size
optional< uint64_t > size() const
Size of the type. This size should match the value of sizeof(...) applied to this type.
LIEF::pdb::Type::name
optional< std::string > name() const
Type's name (if present).
LIEF::pdb::Type::kind
KIND kind() const
compiler_attributes.hpp
LIEF_LIFETIMEBOUND
#define LIEF_LIFETIMEBOUND
Definition
compiler_attributes.hpp:72
iterators.hpp
LIEF::pdb::details
Definition
BuildMetadata.hpp:27
LIEF::pdb
Definition
BuildMetadata.hpp:25
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:41
optional.hpp
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
LIEF_LOCAL
#define LIEF_LOCAL
Definition
visibility.h:46
Generated by
1.17.0