2 * Copyright (C) 1987-2008 Sun Microsystems, Inc. All Rights Reserved.
3 * Copyright (C) 2008-2011 Robert Ancell.
5 * This program is free software: you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation, either version 2 of the License, or (at your option) any later
8 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
15 #include <glib-object.h>
20 #define UNIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), unit_get_type(), Unit))
22 typedef struct UnitPrivate UnitPrivate
;
26 GObject parent_instance
;
32 GObjectClass parent_class
;
35 GType
unit_get_type(void);
37 Unit
*unit_new(const gchar
*name
,
38 const gchar
*display_name
,
40 const gchar
*from_function
,
41 const gchar
*to_function
,
42 const gchar
*symbols
);
44 const gchar
*unit_get_name(Unit
*unit
);
46 const gchar
*unit_get_display_name(Unit
*unit
);
48 gboolean
unit_matches_symbol(Unit
*unit
, const gchar
*symbol
);
50 const GList
*unit_get_symbols(Unit
*unit
);
52 gboolean
unit_convert_from(Unit
*unit
, const MPNumber
*x
, MPNumber
*z
);
54 gboolean
unit_convert_to(Unit
*unit
, const MPNumber
*x
, MPNumber
*z
);
56 gchar
*unit_format(Unit
*unit
, MPNumber
*x
);