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

Method Metadata>

api/python/src/ObjC/objects/pyMetadata.cpp:12–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace LIEF::objc::py {
11template<>
12void create<objc::Metadata>(nb::module_& m) {
13 nb::class_<objc::Metadata> meta(m, "Metadata",
14 R"doc(
15 This class is the main interface to inspect Objective-C metadata
16
17 It can be instantiated using the function :attr:`lief.MachO.Binary.objc_metadata`
18 )doc"_doc
19 );
20 meta
21 .def("to_decl", &Metadata::to_decl,
22 R"doc(
23 Generate a header-like of all the Objective-C metadata identified in the
24 binary.
25
26 The generated output can be configured with the provided :class:`~.DeclOpt`
27 parameter.
28 )doc"_doc, "opt"_a = DeclOpt()
29 )
30 .def_prop_ro("classes",
31 [] (objc::Metadata& self) {
32 auto classes = self.classes();
33 return nb::make_iterator<nb::rv_policy::reference_internal>(
34 nb::type<objc::Metadata>(), "classes_it", classes
35 );
36 }, nb::keep_alive<0, 1>(),
37 R"doc(
38 Return an iterator over the different Objective-C classes (``@interface``).
39 )doc"_doc
40 )
41 .def_prop_ro("protocols",
42 [] (objc::Metadata& self) {
43 auto protocols = self.protocols();
44 return nb::make_iterator<nb::rv_policy::reference_internal>(
45 nb::type<objc::Metadata>(), "protocols_it", protocols
46 );
47 }, nb::keep_alive<0, 1>(),
48 R"doc(
49 Return an iterator over the Objective-C protocols declared in this
50 binary (``@protocol``).
51 )doc"_doc
52 )
53
54 .def("get_class", &objc::Metadata::get_class,
55 R"doc(
56 Try to find the Objective-C class with the given **mangled** name.
57 )doc"_doc, "name"_a
58 )
59
60 .def("get_protocol", &objc::Metadata::get_protocol,
61 R"doc(
62 Try to find the Objective-C class with the given **mangled** name.
63 )doc"_doc, "name"_a
64 )
65 ;
66}
67
68}

Callers

nothing calls this directly

Calls 3

DeclOptClass · 0.50
classesMethod · 0.45
protocolsMethod · 0.45

Tested by

no test coverage detected