Commit 12e413a03e0d277377ddc484698f7ded295dc446

Authored by m-holger
1 parent e51eee74

Refactor: replace `getParent` with `Parent` method in FormField for clarity and …

…consistency, and update QPDFFormFieldObjectHelper accordingly.
libqpdf/QPDFFormFieldObjectHelper.cc
... ... @@ -48,13 +48,7 @@ QPDFFormFieldObjectHelper::isNull()
48 48 QPDFFormFieldObjectHelper
49 49 QPDFFormFieldObjectHelper::getParent()
50 50 {
51   - return {Null::if_null(m->getParent().oh())};
52   -}
53   -
54   -FormField
55   -FormField::getParent()
56   -{
57   - return {oh()["/Parent"]}; // maybe null
  51 + return {Null::if_null(m->Parent().oh())};
58 52 }
59 53  
60 54 QPDFFormFieldObjectHelper
... ...
libqpdf/qpdf/FormField.hh
... ... @@ -32,9 +32,19 @@ namespace qpdf::impl
32 32 {
33 33 }
34 34  
35   - // Return the field's parent. A form field object helper whose underlying object is null is
36   - // returned if there is no parent. This condition may be tested by calling isNull().
37   - FormField getParent();
  35 + /// Retrieves the /Parent form field of the current field.
  36 + ///
  37 + /// This function accesses the parent field in the hierarchical structure of form fields, if
  38 + /// it exists. The parent is determined based on the /Parent attribute in the field
  39 + /// dictionary.
  40 + ///
  41 + /// @return A FormField object representing the parent field. If the current field has no
  42 + /// parent, an empty FormField object is returned.
  43 + FormField
  44 + Parent()
  45 + {
  46 + return {get("/Parent")};
  47 + }
38 48  
39 49 // Return the top-level field for this field. Typically this will be the field itself or its
40 50 // parent. If is_different is provided, it is set to true if the top-level field is
... ...