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