| 7 | namespace LIEF::dwarf::py { |
| 8 | template<> |
| 9 | void create<dw::types::Array>(nb::module_& m) { |
| 10 | nb::class_<dw::types::Array, dw::Type> type(m, "Array", |
| 11 | R"doc( |
| 12 | This class represents a ``DW_TAG_array_type`` |
| 13 | )doc"_doc |
| 14 | ); |
| 15 | |
| 16 | nb::class_<dw::types::Array::size_info_t>(type, "size_info_t", |
| 17 | R"doc( |
| 18 | Class that wraps information about the dimension of this array |
| 19 | )doc"_doc |
| 20 | ) |
| 21 | .def_prop_ro("type", [] (dw::types::Array::size_info_t& self) { |
| 22 | return self.type.get(); |
| 23 | }, |
| 24 | R"doc( |
| 25 | Type of the **index** for this array. |
| 26 | |
| 27 | For instance in ``uint8_t[3]`` the index type could be set to a ``size_t``. |
| 28 | )doc"_doc, nb::keep_alive<0, 1>() |
| 29 | ) |
| 30 | .def_ro("name", &dw::types::Array::size_info_t::name, |
| 31 | R"doc( |
| 32 | Name of the index (usually not relevant like ``__ARRAY_SIZE_TYPE__``) |
| 33 | )doc"_doc |
| 34 | ) |
| 35 | .def_ro("size", &dw::types::Array::size_info_t::size, |
| 36 | R"doc( |
| 37 | Size of the array. For instance in ``uint8_t[3]``, it returns 3. |
| 38 | )doc"_doc |
| 39 | ) |
| 40 | ; |
| 41 | |
| 42 | type |
| 43 | .def_prop_ro("underlying_type", &dw::types::Array::underlying_type, |
| 44 | R"doc( |
| 45 | The underlying type of this array. |
| 46 | )doc"_doc |
| 47 | ) |
| 48 | |
| 49 | .def_prop_ro("size_info", &dw::types::Array::size_info, |
| 50 | R"doc( |
| 51 | Return information about the size of this array. |
| 52 | |
| 53 | This size info is usually embedded in a ``DW_TAG_subrange_type`` DIE which |
| 54 | is represented by the :class:`.Array.size_info_t` class. |
| 55 | )doc"_doc |
| 56 | ) |
| 57 | ; |
| 58 | } |
| 59 | |
| 60 | } |