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

Method ClassLike>

api/python/src/PDB/types/pyClassLike.cpp:12–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace LIEF::pdb::py {
11template<>
12void create<pdb::types::ClassLike>(nb::module_& m) {
13 nb::class_<pdb::types::ClassLike, pdb::Type> type(m, "ClassLike",
14 R"doc(
15 This class abstracts the following PDB types: ``LF_STRUCTURE``, ``LF_INTERFACE``,
16 ``LF_CLASS`` or ``LF_UNION``.
17 )doc"_doc
18 );
19
20 type
21 .def_prop_ro("attributes",
22 [] (pdb::types::ClassLike& self) {
23 auto attrs = self.attributes();
24 return nb::make_iterator<nb::rv_policy::reference_internal>(
25 nb::type<pdb::types::ClassLike>(), "attributes_it", attrs);
26 },
27 R"doc(
28 Return an iterator over the different attributes defined in this class-like type
29 )doc"_doc, nb::keep_alive<0, 1>())
30
31 .def_prop_ro("methods",
32 [] (pdb::types::ClassLike& self) {
33 auto methods = self.methods();
34 return nb::make_iterator<nb::rv_policy::reference_internal>(
35 nb::type<pdb::types::ClassLike>(), "methods_it", methods);
36 },
37 R"doc(
38 Return an iterator over the different methods implemented in this class-like type
39 )doc"_doc, nb::keep_alive<0, 1>())
40
41 .def_prop_ro("unique_name", &pdb::types::ClassLike::unique_name,
42 R"doc(
43 Mangled type name.
44 )doc"_doc
45 )
46
47 .def_prop_ro("name", &pdb::types::ClassLike::name,
48 R"doc(
49 Demangled type name
50 )doc"_doc
51 )
52
53 .def_prop_ro("size", &pdb::types::ClassLike::size,
54 R"doc(
55 Size of the type including all its attributes. This size should match
56 the ``sizeof(...)`` this type.
57 )doc"_doc
58 )
59 ;
60
61 nb::class_<pdb::types::Class, pdb::types::ClassLike> clazz(m, "Class",
62 R"doc(
63 Interface for the ``LF_CLASS`` PDB type
64 )doc"_doc
65 );
66
67 nb::class_<pdb::types::Structure, pdb::types::ClassLike> structure(m, "Structure",
68 R"doc(
69 Interface for the ``LF_STRUCTURE`` PDB type

Callers

nothing calls this directly

Calls 2

attributesMethod · 0.45
methodsMethod · 0.45

Tested by

no test coverage detected