LCOV - code coverage report
Current view: top level - src/dwarf/editor/types - enum_ty.rs (source / functions) Coverage Total Hit
Test: lief.lcov Lines: 0.0 % 19 0
Test Date: 2026-04-12:00:00:00 Functions: 0.0 % 6 0

            Line data    Source code
       1              : use lief_ffi as ffi;
       2              : 
       3              : use crate::common::FromFFI;
       4              : use crate::dwarf::editor::types::EditorType;
       5              : 
       6              : /// This structure represents an editable enum type (`DW_TAG_enumeration_type`)
       7              : pub struct Enum {
       8              :     ptr: cxx::UniquePtr<ffi::DWARF_editor_EnumType>,
       9              : }
      10              : 
      11              : impl FromFFI<ffi::DWARF_editor_EnumType> for Enum {
      12            0 :     fn from_ffi(cmd: cxx::UniquePtr<ffi::DWARF_editor_EnumType>) -> Self {
      13            0 :         Self { ptr: cmd }
      14            0 :     }
      15              : }
      16              : 
      17              : impl Enum {
      18              :     /// Define the number of bytes required to hold an instance of the
      19              :     /// enumeration (`DW_AT_byte_size`).
      20            0 :     pub fn set_size(&mut self, size: u64) {
      21            0 :         self.ptr.pin_mut().set_size(size);
      22            0 :     }
      23              : 
      24              :     /// Add an enum value by specifying its name and its integer value
      25            0 :     pub fn add_value(&mut self, name: &str, value: i64) -> Value {
      26            0 :         Value::from_ffi(self.ptr.pin_mut().add_value(name, value))
      27            0 :     }
      28              : 
      29              :     /// Set the underlying type that is used to encode this enum
      30            0 :     pub fn set_underlying_type(&mut self, ty: &dyn EditorType) -> &mut Self {
      31            0 :         self.ptr.pin_mut().set_underlying_type(ty.get_base());
      32            0 :         self
      33            0 :     }
      34              : }
      35              : 
      36              : impl EditorType for Enum {
      37            0 :     fn get_base(&self) -> &ffi::DWARF_editor_Type {
      38            0 :         self.ptr.as_ref().unwrap().as_ref()
      39            0 :     }
      40              : }
      41              : 
      42              : /// This structure represents an enum value.
      43              : #[allow(dead_code)]
      44              : pub struct Value {
      45              :     ptr: cxx::UniquePtr<ffi::DWARF_editor_EnumType_Value>,
      46              : }
      47              : 
      48              : impl FromFFI<ffi::DWARF_editor_EnumType_Value> for Value {
      49            0 :     fn from_ffi(cmd: cxx::UniquePtr<ffi::DWARF_editor_EnumType_Value>) -> Self {
      50            0 :         Self { ptr: cmd }
      51            0 :     }
      52              : }
        

Generated by: LCOV version 2.1-1