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