package inifiles

  1. Overview
  2. Docs
An ini file parser

Install

dune-project
 Dependency

Authors

Maintainers

Sources

2.0.tar.gz
sha512=bf0a06f12e0a65418a0d4f72ee5a99a5f9594c7e43498e82408797bcdc64bb398e380346f7c1e4cbb05570644d8a8be7922801abe9f150fbbcc974eff1911547

doc/inifiles/Inifiles/index.html

Module InifilesSource

This library reads ini format property files

Sourceexception Invalid_section of string

raised if you ask for a section which doesn't exist

Sourceexception Invalid_element of string

raised if you ask for an element (attribute) which doesn't exist, or the element fails to match the validation regex

Sourceexception Missing_section of string

raised if a required section is not specified in the config file

Sourceexception Missing_element of string

raised if a required element is not specified in the config file

Sourceexception Ini_parse_error of int * string

raised if there is a parse error in the ini file it will contain the line number and the name of the file in which the error happened

Sourcetype attribute_specification = {
  1. atr_name : string;
  2. atr_required : bool;
  3. atr_default : string list option;
  4. atr_validator : Pcre2.regexp option;
}

The type of an attribute/element specification

Sourcetype section_specification = {
  1. sec_name : string;
  2. sec_required : bool;
  3. sec_attributes : attribute_specification list;
}

The type of a section specification

Sourcetype specification = section_specification list

The type of a secification

Sourceclass inifile : ?spec:specification -> string -> object ... end

send the name of an ini file to the constructor the file must exist, but can be empty

Sourceval fold : ('a -> inifile -> 'a) -> string -> 'a -> 'a

Executes a fold left across a directory of ini files (skips files which do not end with .ini). fold f path a computes (f ... (f (f file1 a) file2) fileN)