X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fregistry%2Fhelm_registry.mli;h=1f40b5453fa0e352b859e352b41b4b9426d53c23;hb=c5d5bf37b1e4c4b9b499ed2cbfe27cf2ec181944;hp=1f84333fe2bed5426e2061b2688d9d8d52b43fdc;hpb=0027da83c65b1dd0689f8d89b00bb77206dbd654;p=helm.git diff --git a/helm/ocaml/registry/helm_registry.mli b/helm/ocaml/registry/helm_registry.mli index 1f84333fe..1f40b5453 100644 --- a/helm/ocaml/registry/helm_registry.mli +++ b/helm/ocaml/registry/helm_registry.mli @@ -54,6 +54,13 @@ * - the whole key is uppercased * - each "." is converted to "__" * E.g.: my.foo_ish.application -> MY__FOO_ISH__APPLICATION + * + * ++ Variable interpolation ++ + * + * Interpolation is supported with the following syntax: + * + * foo.bar = "quux" + * foo.baz = $(foo.bar)/baz *) (** raised when a looked up key can't be found @@ -97,22 +104,51 @@ exception Invalid_value of (string * string) * string val get: string -> string val set: key:string -> value:string -> unit + (** remove a key from the current environment, next get over this key will + * raise Key_not_found until the key will be redefined *) +val unset: string -> unit + (** {2 Typed interface} * Three basic types are supported: strings, int and strings list. Strings * correspond literally to what is written inside double quotes; int to the * parsing of an integer number from ; strings list to the splitting at blanks * of it (heading and trailing blanks are removed before splitting) *) -val get_string: string -> string (* alias for bare "get" above *) -val get_int: string -> int -val get_float: string -> float -val get_string_list: string -> string list +val get_string: string -> string (* alias for bare "get" above *) +val get_int: string -> int +val get_float: string -> float +val get_bool: string -> bool +val get_string_list: string -> string list (* alias for bare "set" above *) -val set_string: key:string -> value:string -> unit -val set_int: key:string -> value:int -> unit -val set_float: key:string -> value:float -> unit -val set_string_list: key:string -> value:string list -> unit +val set_string: key:string -> value:string -> unit +val set_int: key:string -> value:int -> unit +val set_float: key:string -> value:float -> unit +val set_bool: key:string -> value:bool -> unit +val set_string_list: key:string -> value:string list -> unit + +(** {3 Optional values interface} + * Functions below took as first argument respectively a "getter" and a "setter" + * function. A getter is one of the get_* function above, a setter is one of the + * set_* function above. Returned value is a get (set) function typed as the + * given getter (setter) whith optional values. None is returned for missing + * keys and None can be assigned to a key removing it from the registry. + * + * Sample usage: + * + * match Helm_registry.get_opt Helm_registry.get_int "foo.bar" with + * | Some i -> ... + * | None -> ... + *) + +val get_opt: + (string -> 'a) (* getter *) -> + string -> 'a option +val set_opt: + (key:string -> value:'a -> unit) (* setter *) -> + key:string -> value:'a option -> unit +val get_opt_default: (* as get_opt with an additional default value *) + (string -> 'a) -> 'a -> string -> 'a (** {2 Validators} * Each key may have zero or more associated validators, that are predicates @@ -138,14 +174,20 @@ val add_validator: * Validators aren't saved. load_from/save_to sequences don't preserve comments *) - (** @param fname file to which save current configuration *) + (** @param fname file to which save current configuration + * If xmllint is available then it will be used for pretty printing fname, + * otherwise fname will be in the usual pxp ugly format *) val save_to: string -> unit - (** @param fname file from which load new configuration *) -val load_from: string -> unit + (** @param fname file from which load new configuration. If it's an absolute + * file name "path" argument is ignored. + * Otherwise given file name is looked up in each directory member of the + * given path. Each matching file is loaded overriding previous settings. If + * no path is given a default path composed of just the current working + * directory is used. + *) +val load_from: ?path:string list -> string -> unit -(* (* DEBUGGING *) -val dump: unit -> unit -*) +(* val dump: unit -> unit *)