config_class Derived Type

type, public :: config_class

Opaque file configuration class.


Inherits

type~~config_class~~InheritsGraph type~config_class config_class type~lua_state_type lua_state_type type~config_class->type~lua_state_type lua c_ptr c_ptr type~lua_state_type->c_ptr ctx

Type-Bound Procedures

procedure, public :: close => config_close

  • private subroutine config_close(this)

    Closes configuration file.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

procedure, public :: field => config_field

  • private function config_field(this, name) result(rc)

    Loads field value on to Lua stack. Returns E_CONFIG on error.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    character(len=*), intent(in) :: name

    Setting name.

    Return Value integer

generic, public :: get => get_array_int32, get_array_int64, get_array_string, get_int32, get_int64, get_job_list, get_logical, get_real32, get_real64, get_report, get_string

  • private subroutine config_get_array_int32(this, name, values, error)

    Returns configuration values as 4-byte integer array in values.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    character(len=*), intent(in) :: name

    Setting name.

    integer(kind=i4), intent(out), allocatable :: values(:)

    Setting values.

    integer, intent(out), optional :: error

    Error code.

  • private subroutine config_get_array_int64(this, name, values, error)

    Returns configuration values as 8-byte integer array in values.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    character(len=*), intent(in) :: name

    Setting name.

    integer(kind=i8), intent(out), allocatable :: values(:)

    Setting values.

    integer, intent(out), optional :: error

    Error code.

  • private subroutine config_get_array_string(this, name, values, error)

    Returns configuration values as string array in values.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    character(len=*), intent(in) :: name

    Setting name.

    character(len=*), intent(inout), allocatable :: values(:)

    Setting values.

    integer, intent(out), optional :: error

    Error code.

  • private subroutine config_get_int32(this, name, value, error)

    Returns configuration value as 4-byte integer in value.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    character(len=*), intent(in) :: name

    Setting name.

    integer(kind=i4), intent(inout) :: value

    Setting value.

    integer, intent(out), optional :: error

    Error code.

  • private subroutine config_get_int64(this, name, value, error)

    Returns configuration value as 8-byte integer in value.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    character(len=*), intent(in) :: name

    Setting name.

    integer(kind=i8), intent(inout) :: value

    Setting value.

    integer, intent(out), optional :: error

    Error code.

  • private subroutine config_get_job_list(this, name, value, error, field)

    Returns configuration value as job list in value.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    character(len=*), intent(in) :: name

    Setting name.

    type(job_list_type), intent(out) :: value

    Setting value.

    integer, intent(out), optional :: error

    Error code.

    logical, intent(in), optional :: field

    Read from table field.

  • private subroutine config_get_logical(this, name, value, error)

    Returns configuration value as logical in value (if 0 or 1).

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    character(len=*), intent(in) :: name

    Setting name.

    logical, intent(inout) :: value

    Setting value.

    integer, intent(out), optional :: error

    Error code.

  • private subroutine config_get_real32(this, name, value, error)

    Returns configuration value as 4-byte real in value.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    character(len=*), intent(in) :: name

    Setting name.

    real(kind=r4), intent(inout) :: value

    Setting value.

    integer, intent(out), optional :: error

    Error code.

  • private subroutine config_get_real64(this, name, value, error)

    Returns configuration value as 8-byte real in value.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    character(len=*), intent(in) :: name

    Setting name.

    real(kind=r8), intent(inout) :: value

    Setting value.

    integer, intent(out), optional :: error

    Error code.

  • private subroutine config_get_report(this, name, value, error, field)

    Returns configuration value as report in value.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    character(len=*), intent(in) :: name

    Setting name.

    type(report_type), intent(out) :: value

    Setting value.

    integer, intent(out), optional :: error

    Error code.

    logical, intent(in), optional :: field

    Read from table field.

  • private subroutine config_get_string(this, name, value, error)

    Returns configuration value as character string in value. The string is unescaped by default (\\ is converted to \).

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    character(len=*), intent(in) :: name

    Setting name.

    character(len=*), intent(inout) :: value

    Setting value.

    integer, intent(out), optional :: error

    Error code.

procedure, public :: open => config_open

  • private function config_open(this, path, name, geocom) result(rc)

    Opens configuration file and optionally loads the table of the given name if the argument has been passed.

    The function returns the following error codes:

    • E_INVALID if the file path is empty.
    • E_LUA if a Lua error occured.
    • E_NOT_FOUND if the configuration file is not found.
    • E_TYPE if the configuration name is not a Lua table.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    character(len=*), intent(in) :: path

    Path to config file.

    character(len=*), intent(in), optional :: name

    Name of table. Passed name implies table loading.

    logical, intent(in), optional :: geocom

    Register GeoCOM API for Lua.

    Return Value integer

procedure, public :: remove => config_remove

  • private subroutine config_remove(this)

    Removes last stack element.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

procedure, public :: size => config_size

  • private function config_size(this) result(n)

    Returns size of configuration table.

    Arguments

    Type IntentOptional Attributes Name
    class(config_class), intent(inout) :: this

    Config object.

    Return Value integer