fdoc

functionscalar_textprivate

character(len=:) function scalar_text(table, key, kind) result(text)

A string, integer or logical value of table as text.

Arguments

NameTypeIntentAttributesDescription
tabletype(toml_table)inout

the table

keycharacter(len=*)in

the key

kindintegerin

the value's toml_type

Result

NameTypeAttributesDescription
textcharacter(len=:)privateallocatable

Source

Show the code
function scalar_text(table, key, kind) result(text)
    type(toml_table), intent(inout) :: table    !! the table
    character(len=*), intent(in) :: key         !! the key
    integer, intent(in) :: kind                 !! the value's `toml_type`
    character(len=:), allocatable :: text
    integer :: i
    logical :: flag

    text = ''
    if (kind == toml_type%string) then
        call get_value(table, key, text)
    else if (kind == toml_type%int) then
        call get_value(table, key, i)
        text = to_s(i)
    else if (kind == toml_type%boolean) then
        call get_value(table, key, flag)
        text = trim(merge('true ', 'false', flag))
    end if
end function scalar_text

Graphs

Called by