Line data Source code
1 : use lief_ffi as ffi;
2 :
3 0 : #[derive(Debug, Clone, PartialEq, Eq, Hash)]
4 : /// Configuration options for generated code from debug info.
5 : ///
6 : /// This structure configures how the debug information (DWARF/PDB) translated
7 : /// into an AST is generated.
8 : pub struct DeclOpt {
9 : pub indentation: u32,
10 :
11 : /// Prefer C++ syntax over C syntax.
12 : ///
13 : /// If true, the output will use C++ features (e.g., `bool` keyword)
14 : pub is_cpp: bool,
15 :
16 : /// Enable extended comments and annotations.
17 : ///
18 : /// If true, the generated code will include comments containing low-level
19 : /// details such as memory addresses, offsets, type sizes, and original
20 : /// source locations.
21 : pub show_extended_annotations: bool,
22 :
23 : /// Include full type definitions.
24 : ///
25 : /// If true, the output will contain the full definition of types (structs,
26 : /// enums, unions).
27 : pub include_types: bool,
28 :
29 : /// Resolve type aliases (sugar).
30 : ///
31 : /// If true, `typedef`s and type aliases are replaced by their underlying
32 : /// canonical types (e.g., `uint32_t` might become `unsigned int`).
33 : pub desugar: bool,
34 :
35 : }
36 :
37 : impl Default for DeclOpt {
38 0 : fn default() -> DeclOpt {
39 0 : DeclOpt {
40 0 : indentation: 2,
41 0 : is_cpp: false,
42 0 : show_extended_annotations: true,
43 0 : include_types: false,
44 0 : desugar: true,
45 0 : }
46 0 : }
47 : }
48 :
49 : impl DeclOpt {
50 : #[doc(hidden)]
51 0 : pub fn to_ffi(&self) -> cxx::UniquePtr<ffi::LIEF_DeclOpt> {
52 0 : let mut ptr = ffi::LIEF_DeclOpt::create();
53 0 : ptr.pin_mut().set_indentation(self.indentation);
54 0 : ptr
55 0 : }
56 : }
|