LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
StructType.hpp
Go to the documentation of this file.
1/* Copyright 2022 - 2025 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_EDITOR_STRUCT_TYPE_H
16#define LIEF_DWARF_EDITOR_STRUCT_TYPE_H
17
18#include <cstdint>
19#include <string>
20
21#include "LIEF/visibility.h"
23
24namespace LIEF {
25namespace dwarf {
26namespace editor {
27
28namespace details {
29class StructMember;
30}
31
37class LIEF_API StructType : public Type {
38 public:
39 using Type::Type;
40
41 enum class TYPE : uint32_t {
45 };
46
49 public:
50 Member() = delete;
51 Member(std::unique_ptr<details::StructMember> impl);
52
54 private:
55 std::unique_ptr<details::StructMember> impl_;
56 };
57
62 StructType& set_size(uint64_t size);
63
65 std::unique_ptr<Member> add_member(const std::string& name, const Type& type,
66 int64_t offset = -1);
67
68 static bool classof(const Type* type);
69
70 ~StructType() override = default;
71};
72
73}
74}
75}
76#endif
Member(std::unique_ptr< details::StructMember > impl)
This class represents a struct-like type which can be:
Definition StructType.hpp:37
TYPE
Definition StructType.hpp:41
@ STRUCT
Discriminant for DW_TAG_class_type.
Definition StructType.hpp:43
@ CLASS
Definition StructType.hpp:42
@ UNION
Discriminant for DW_TAG_structure_type.
Definition StructType.hpp:44
~StructType() override=default
std::unique_ptr< Member > add_member(const std::string &name, const Type &type, int64_t offset=-1)
Add a member to the current struct-like.
static bool classof(const Type *type)
StructType & set_size(uint64_t size)
Define the overall size which is equivalent to the sizeof of the current type.
Definition DWARF/editor/CompilationUnit.hpp:36
Definition Editor.hpp:30
Namespace for the DWARF debug format.
Definition DWARF/CompilationUnit.hpp:28
LIEF namespace.
Definition Abstract/Binary.hpp:40
#define LIEF_API
Definition visibility.h:41