package ocp-ocamlres

  1. Overview
  2. Docs

Output subformat dispatching the output depending on file extensions and the command line options. To be polymorphic, the t type is a string containing the raw resource representation, and the from_raw method of the selected subformat is used at every operation. The SubFormat used is resolved using table PredefOptions.subformats.

type t = string

The generation-time intermediate representation of data.

val from_raw : OCamlRes.Path.t -> string -> t

A parser as used by the scanner to obtain the in-memory resources from files.

val to_raw : OCamlRes.Path.t -> t -> string

A dumper to reconstitute the files from the in-memory resources.

val pprint : OCamlRes.Path.t -> t -> PPrint.document

Takes the path to the resource in the resource tree, and its value to pretty print. Returns the OCaml representation of the value.

val pprint_header : OCamlRes.Path.t -> t -> PPrint.document option

Provides an optional piece of OCaml code to put before the resource store definition, for instance a type definition.

Provides an optional piece of OCaml code to put after the resource store definition, for instance a type definition.

val name : OCamlRes.Path.t -> t -> string

A name used to identify the subformat.

val type_name : OCamlRes.Path.t -> t -> string

The run-time OCaml type name (that describes the type of values generated by pprint). Used to annotate the generated source where needed. The common usecase is when this function returns the same type as the static t type.

val mod_name : OCamlRes.Path.t -> t -> string

The name of the subformat module at run-time. If the static type t is the same as the runtime type returned by type_abbrv, this is simply the path to the module used for generation.

OCaml

Innovation. Community. Security.