summaryrefslogtreecommitdiff
path: root/src/vytree.mli
blob: 451e13075764cd6fcde9ec73ff9e11c54da9aa4b (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
type 'a t [@@deriving yojson]

exception Empty_path
exception Duplicate_child
exception Nonexistent_path
exception Insert_error of string

type position = Before of string | After of string | End | Default

val make : 'a -> string -> 'a t
val make_full : 'a -> string -> ('a t) list -> 'a t

val name_of_node : 'a t -> string
val data_of_node : 'a t -> 'a
val children_of_node : 'a t -> 'a t list

val find : 'a t -> string -> 'a t option
val find_or_fail : 'a t -> string -> 'a t

val adopt : 'a t -> 'a t -> 'a t

val insert : ?position:position -> ?children:('a t list) -> 'a t -> string list -> 'a -> 'a t

val insert_multi_level : 'a -> 'a t -> string list -> string list -> 'a -> 'a t

val merge_children : ('a -> 'a -> 'a) -> 'a t -> 'a t

val delete : 'a t -> string list -> 'a t

val update : 'a t -> string list -> 'a -> 'a t

val rename : 'a t -> string list -> string -> 'a t

val list_children : 'a t -> string list

val get : 'a t -> string list -> 'a t

val get_existent_path : 'a t -> string list -> string list

val get_data : 'a t -> string list -> 'a

val exists : 'a t -> string list -> bool

val children_of_path : 'a t -> string list -> string list

val sorted_children_of_node : (string -> string -> int) -> 'a t -> ('a t) list

val copy : 'a t -> string list -> string list -> 'a t

val move : 'a t -> string list -> position -> 'a t