package devkit

  1. Overview
  2. Docs
Development kit - general purpose library

Install

Dune Dependency

Authors

Maintainers

Sources

devkit-1.20240429.tbz
sha256=222f8ac131b1d970dab7eeb2714bfd6b9338b88b1082e6e01c136ae19e7eaef4
sha512=c9e6d93e3d21e5530c0f4d5baca51bf1f0a5d19248f8af7678d0665bb5cdf295d7aaaaa3e50eb2e44b8720e55097cc675af4dc8ec45acf9da39feb3eae1405d5

doc/devkit.core/Devkit_core/Static_config/index.html

Module Devkit_core.Static_configSource

Static mapping of simple config format.

Format is simple key-value pairs. Key must start with a letter and may include letters, numbers and underscore. Lines starting with '#' are treated as comments, i.e. ignored. Value can be arbitrary - there are several ways to represent them :

* if the value doesn't contain any spaces, just write out the value directly

<key> = <value>

* if the value is single-line, wrap it with any symbol (<DELIMITER> can be a quote, a doublequote or any other character that doesn't occur in the value itself)

<key> := <DELIMITER><value><DELIMITER>

* multi-line symbols are written verbatim prefixed with the number of lines occupied

<key> : <N> <line 1> <line 2> ... <line N>

Example usage:

module CONF = struct open Static_config

(* fresh new group *) let root = new_root () let save = save root let load = load root

(* values stored *) let last_id = int root "last_id" 0 let last_key = string root "last_key" "" end

or as an object:

let simple_config filename = let open Static_config in let root = new_root () in let port = int root "port" 8080 in object inherit base root filename method port = port end

let conf = simple_config "some.config" in (* get's loaded here *) conf#port#set 8081; conf#save ()

Sourceexception Error of string
Sourcetype 'a value = < get : 'a ; set : 'a -> unit ; dirty : bool >
Sourcetype group
Sourceval group : group -> string -> group
Sourceval new_root : unit -> group
Sourceval int : group -> string -> int -> int value
Sourceval long : group -> string -> int64 -> int64 value
Sourceval string : group -> string -> string -> string value
Sourceval float : group -> string -> float -> float value
Sourceval bool : group -> string -> bool -> bool value
Sourceval show : ?all:bool -> group -> string
Sourceval read : group -> string -> unit
Sourceval reset : group -> unit
Sourceval load : group -> string -> unit
Sourceval save : ?all:bool -> group -> string -> unit
Sourceclass base : group -> string -> object ... end
OCaml

Innovation. Community. Security.