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: 2025-06-24:00:00:00 Functions: 0.0 % 5 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 {
      14            0 :             ptr: cmd,
      15            0 :         }
      16            0 :     }
      17              : }
      18              : 
      19              : impl Enum {
      20              :     /// Define the number of bytes required to hold an instance of the
      21              :     /// enumeration (`DW_AT_byte_size`).
      22            0 :     pub fn set_size(&mut self, size: u64) {
      23            0 :         self.ptr.pin_mut().set_size(size);
      24            0 :     }
      25              : 
      26              :     /// Add an enum value by specifying its name and its integer value
      27            0 :     pub fn add_value(&mut self, name: &str, value: i64) -> Value {
      28            0 :         Value::from_ffi(self.ptr.pin_mut().add_value(name, value))
      29            0 :     }
      30              : }
      31              : 
      32              : 
      33              : impl EditorType for Enum {
      34            0 :     fn get_base(&self) -> &ffi::DWARF_editor_Type {
      35            0 :         self.ptr.as_ref().unwrap().as_ref()
      36            0 :     }
      37              : }
      38              : 
      39              : 
      40              : /// This structure represents an enum value.
      41              : pub struct Value {
      42              :     ptr: cxx::UniquePtr<ffi::DWARF_editor_EnumType_Value>,
      43              : }
      44              : 
      45              : impl FromFFI<ffi::DWARF_editor_EnumType_Value> for Value {
      46            0 :     fn from_ffi(cmd: cxx::UniquePtr<ffi::DWARF_editor_EnumType_Value>) -> Self {
      47            0 :         Self {
      48            0 :             ptr: cmd,
      49            0 :         }
      50            0 :     }
      51              : }
        

Generated by: LCOV version 2.1-1