@@ -13,14 +13,14 @@ module fp_BaseAction
1313 type, extends(AbstractAction) :: BaseAction
1414 private
1515 character (:), allocatable :: destination
16- type (StringVector) :: option_strings
16+ type (StringVector) :: option_strings
1717 character (:), allocatable :: type
1818 class(* ), allocatable :: const
1919 class(* ), allocatable :: default
2020 character (:), allocatable :: help
2121 class(* ), allocatable :: n_arguments ! string or integer
2222 logical :: positional = .false.
23- character (len = :), allocatable :: choices(:)
23+ type (StringVector) :: choices
2424 contains
2525 procedure :: initialize
2626 procedure :: get_destination
@@ -68,8 +68,9 @@ subroutine initialize(this, &
6868 character (len=* ), optional , intent (in ) :: choices(:)
6969 character (len=* ), optional , intent (in ) :: help
7070
71- type (StringVectorIterator) :: iter
71+ type (StringVectorIterator) :: iter
7272 character (:), pointer :: opt_string
73+ integer :: i
7374
7475 _UNUSED_DUMMY(unused)
7576
@@ -138,7 +139,9 @@ subroutine initialize(this, &
138139 end if
139140
140141 if (present (choices)) then
141- this% choices = choices
142+ do i = 1 , size (choices)
143+ call this% choices% push_back(choices(i))
144+ end do
142145 end if
143146 end subroutine initialize
144147
@@ -318,14 +321,11 @@ function get_n_arguments(this) result(n_arguments)
318321 end function get_n_arguments
319322
320323 function get_choices (this ) result(choices)
321- character (: ), pointer :: choices(:)
324+ type (StringVector ), pointer :: choices
322325 class(BaseAction), target , intent (in ) :: this
323326
324- if (allocated (this% choices)) then
325- choices = > this% choices
326- else
327- choices = > null ()
328- end if
327+ choices = > this% choices
328+
329329 end function get_choices
330330
331331end module fp_BaseAction
0 commit comments