summaryrefslogtreecommitdiff
path: root/src/unit-category.h
blob: fc2c73971af506b684792025ea7d729ff179f017 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * Copyright (C) 1987-2008 Sun Microsystems, Inc. All Rights Reserved.
 * Copyright (C) 2008-2011 Robert Ancell.
 * 
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 2 of the License, or (at your option) any later
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
 * license.
 */

#ifndef UNIT_CATEGORY_H
#define UNIT_CATEGORY_H

#include <glib-object.h>
#include "unit.h"
#include "mp.h"

G_BEGIN_DECLS

#define UNIT_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), unit_category_get_type(), UnitCategory))

typedef struct UnitCategoryPrivate UnitCategoryPrivate;

typedef struct
{
    GObject parent_instance;
    UnitCategoryPrivate *priv;
} UnitCategory;

typedef struct
{
    GObjectClass parent_class;
} UnitCategoryClass;

GType unit_category_get_type(void);

UnitCategory *unit_category_new(const gchar *name, const gchar *display_name);

const gchar *unit_category_get_name(UnitCategory *category);

const gchar *unit_category_get_display_name(UnitCategory *category);

Unit *unit_category_get_unit_by_name(UnitCategory *category, const gchar *name);

Unit *unit_category_get_unit_by_symbol(UnitCategory *category, const gchar *symbol);

void unit_category_add_unit(UnitCategory *category, Unit *unit);

const GList *unit_category_get_units(UnitCategory *category);

gboolean unit_category_convert(UnitCategory *category, const MPNumber *x, Unit *x_units, Unit *z_units, MPNumber *z);

G_END_DECLS

#endif /* UNIT_CATEGORY_H */