summaryrefslogtreecommitdiff
path: root/src/reference_tree.mli
blob: b1341daaf79d79d1f7e5d0dcfc30d1617b52596d (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
type node_type = [ `Leaf | `Tag | `Other ]

type path_type = [ node_type | `Tag_value | `Leaf_value | `Multi | `Invalid ]

val path_type_to_yojson : path_type -> Yojson.Safe.t
val path_type_of_yojson : Yojson.Safe.t -> (path_type, string) result

type completion_help_type =
    | List of string [@name "list"]
    | Path of string [@name "path"]
    | Script of string [@name "script"]
    [@@deriving yojson]

type doc_hints = {
    text: string;
    hint_type: string;
} [@@deriving yojson]

type docs = {
    headline: string;
    text: string;
    usageExample: string;
    hints: doc_hints list;
} [@@deriving to_yojson]

type ref_node_data = {
    node_type: node_type;
    constraints: Value_checker.value_constraint list;
    constraint_group: Value_checker.value_constraint list;
    constraint_error_message: string;
    constraint_silence_output: bool;
    completion_help: completion_help_type list;
    help: string;
    value_help: (string * string) list;
    multi: bool;
    valueless: bool;
    owner: string option;
    priority: string option;
    default_value: string option;
    hidden: bool;
    secret: bool;
    docs: docs;
} [@@deriving yojson]

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

exception Bad_interface_definition of string

exception Validation_error of string

val default_data : ref_node_data

val default : t

val make : string -> t

val load_from_xml : t -> string -> t
[@@alert exn "Reference_tree.Bad_interface_definition"]

val find_xml_child : string -> Xml_light_types.xml -> Xml_light_types.xml option

val validate_path : string -> t -> string list -> unit
[@@alert exn "Reference_tree.Validation_error"]

val validate_tree_filter : string -> t -> Config_tree.t -> Config_tree.t * string

val validate_tree : string -> t -> Config_tree.t -> string
[@@alert exn "Reference_tree.Validation_error"]

val split_path : t -> string list -> string list * string option

val is_multi : t -> string list -> bool
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

val is_hidden : t -> string list -> bool
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

val is_secret : t -> string list -> bool
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

val is_tag : t -> string list -> bool
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

val is_leaf : t -> string list -> bool
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

val is_valueless : t -> string list -> bool
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

val get_owner : t -> string list -> string option
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

val get_priority : t -> string list -> string option
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

val get_help_string : t -> string list -> string
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

val get_value_help : t -> string list -> (string * string) list
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

val get_default_value : t -> string list -> string option
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

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

val refpath : t -> string list -> string list

val refpath_from_partial : t -> string list -> string list

val set_tag_data : t -> Config_tree.t -> string list -> Config_tree.t
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

val set_leaf_data : t -> Config_tree.t -> string list -> Config_tree.t
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

val reference_path_exists : t -> string list -> bool

val get_path_type : t -> string list -> path_type

val get_path_type_str : ?legacy_format:bool -> t -> string list -> string

val allowed_edit_level : t -> string list -> (unit, string) result

val get_ceil_data : (ref_node_data -> string option) -> t -> string list -> string option
[@@alert exn "Vytree.Empty_path"]
[@@alert exn "Vytree.Nonexistent_path"]

val render_json : t -> string