package wcs-lib

  1. Overview
  2. Docs

Json utilities.

val read_json_file : (Yojson.lexer_state -> Lexing.lexbuf -> 'a) -> string -> 'a

read_json_file reader fname reads the file fname using the reader reader generated by atdgen.

val null : Wcs_t.json

The null value of JSON.

val set : Wcs_t.json -> string -> Wcs_t.json -> Wcs_t.json

set o x v add (or replace) the a field x of the object o with value v.

val get : Wcs_t.json -> string -> Wcs_t.json option

get o x gets the value of the field x of the object o.

val take : Wcs_t.json -> string -> Wcs_t.json * Wcs_t.json option

take o x gets the value of the field x of the object o and remove the field from the object. The left part of the return value is the modified object and the right part is the value of the field.

The "skip_user_input" field
val set_skip_user_input : Wcs_t.json -> bool -> Wcs_t.json

set_skip_user_input ctx b set the field "skip_user_input" of the object ctx with value b.

val take_skip_user_input : Wcs_t.json -> Wcs_t.json * bool

take_skip_user_input ctx take the field "skip_user_input" of the object ctx. If the field is the defined, it returns false.

The "actions" field
val set_actions : Wcs_t.json -> Wcs_t.action list -> Wcs_t.json

set_actions ctx l set the field "actions" of the object ctx with the list of actions l.

val take_actions : Wcs_t.json -> Wcs_t.json * Wcs_t.action list option

take_actions ctx take the field "actions" of the object ctx.

val push_action : Wcs_t.json -> Wcs_t.action -> Wcs_t.json

push_action ctx act add the action act in the list of actions stored in the field "actions" of ctx. It the field "actions" doesn't exists, it creates it.

val pop_action : Wcs_t.json -> Wcs_t.json * Wcs_t.action option

pop_action ctx take an action act in the list of actions stored in the field "actions" of ctx.

The "continuation" field
val set_continuation : Wcs_t.json -> Wcs_t.action -> Wcs_t.json

set_continuation ctx act set the field "continuation" of the object ctx with the action act.

val get_continuation : Wcs_t.json -> Wcs_t.action option

get_continuation ctx get the value of the field "continuation" of the object ctx.

val take_continuation : Wcs_t.json -> Wcs_t.json * Wcs_t.action option

take_continuation ctx take the value of the field "continuation" of the object ctx.

The "return" field
val set_return : Wcs_t.json -> Wcs_t.json -> Wcs_t.json

set_return ctx v set the field "return" of the object ctx with the value v.

val get_return : Wcs_t.json -> Wcs_t.json option

get_return ctx get the value of the field "return" of the object ctx.

Boolean fields
val set_bool : Wcs_t.json -> string -> bool -> Wcs_t.json

set_bool o x b sets the a field x of the object o with value b.

val get_bool : Wcs_t.json -> string -> bool option

get_bool o x gets the value of the field x of the object o.

String fields
val set_string : Wcs_t.json -> string -> string -> Wcs_t.json

set_string o x x sets the a field x of the object o with string s.

val get_string : Wcs_t.json -> string -> string option

get_string o x gets the value of the field x of the object o.

val take_string : Wcs_t.json -> string -> Wcs_t.json * string option

take_string o x takes the value of the field x of the object o.

OCaml

Innovation. Community. Security.