Print the dictionary keys.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dictionary), | intent(in) | :: | self | The dictionary. |
subroutine print_keys(self)
!---------------------------------------------------------------------------------------------------------------------------------
!< Print the dictionary keys.
!---------------------------------------------------------------------------------------------------------------------------------
class(dictionary), intent(in) :: self !< The dictionary.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
call self%traverse_iterator(iterator=key_iterator_print)
!---------------------------------------------------------------------------------------------------------------------------------
contains
subroutine key_iterator_print(node, done)
!-------------------------------------------------------------------------------------------------------------------------------
!< Iterator procedure for printing a key.
!-------------------------------------------------------------------------------------------------------------------------------
type(dictionary_node), pointer, intent(in) :: node !< Actual node pointer in the dictionary.
logical, intent(out) :: done !< Flag to set to true to stop traversing.
!-------------------------------------------------------------------------------------------------------------------------------
!-------------------------------------------------------------------------------------------------------------------------------
if (node%has_key()) print '(A)', node%key%stringify()
done = .false. ! never stop until the tail
!-------------------------------------------------------------------------------------------------------------------------------
endsubroutine key_iterator_print
endsubroutine print_keys