INI file class definition.
INI file class.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=I4P), | private | :: | Ns | = | 0 | Number of sections. |
|
character(len=:), | public, | allocatable | :: | filename | File name |
||
character(len=1), | private | :: | opt_sep | = | DEF_OPT_SEP | Separator character of option name/value. |
|
type(section), | private, | allocatable | :: | sections(:) | Sections. |
generic, public :: add => add_section, add_option, add_a_option | Add a section. Add an option to a section (scalar). Add an option to a section (array). |
procedure, private, pass(self) :: add_a_option | Add an option to a section (array). |
procedure, private, pass(self) :: add_option | Add an option to a section (scalar). |
procedure, private, pass(self) :: add_section | Add a section. |
procedure, private, pass(lhs) :: assign_file_ini | Assignment overloading. |
generic, public :: assignment(=) => assign_file_ini | Procedure for section assignment overloading. |
procedure, public, pass(self) :: count_values | Count option value(s). |
generic, public :: del => free_option_of_section, free_section | Remove (freeing) an option of a section. Remove (freeing) a section. |
procedure, public, pass(self) :: free | Free dynamic memory destroyng file data. |
procedure, private, pass(self) :: free_option_of_section | Free an option of a section. |
generic, public :: free_options => free_options_all, free_options_of_section, free_option_of_section | Free all options. Free all options of a section. Free an option of a section. |
procedure, private, pass(self) :: free_options_all | Free all options of all sections. |
procedure, private, pass(self) :: free_options_of_section | Free all options of a section. |
procedure, private, pass(self) :: free_section | Free a section. |
generic, public :: get => get_option, get_a_option | Get option value (scalar). Get option value (array). |
procedure, private, pass(self) :: get_a_option | Get option value (array). |
procedure, public, pass(self) :: get_items | Get list of pairs option name/value. |
procedure, private, pass(self) :: get_option | Get option value (scalar). |
procedure, public, pass(self) :: get_sections_list | Get sections names list. |
procedure, public, pass(self) :: has_option | Inquire the presence of an option. |
procedure, public, pass(self) :: has_section | Inquire the presence of a section. |
generic, public :: index => index_section, index_option | Return the index of a section. Return the index of an option. |
procedure, private, pass(self) :: index_option | Return the index of an option. |
procedure, private, pass(self) :: index_section | Return the index of a section. |
procedure, public, pass(self) :: initialize | Initialize file. |
procedure, public, pass(self) :: load | Load file data. |
generic, public :: loop => loop_options_section, loop_options | Loop over options of a section. Loop over all options. |
procedure, private, pass(self) :: loop_options | Loop over all options. |
procedure, private, pass(self) :: loop_options_section | Loop over options of a section. |
procedure, private, pass(self) :: parse | Parse file data. |
procedure, public, pass(self) :: print => print_file_ini | Pretty printing data. |
procedure, public, pass(self) :: save => save_file_ini | Save data. |
procedure, public, pass(self) :: section => section_file_ini | Get section name once provided an index. |
Get the number of values of option into section data.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character, | intent(in), | optional | :: | delimiter | Delimiter used for separating values. |
|
character, | intent(in) | :: | section_name | Section name. |
||
character, | intent(in) | :: | option_name | Option name. |
Number of values.
Inquire the presence of (at least one) option with the name passed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character, | intent(in) | :: | option_name | Option name. |
||
character, | intent(inout), | optional | :: | section_name | Section name. |
Inquiring flag.
Inquire the presence of (at least one) section with the name passed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character, | intent(in) | :: | section_name | Section name. |
Inquiring flag.
Return the index of the option (inside a section) matching the name(s) passed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
logical, | intent(in), | optional | :: | back | If back appears with the value true, the last matching index is returned. |
|
character, | intent(in) | :: | section_name | Section name. |
||
character, | intent(in) | :: | option_name | Option name. |
Index of searched section.
Return the index of the section matching the name passed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
logical, | intent(in), | optional | :: | back | If back appears with the value true, the last matching index is returned. |
|
character, | intent(in) | :: | section_name | Section name. |
Index of searched section.
Loop returning option name/value defined into all sections.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character(len=:), | intent(out), | allocatable | :: | option_pairs(:) | Pairs option name/value [1:2]. |
Flag continuing the loop.
Loop returning option name/value defined into section.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character, | intent(in) | :: | section_name | Section name. |
||
character(len=:), | intent(out), | allocatable | :: | option_pairs(:) | Pairs option name/value [1:2]. |
Flag continuing the loop.
Get section name once an index (valid) is provided.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
integer(kind=I4P), | intent(in) | :: | section_index | Section index. |
Section name.
Add an option (with array value).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(inout) | :: | self | File data. |
||
integer(kind=I4P), | intent(out), | optional | :: | error | Error code. |
|
character, | intent(in) | :: | section_name | Section name. |
||
character, | intent(in) | :: | option_name | Option name. |
||
class(*), | intent(in) | :: | val(1:) | Option value. |
Add an option (with scalar value).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(inout) | :: | self | File data. |
||
integer(kind=I4P), | intent(out), | optional | :: | error | Error code. |
|
character, | intent(in) | :: | section_name | Section name. |
||
character, | intent(in) | :: | option_name | Option name. |
||
class(*), | intent(in) | :: | val | Option value. |
Add a section.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(inout) | :: | self | File data. |
||
integer(kind=I4P), | intent(out), | optional | :: | error | Error code. |
|
character, | intent(in) | :: | section_name | Section name. |
Autotest the library functionalities.
Free dynamic memory.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(inout) | :: | self | File data. |
Free all options of a section.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(inout) | :: | self | File data. |
||
character, | intent(in) | :: | section_name | Section name. |
||
character, | intent(in) | :: | option_name | Option name. |
Free all options of all sections.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(inout) | :: | self | File data. |
Free all options of a section.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(inout) | :: | self | File data. |
||
character, | intent(in) | :: | section_name | Section name. |
Free all options of a section.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(inout) | :: | self | File data. |
||
character, | intent(in) | :: | section_name | Section name. |
Get option value (array)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character, | intent(in) | :: | section_name | Section name. |
||
character, | intent(in) | :: | option_name | Option name. |
||
class(*), | intent(inout) | :: | val(1:) | Value. |
||
character, | intent(in), | optional | :: | delimiter | Delimiter used for separating values. |
|
integer(kind=I4P), | intent(out), | optional | :: | error | Error code. |
Get list of pairs option name/value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character(len=:), | intent(out), | allocatable | :: | items(:,:) | Items, list of pairs option name/value for all options [1:No,1:2]. |
Get option value (scalar).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character, | intent(in) | :: | section_name | Section name. |
||
character, | intent(in) | :: | option_name | Option name. |
||
class(*), | intent(inout) | :: | val | Value. |
||
integer(kind=I4P), | intent(out), | optional | :: | error | Error code. |
Get sections names list.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character(len=:), | intent(out), | allocatable | :: | list(:) | Sections names list. |
Initialize file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(inout) | :: | self | File data. |
||
character, | intent(in), | optional | :: | filename | File name. |
Get file data from a file or a source string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(inout) | :: | self | File data. |
||
character(len=1), | intent(in), | optional | :: | separator | Separator of options name/value. |
|
character, | intent(in), | optional | :: | filename | File name. |
|
character, | intent(in), | optional | :: | source | File source contents. |
|
integer(kind=I4P), | intent(out), | optional | :: | error | Error code. |
Parse file either from the self source data or from a source string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(inout) | :: | self | File data. |
||
type(string), | intent(in) | :: | source | String source. |
||
integer(kind=I4P), | intent(out), | optional | :: | error | Error code. |
Print data with a pretty format.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
integer(kind=I4P), | intent(in) | :: | unit | Logic unit. |
||
character, | intent(in), | optional | :: | pref | Prefixing string. |
|
logical, | intent(in), | optional | :: | retain_comments | Flag for retaining eventual comments. |
|
integer(kind=I4P), | intent(out), | optional | :: | iostat | IO error. |
|
character, | intent(out), | optional | :: | iomsg | IO error message. |
Save data.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(inout) | :: | self | File data. |
||
logical, | intent(in), | optional | :: | retain_comments | Flag for retaining eventual comments. |
|
integer(kind=I4P), | intent(out), | optional | :: | iostat | IO error. |
|
character, | intent(out), | optional | :: | iomsg | IO error message. |
|
character, | intent(in), | optional | :: | filename | File name. |