Support both μs and us for entering microseconds
[gcalctool.git] / src / unit-category.h
blobfc2c73971af506b684792025ea7d729ff179f017
1 /*
2 * Copyright (C) 1987-2008 Sun Microsystems, Inc. All Rights Reserved.
3 * Copyright (C) 2008-2011 Robert Ancell.
4 *
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
9 * license.
12 #ifndef UNIT_CATEGORY_H
13 #define UNIT_CATEGORY_H
15 #include <glib-object.h>
16 #include "unit.h"
17 #include "mp.h"
19 G_BEGIN_DECLS
21 #define UNIT_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), unit_category_get_type(), UnitCategory))
23 typedef struct UnitCategoryPrivate UnitCategoryPrivate;
25 typedef struct
27 GObject parent_instance;
28 UnitCategoryPrivate *priv;
29 } UnitCategory;
31 typedef struct
33 GObjectClass parent_class;
34 } UnitCategoryClass;
36 GType unit_category_get_type(void);
38 UnitCategory *unit_category_new(const gchar *name, const gchar *display_name);
40 const gchar *unit_category_get_name(UnitCategory *category);
42 const gchar *unit_category_get_display_name(UnitCategory *category);
44 Unit *unit_category_get_unit_by_name(UnitCategory *category, const gchar *name);
46 Unit *unit_category_get_unit_by_symbol(UnitCategory *category, const gchar *symbol);
48 void unit_category_add_unit(UnitCategory *category, Unit *unit);
50 const GList *unit_category_get_units(UnitCategory *category);
52 gboolean unit_category_convert(UnitCategory *category, const MPNumber *x, Unit *x_units, Unit *z_units, MPNumber *z);
54 G_END_DECLS
56 #endif /* UNIT_CATEGORY_H */