Daily check-in.
[guestfs-browser.git] / utils.mli
1 (* Guestfs Browser.
2  * Copyright (C) 2010 Red Hat Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  *)
18
19 (** General-purpose utility code used everywhere. *)
20
21 val (+^) : int64 -> int64 -> int64
22 val (-^) : int64 -> int64 -> int64
23 val ( *^ ) : int64 -> int64 -> int64
24 val (/^) : int64 -> int64 -> int64
25   (** Int64 arithmetic operators. *)
26
27 type ('a, 'b) either = Left of 'a | Right of 'b
28   (** A value which is either an ['a] or a ['b], just like Haskell's
29       "Either" type. *)
30
31 val verbose : unit -> bool
32 val set_verbose_flag : unit -> unit
33   (** If this contains [true] then {!debug} will send debugging
34       messages to stderr, else debugging messages are dropped.
35
36       This is set through the --verbose command line option. *)
37
38 val debug : ('a, unit, string, unit) format4 -> 'a
39   (** A printf-like function for writing debugging messages. *)
40
41 val failwith : ('a, unit, string, 'b) format4 -> 'a
42   (** Replacement for standard OCaml [failwith] function.  This can
43       take a printf-like argument list, and also logs errors on stderr
44       when verbose is enabled. *)
45
46 val trace : unit -> bool
47 val set_trace_flag : unit -> unit
48   (** If this contains [true] then calls to libguestfs are traced.
49
50       This is set through the [-x] command line option. *)
51
52 val connect_uri : unit -> string option
53 val set_connect_uri : string option -> unit
54   (** The libvirt connection URI.
55
56       This is set through the [--connect] command line option. *)
57
58 val utf8_rarrow : string (** UTF-8 RIGHTWARDS ARROW *)
59
60 val human_size_1k : int64 -> string
61   (** Convert a number (of 1K blocks) into a human readable string. *)
62
63 val unique : unit -> int
64   (** Return a new integer each time called. *)
65
66 val mklabel : string -> GObj.widget
67   (** Convenience function to make a label containing some text.  It is
68       returned as a generic widget. *)
69
70 val libguestfs_version_string : unit -> string
71   (** Return the version of libguestfs as a string. *)
72
73 val libvirt_version_string : unit -> string
74   (** Return the version of libvirt as a string. *)
75
76 val (//) : string -> string -> string
77   (** Concatenate two paths. *)