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

Method ClassLike>

api/python/src/DWARF/types/pyClassLike.cpp:13–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11namespace LIEF::dwarf::py {
12template<>
13void create<dw::types::ClassLike>(nb::module_& m) {
14 nb::class_<dw::types::ClassLike, dw::Type> class_like(m, "ClassLike",
15 R"doc(
16 This class abstracts a DWARF aggregate (``DW_TAG_structure_type``,
17 ``DW_TAG_class_type``, ``DW_TAG_union_type``).
18 )doc"_doc
19 );
20
21 nb::class_<dw::types::ClassLike::Member>(class_like, "Member",
22 R"doc(
23 This class represents a class/struct/union attribute.
24 )doc"_doc
25 )
26 .def_prop_ro("name", &dw::types::ClassLike::Member::name,
27 R"doc(
28 Name of the member
29 )doc"_doc
30 )
31
32 .def_prop_ro("type", &dw::types::ClassLike::Member::type,
33 R"doc(
34 Type of the current member
35 )doc"_doc
36 )
37
38 .def_prop_ro("is_external", &dw::types::ClassLike::Member::is_external,
39 R"doc(
40 )doc"_doc
41 )
42
43 .def_prop_ro("is_declaration", &dw::types::ClassLike::Member::is_declaration,
44 R"doc(
45 )doc"_doc
46 )
47
48 .def_prop_ro("offset",
49 [] (const dw::types::ClassLike::Member& self) {
50 return LIEF::py::value_or_none(&dw::types::ClassLike::Member::offset, self);
51 },
52 R"doc(
53 Offset of the current member in the struct/union/class
54
55 If the offset can't be resolved it returns None
56 )doc"_doc
57 )
58 .def_prop_ro("bit_offset",
59 [] (const dw::types::ClassLike::Member& self) {
60 return LIEF::py::value_or_none(&dw::types::ClassLike::Member::bit_offset, self);
61 },
62 R"doc(
63 Offset of the current member in **bits** in the current struct/union/class
64
65 This function differs from :attr:`~.offset` for aggregates using bit-field
66 declaration:
67
68 .. code-block:: cpp
69
70 struct S {

Callers

nothing calls this directly

Calls 2

value_or_noneFunction · 0.85
functionsMethod · 0.45

Tested by

no test coverage detected