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

Method Protocol>

api/python/src/ObjC/objects/pyProtocol.cpp:10–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8namespace LIEF::objc::py {
9template<>
10void create<objc::Protocol>(nb::module_& m) {
11 nb::class_<objc::Protocol> protocol(m, "Protocol",
12 R"doc(
13 This class represents an Objective-C ``@protocol``
14 )doc"_doc
15 );
16
17 protocol
18 .def_prop_ro("mangled_name", &objc::Protocol::mangled_name,
19 R"doc(
20 Mangled name of the protocol
21 )doc"_doc
22 )
23
24 .def_prop_ro("optional_methods",
25 [] (objc::Protocol& self) {
26 auto methods = self.optional_methods();
27 return nb::make_iterator<nb::rv_policy::reference_internal>(
28 nb::type<objc::Protocol>(), "optional_methods_it", methods
29 );
30 }, nb::keep_alive<0, 1>(),
31 R"doc(
32 Iterator over the methods that could be overridden
33 )doc"_doc
34 )
35 .def_prop_ro("required_methods",
36 [] (objc::Protocol& self) {
37 auto methods = self.required_methods();
38 return nb::make_iterator<nb::rv_policy::reference_internal>(
39 nb::type<objc::Protocol>(), "required_methods_it", methods
40 );
41 }, nb::keep_alive<0, 1>(),
42 R"doc(
43 Iterator over the methods of this protocol that must be implemented
44 )doc"_doc
45 )
46 .def_prop_ro("properties",
47 [] (objc::Protocol& self) {
48 auto props = self.properties();
49 return nb::make_iterator<nb::rv_policy::reference_internal>(
50 nb::type<objc::Protocol>(), "properties_it", props
51 );
52 }, nb::keep_alive<0, 1>(),
53 R"doc(
54 Iterator over the properties defined in this protocol
55 )doc"_doc
56 )
57
58 .def("to_decl", &Protocol::to_decl,
59 R"doc(
60 Generate a header-like string for this specific protocol.
61
62 The generated output can be configured with the provided :class:`~.DeclOpt`
63 parameter.
64 )doc"_doc, "opt"_a = DeclOpt()
65 )
66 ;
67}

Callers

nothing calls this directly

Calls 4

DeclOptClass · 0.50
optional_methodsMethod · 0.45
required_methodsMethod · 0.45
propertiesMethod · 0.45

Tested by

no test coverage detected