LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
PDB/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_PDB_TYPE_ENUM_H
16#define LIEF_PDB_TYPE_ENUM_H
17
18#include "LIEF/visibility.h"
19#include "LIEF/PDB/Type.hpp"
20
21namespace LIEF {
22namespace pdb {
23namespace types {
24
25namespace details {
26class EnumEntry;
27}
28
30class LIEF_API Enum : public Type {
31 public:
32 using Type::Type;
33
37 public:
38 Entry(std::unique_ptr<details::EnumEntry> impl);
39 Entry(Entry&& other) noexcept;
40 Entry& operator=(Entry&& other) noexcept;
41
43 std::string name() const;
44
46 int64_t value() const;
47
49
50 private:
51 std::unique_ptr<details::EnumEntry> impl_;
52 };
53
55 std::string unique_name() const;
56
58 std::vector<Entry> entries() const;
59
61 const Type* underlying_type() const;
62
64 optional<Entry> find_entry(int64_t value) const;
65
66 static bool classof(const Type* type) {
67 return type->kind() == Type::KIND::ENUM;
68 }
69
70 ~Enum() override;
71
72 protected:
73 mutable std::unique_ptr<Type> underlying_;
74};
75
76}
77}
78}
79#endif
80
81
Definition optional.hpp:23
@ ENUM
Definition PDB/Type.hpp:92
KIND kind() const
Entry(Entry &&other) noexcept
int64_t value() const
Enum entry's value (if any).
Entry & operator=(Entry &&other) noexcept
Entry(std::unique_ptr< details::EnumEntry > impl)
std::string name() const
Enum entry's name.
This class represents a LF_ENUM PDB type.
Definition PDB/types/Enum.hpp:30
std::string unique_name() const
Enum's mangled name.
std::vector< Entry > entries() const
Return the different entries associated with this enum.
optional< Entry > find_entry(int64_t value) const
Try to find the enum matching the given value.
const Type * underlying_type() const
The underlying type that is used to encode this enum.
static bool classof(const Type *type)
Definition PDB/types/Enum.hpp:66
Definition PDB/types/Attribute.hpp:29
Definition PDB/types/Array.hpp:23
Definition BuildMetadata.hpp:24
LIEF namespace.
Definition Abstract/Binary.hpp:40
#define LIEF_API
Definition visibility.h:41