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
DWARF
types
DWARF/types/Enum.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_DWARF_TYPE_ENUM_H
16
#define LIEF_DWARF_TYPE_ENUM_H
17
18
#include "
LIEF/compiler_attributes.hpp
"
19
#include "
LIEF/visibility.h
"
20
#include "
LIEF/optional.hpp
"
21
#include "
LIEF/DWARF/Type.hpp
"
22
23
namespace
LIEF
{
24
namespace
dwarf
{
25
namespace
types
{
26
27
namespace
details
{
28
class
EnumEntry;
29
}
30
32
class
LIEF_API
Enum
:
public
Type
{
33
public
:
34
template
<
typename
... Args,
35
typename
=
typename
std::
36
enable_if<std::is_constructible<
Type
, Args&&...>::value>::type>
37
Enum
(Args&&... args) :
38
Type
(std::forward<Args>(args)...) {}
39
40
Enum
(
const
Enum
&) =
delete
;
41
Enum
&
operator=
(
const
Enum
&) =
delete
;
42
43
Enum
(
Enum
&&) noexcept = default;
44
Enum
& operator=(
Enum
&&) noexcept = default;
45
48
class
LIEF_API
Entry
{
49
public
:
50
Entry
(std::unique_ptr<details::EnumEntry> impl);
51
Entry
(
Entry
&& other)
noexcept
;
52
Entry
&
operator=
(
Entry
&& other)
noexcept
;
53
54
Entry
(
const
Entry
&) =
delete
;
55
Entry
&
operator=
(
const
Entry
&) =
delete
;
56
58
std::string
name
()
const
;
59
61
optional<int64_t>
value
()
const
;
62
63
~Entry
();
64
65
private
:
66
std::unique_ptr<details::EnumEntry> impl_;
67
};
68
70
std::vector<Entry>
entries
() const
LIEF_LIFETIMEBOUND
;
71
73
const
Type
*
underlying_type
() const
LIEF_LIFETIMEBOUND
;
74
76
optional
<
Entry
>
find_entry
(int64_t value) const
LIEF_LIFETIMEBOUND
;
77
78
static
bool
classof
(const
Type
* type) {
79
return
type->kind() ==
Type::KIND::ENUM
;
80
}
81
82
~Enum
()
override
;
83
84
protected
:
85
mutable
std::unique_ptr<Type> underlying_;
86
};
87
88
}
89
}
90
}
91
#endif
Type.hpp
LIEF::dwarf::Type::KIND::ENUM
@ ENUM
Definition
DWARF/Type.hpp:156
LIEF::dwarf::Type::Type
Type(std::unique_ptr< details::Type > impl)
LIEF::dwarf::types::Enum::Entry
This class represents an enum entry which is essentially composed of a name and its value (integer).
Definition
DWARF/types/Enum.hpp:48
LIEF::dwarf::types::Enum::Entry::operator=
Entry & operator=(Entry &&other) noexcept
LIEF::dwarf::types::Enum::Entry::Entry
Entry(Entry &&other) noexcept
LIEF::dwarf::types::Enum::Entry::Entry
Entry(const Entry &)=delete
LIEF::dwarf::types::Enum::Entry::value
optional< int64_t > value() const
Enum entry's value (if any).
LIEF::dwarf::types::Enum::Entry::Entry
Entry(std::unique_ptr< details::EnumEntry > impl)
LIEF::dwarf::types::Enum::Entry::~Entry
~Entry()
LIEF::dwarf::types::Enum::Entry::name
std::string name() const
Enum entry's name.
LIEF::dwarf::types::Enum::Entry::operator=
Entry & operator=(const Entry &)=delete
LIEF::dwarf::types::Enum::underlying_type
const Type * underlying_type() const
The underlying type that is used to encode this enum.
LIEF::dwarf::types::Enum::Enum
Enum(Args &&... args)
Definition
DWARF/types/Enum.hpp:37
LIEF::dwarf::types::Enum::Enum
Enum(Enum &&) noexcept=default
LIEF::dwarf::types::Enum::find_entry
optional< Entry > find_entry(int64_t value) const
Try to find the enum matching the given value.
LIEF::dwarf::types::Enum::entries
std::vector< Entry > entries() const
Return the different entries associated with this enum.
LIEF::dwarf::types::Enum::~Enum
~Enum() override
LIEF::dwarf::types::Enum::classof
static bool classof(const Type *type)
Definition
DWARF/types/Enum.hpp:78
LIEF::dwarf::types::Enum::operator=
Enum & operator=(const Enum &)=delete
LIEF::dwarf::types::Enum::Enum
Enum(const Enum &)=delete
LIEF::optional
Definition
optional.hpp:23
compiler_attributes.hpp
LIEF_LIFETIMEBOUND
#define LIEF_LIFETIMEBOUND
Definition
compiler_attributes.hpp:72
LIEF::dwarf::types::details
Definition
DWARF/types/ClassLike.hpp:27
LIEF::dwarf::types
Definition
DWARF/types/Array.hpp:24
LIEF::dwarf
Namespace for the DWARF debug format.
Definition
DWARF/CompilationUnit.hpp:30
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:41
optional.hpp
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
Generated by
1.17.0