write_lines Subroutine

private subroutine write_lines(self, unit, form, iostat, iomsg)

Type Bound

string

Arguments

Type IntentOptional Attributes Name
class(string), intent(in) :: self
integer, intent(in) :: unit
character(len=*), intent(in), optional :: form
integer, intent(out), optional :: iostat
character(len=*), intent(inout), optional :: iomsg

Calls

proc~~write_lines~~CallsGraph proc~write_lines string%write_lines proc~split string%split proc~write_lines->proc~split proc~write_line string%write_line proc~write_lines->proc~write_line proc~partition string%partition proc~split->proc~partition proc~unique string%unique proc~split->proc~unique proc~chars string%chars proc~write_line->proc~chars proc~end_with string%end_with proc~write_line->proc~end_with proc~upper~2 string%upper proc~write_line->proc~upper~2 proc~replace string%replace proc~unique->proc~replace proc~replace_one_occurrence string%replace_one_occurrence proc~replace->proc~replace_one_occurrence

Called by

proc~~write_lines~~CalledByGraph proc~write_lines string%write_lines proc~write_file string%write_file proc~write_file->proc~write_lines program~volatile_doctest~1107 volatile_doctest program~volatile_doctest~1107->proc~write_file program~volatile_doctest~1125 volatile_doctest program~volatile_doctest~1125->proc~write_file

Source Code

   subroutine write_lines(self, unit, form, iostat, iomsg)
   !< Write lines (records) to a connected unit.
   !<
   !< This method checks if self contains more than one line (records) and writes them as lines (records).
   !<
   !< @note If the connected unit is unformatted a `new_line()` character is added at the end (if necessary) to mark the end of line.
   !<
   !< @note There is no doctests, this being tested by means of [[string:write_file]] doctests.
   class(string),    intent(in)              :: self     !< The string.
   integer,          intent(in)              :: unit     !< Logical unit.
   character(len=*), intent(in),    optional :: form     !< Format of unit.
   integer,          intent(out),   optional :: iostat   !< IO status code.
   character(len=*), intent(inout), optional :: iomsg    !< IO status message.
   type(string), allocatable                 :: lines(:) !< Lines.
   integer                                   :: l        !< Counter.

   if (allocated(self%raw)) then
      call self%split(tokens=lines, sep=new_line('a'))
      do l=1, size(lines, dim=1)
         call lines(l)%write_line(unit=unit, form=form, iostat=iostat, iomsg=iomsg)
      enddo
   endif
   endsubroutine write_lines