summaryrefslogtreecommitdiff
path: root/src/config_tree.mli
blob: c05bab9fb94c782c39a3b85da905adbf3210a7de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
type value_behaviour = AddValue | ReplaceValue
type command = Set | Delete

exception Duplicate_value
exception Node_has_no_value
exception No_such_value
exception Useless_set

type config_node_data = {
  values : string list;
  comment : string option;
  tag : bool;
  leaf: bool;
} [@@deriving yojson]

type t = config_node_data Vytree.t [@@deriving yojson]

val default_data : config_node_data

val default : t

val make : string -> t

val create_node : t -> string list -> t

val set : t -> string list -> string option -> value_behaviour -> t

val delete : t -> string list -> string option -> t

val get_values : t -> string list -> string list

val get_value : t -> string list -> string

val set_comment : t -> string list -> string option -> t

val get_comment : t -> string list -> string option

val set_tag : t -> string list -> bool -> t

val is_tag : t -> string list -> bool

val set_leaf : t -> string list -> bool -> t

val is_leaf : t -> string list -> bool

val get_subtree : ?with_node:bool -> t -> string list -> t

val render_commands : ?op:command -> t -> string list -> string

val render_config : ?ord_val:bool -> t -> string

val render_json : t -> string

val render_json_ast : t -> string

val render_at_level : t -> string list -> string