MCPcopy Create free account
hub / github.com/lief-project/LIEF / StructType>

Method StructType>

api/python/src/DWARF/editor/pyStructType.cpp:10–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8namespace LIEF::dwarf::py {
9template<>
10void create<dw::editor::StructType>(nb::module_& m) {
11 nb::class_<dw::editor::StructType, dw::editor::Type> S(m, "StructType",
12 R"doc(
13 This class represents a struct-like type which can be:
14
15 - ``DW_TAG_class_type``
16 - ``DW_TAG_structure_type``
17 - ``DW_TAG_union_type``
18 )doc"_doc
19 );
20
21 using TYPE = dw::editor::StructType::TYPE;
22 nb::enum_<TYPE>(S, "TYPE")
23 .value("CLASS", TYPE::CLASS, "Discriminant for ``DW_TAG_class_type``"_doc)
24 .value("STRUCT", TYPE::STRUCT, "Discriminant for ``DW_TAG_structure_type``"_doc)
25 .value("UNION", TYPE::UNION, "Discriminant for ``DW_TAG_union_type``"_doc);
26
27 nb::class_<dw::editor::StructType::Member>(S, "Member",
28 "This class represents a member of the struct-like"_doc
29 );
30
31 S
32 .def("set_size", &dw::editor::StructType::set_size,
33 R"doc(
34 Define the overall size which is equivalent to the ``sizeof`` of the
35 current type.
36
37 This function defines the ``DW_AT_byte_size`` attribute
38 )doc"_doc, "size"_a, nb::rv_policy::reference_internal)
39
40 .def("add_member", &dw::editor::StructType::add_member,
41 "mber to the current struct-like"_doc,
42 "name"_a, "type"_a, "offset"_a = -1)
43 ;
44}
45
46}

Callers

nothing calls this directly

Calls 1

valueMethod · 0.45

Tested by

no test coverage detected