LIEF: Library to Instrument Executable Formats
Version 1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
DWARF
editor
StructType.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_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
"
22
#include "
LIEF/compiler_attributes.hpp
"
23
#include "
LIEF/DWARF/editor/Type.hpp
"
24
25
namespace
LIEF
{
26
namespace
dwarf
{
27
namespace
editor
{
28
29
namespace
details
{
30
class
StructMember;
31
}
32
38
class
LIEF_API
StructType
:
public
Type
{
39
public
:
40
template
<
typename
... Args,
41
typename
=
typename
std::
42
enable_if<std::is_constructible<
Type
, Args&&...>::value>::type>
43
StructType
(Args&&... args) :
44
Type
(std::forward<Args>(args)...) {}
45
46
enum class
TYPE
: uint32_t {
47
CLASS,
48
STRUCT,
49
UNION,
50
};
51
53
class
LIEF_API
Member
{
54
public
:
55
Member
() =
delete
;
56
Member
(std::unique_ptr<details::StructMember> impl);
57
58
~Member
();
59
60
private
:
61
std::unique_ptr<details::StructMember> impl_;
62
};
63
68
StructType
&
set_size
(uint64_t size)
LIEF_LIFETIMEBOUND
;
69
71
std::unique_ptr<Member>
add_member
(
const
std::string& name,
const
Type
& type,
72
int64_t offset = -1)
LIEF_LIFETIMEBOUND
;
73
75
std::unique_ptr<
Member
>
add_bitfield
(const std::
string
& name, const
Type
& type,
76
uint64_t bitsize,
77
int64_t bitoffset = -1)
LIEF_LIFETIMEBOUND
;
78
79
static
bool
classof
(const
Type
* type);
80
81
~
StructType
() override = default;
82
};
83
84
}
85
}
86
}
87
#endif
Type.hpp
LIEF::dwarf::editor::StructType::Member
This class represents a member of the struct-like.
Definition
StructType.hpp:53
LIEF::dwarf::editor::StructType::Member::Member
Member(std::unique_ptr< details::StructMember > impl)
LIEF::dwarf::editor::StructType::Member::Member
Member()=delete
LIEF::dwarf::editor::StructType::Member::~Member
~Member()
LIEF::dwarf::editor::StructType::StructType
StructType(Args &&... args)
Definition
StructType.hpp:43
LIEF::dwarf::editor::StructType::TYPE
TYPE
Definition
StructType.hpp:46
LIEF::dwarf::editor::StructType::add_member
std::unique_ptr< Member > add_member(const std::string &name, const Type &type, int64_t offset=-1)
Adds a member to the current struct-like.
LIEF::dwarf::editor::StructType::add_bitfield
std::unique_ptr< Member > add_bitfield(const std::string &name, const Type &type, uint64_t bitsize, int64_t bitoffset=-1)
Adds a bitfield member to the current structure.
LIEF::dwarf::editor::StructType::classof
static bool classof(const Type *type)
LIEF::dwarf::editor::StructType::set_size
StructType & set_size(uint64_t size)
Define the overall size which is equivalent to the sizeof of the current type.
LIEF::dwarf::editor::Type::Type
Type()=delete
compiler_attributes.hpp
LIEF_LIFETIMEBOUND
#define LIEF_LIFETIMEBOUND
Definition
compiler_attributes.hpp:72
LIEF::dwarf::editor::details
Definition
DWARF/editor/CompilationUnit.hpp:38
LIEF::dwarf::editor
Definition
Editor.hpp:32
LIEF::dwarf
Namespace for the DWARF debug format.
Definition
DWARF/CompilationUnit.hpp:30
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:41
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
Generated by
1.17.0