sourcery_file_m.f90 Source File


This file depends on

sourcefile~~sourcery_file_m.f90~~EfferentGraph sourcefile~sourcery_file_m.f90 sourcery_file_m.f90 sourcefile~sourcery_string_m.f90 sourcery_string_m.f90 sourcefile~sourcery_file_m.f90->sourcefile~sourcery_string_m.f90

Files dependent on this one

sourcefile~~sourcery_file_m.f90~~AfferentGraph sourcefile~sourcery_file_m.f90 sourcery_file_m.f90 sourcefile~sourcery_file_s.f90 sourcery_file_s.f90 sourcefile~sourcery_file_s.f90->sourcefile~sourcery_file_m.f90 sourcefile~sourcery_m.f90 sourcery_m.F90 sourcefile~sourcery_m.f90->sourcefile~sourcery_file_m.f90 sourcefile~sourcery_string_s.f90 sourcery_string_s.f90 sourcefile~sourcery_string_s.f90->sourcefile~sourcery_m.f90

Source Code

module sourcery_file_m
  !! A representation of a file as an object
  use sourcery_string_m, only : string_t

  private
  public :: file_t

  type file_t
    private
    type(string_t), allocatable :: lines_(:)
  contains
    procedure :: lines
    procedure :: write_lines
  end type

  interface file_t

    module function read_lines(file_name) result(file_object)
      implicit none
      type(string_t), intent(in) :: file_name
      type(file_t) file_object
    end function

    pure module function construct(lines) result(file_object)
      implicit none
      type(string_t), intent(in) :: lines(:)
      type(file_t) file_object
    end function

  end interface

  interface

    pure module function lines(self)  result(my_lines)
      implicit none
      class(file_t), intent(in) :: self
      type(string_t), allocatable :: my_lines(:)
    end function

    impure elemental module subroutine write_lines(self, file_name)
      implicit none
      class(file_t), intent(in) :: self
      type(string_t), intent(in), optional :: file_name
    end subroutine

  end interface

end module sourcery_file_m