diff options
author | Daniil Baturin <daniil@baturin.org> | 2016-12-20 17:19:21 +0700 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2016-12-20 17:19:21 +0700 |
commit | f0eeeead03cd27c375ca28161dab603bee56341c (patch) | |
tree | 00dbf4d4c828daed1ab3421acf8339b40bd9897b /src | |
parent | b85abf9de8c388e5d3d10b144f76d0a16b175543 (diff) | |
download | vyconf-f0eeeead03cd27c375ca28161dab603bee56341c.tar.gz vyconf-f0eeeead03cd27c375ca28161dab603bee56341c.zip |
T224: add node comment functionality to the config tree.
Diffstat (limited to 'src')
-rw-r--r-- | src/config_tree.ml | 11 | ||||
-rw-r--r-- | src/config_tree.mli | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/config_tree.ml b/src/config_tree.ml index cdcbd1c..b97f150 100644 --- a/src/config_tree.ml +++ b/src/config_tree.ml @@ -7,14 +7,14 @@ exception Useless_set type config_node_data = { values: string list; - comment: string; + comment: string option; } type t = config_node_data Vytree.t let default_data = { values = []; - comment = ""; + comment = None; } let make name = Vytree.make default_data name @@ -77,3 +77,10 @@ let delete node path value = | None -> Vytree.delete node path +let set_comment node path comment = + let data = Vytree.get_data node path in + Vytree.update node path {data with comment=comment} + +let get_comment node path = + let data = Vytree.get_data node path in + data.comment diff --git a/src/config_tree.mli b/src/config_tree.mli index 27042f8..ac9c5a9 100644 --- a/src/config_tree.mli +++ b/src/config_tree.mli @@ -5,7 +5,7 @@ exception Node_has_no_value type config_node_data = { values : string list; - comment : string; + comment : string option; } type t = config_node_data Vytree.t @@ -21,3 +21,7 @@ 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 |