LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
Simple.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_SIMPLE_H
16#define LIEF_PDB_TYPE_SIMPLE_H
17
18#include "LIEF/PDB/Type.hpp"
19#include "LIEF/visibility.h"
20
21
22namespace LIEF::pdb::types {
23
26class LIEF_API Simple : public Type {
27 public:
28 template<typename... Args,
29 typename = std::enable_if_t<std::is_constructible_v<Type, Args&&...>>>
30 Simple(Args&&... args) :
31 Type(std::forward<Args>(args)...) {}
32
36 enum class TYPES {
37 UNKNOWN = 0,
38 VOID_ = 0x0003,
39
40 // --- Characters ---
41 SCHAR = 0x0010,
42 UCHAR = 0x0020,
43 RCHAR = 0x0070,
44
45 // --- Unicode / Wide Characters ---
46 WCHAR = 0x0071,
47 CHAR16 = 0x007a,
48 CHAR32 = 0x007b,
49 CHAR8 = 0x007c,
50
51 // --- Bytes ---
52 SBYTE = 0x0068,
53 UBYTE = 0x0069,
54
55 // --- Short (16-bit) ---
56 SSHORT = 0x0011,
57 USHORT = 0x0021,
58
59 SINT16 = 0x0072,
60 UINT16 = 0x0073,
61
62 // --- Long (32-bit) ---
63 SLONG = 0x0012,
64 ULONG = 0x0022,
65
66 SINT32 = 0x0074,
67 UINT32 = 0x0075,
68
69 // --- Quad (64-bit) ---
70 SQUAD = 0x0013,
71 UQUAD = 0x0023,
72
73 SINT64 = 0x0076,
74 UINT64 = 0x0077,
75
76 // --- Octa (128-bit) ---
77 SOCTA = 0x0014,
78 UOCTA = 0x0024,
79
80 SINT128 = 0x0078,
81 UINT128 = 0x0079,
82
83 // --- Floating Point ---
84 FLOAT16 = 0x0046,
85 FLOAT32 = 0x0040,
86 FLOAT32_PARTIAL_PRECISION = 0x45,
87
88 FLOAT48 = 0x0044,
89 FLOAT64 = 0x0041,
90 FLOAT80 = 0x0042,
91 FLOAT128 = 0x0043,
92
93 // --- Complex Numbers ---
94 COMPLEX16 = 0x0056,
95 COMPLEX32 = 0x0050,
96 COMPLEX32_PARTIAL_PRECISION = 0x0055,
97 COMPLEX48 = 0x0054,
98 COMPLEX64 = 0x0051,
99 COMPLEX80 = 0x0052,
100 COMPLEX128 = 0x0053,
101
102 // --- Booleans ---
103 BOOL8 = 0x0030,
104 BOOL16 = 0x0031,
105 BOOL32 = 0x0032,
106 BOOL64 = 0x0033,
107 BOOL128 = 0x0034,
108 };
109
113 enum class MODES : uint32_t {
114 DIRECT = 0x00000000,
115 FAR_POINTER = 0x00000200,
116 HUGE_POINTER = 0x00000300,
117 NEAR_POINTER32 = 0x00000400,
118 FAR_POINTER32 = 0x00000500,
119 NEAR_POINTER64 = 0x00000600,
120 NEAR_POINTER128 = 0x00000700,
121 };
122
124 TYPES type() const;
125
127 MODES modes() const;
128
130 bool is_pointer() const {
131 return modes() != MODES::DIRECT;
132 }
133
135 bool is_signed() const {
136 const TYPES ty = type();
137 return ty == TYPES::SCHAR || ty == TYPES::SBYTE || ty == TYPES::SSHORT ||
138 ty == TYPES::SINT16 || ty == TYPES::SLONG || ty == TYPES::SINT32 ||
139 ty == TYPES::SQUAD || ty == TYPES::SINT64 || ty == TYPES::SOCTA ||
140 ty == TYPES::SINT128;
141 }
142
143 static bool classof(const Type* type) {
144 return type->kind() == Type::KIND::SIMPLE;
145 }
146
147 ~Simple() override;
148};
149
150}
151
152
153#endif
Type(std::unique_ptr< details::Type > impl)
@ SIMPLE
Definition PDB/Type.hpp:88
bool is_signed() const
Check if the underlying type is signed.
Definition Simple.hpp:135
MODES
Modifier applied to the underlying type.
Definition Simple.hpp:113
@ DIRECT
Not a pointer (direct access).
Definition Simple.hpp:114
static bool classof(const Type *type)
Definition Simple.hpp:143
MODES modes() const
Returns the mode (pointer type) of this Simple type.
TYPES type() const
Returns the underlying primitive type.
bool is_pointer() const
Check if this simple type is a pointer.
Definition Simple.hpp:130
TYPES
Identifier of the primitive type.
Definition Simple.hpp:36
@ SINT128
Explicit Signed 128-bit Integer.
Definition Simple.hpp:80
@ SOCTA
Signed Octaword.
Definition Simple.hpp:77
@ SINT64
Explicit Signed 64-bit Integer.
Definition Simple.hpp:73
@ SINT32
Explicit Signed 32-bit Integer.
Definition Simple.hpp:66
@ SLONG
Signed Long.
Definition Simple.hpp:63
@ SINT16
Explicit Signed 16-bit Integer.
Definition Simple.hpp:59
@ SSHORT
Signed Short.
Definition Simple.hpp:56
@ SCHAR
Signed Character.
Definition Simple.hpp:41
@ SQUAD
Signed Quadword.
Definition Simple.hpp:70
@ SBYTE
Signed Byte.
Definition Simple.hpp:52
Simple(Args &&... args)
Definition Simple.hpp:30
Definition PDB/types/Array.hpp:23
#define LIEF_API
Definition visibility.h:45