]> Dogcows Code - chaz/homebank/blob - src/hb-currency.h
Merge branch 'upstream'
[chaz/homebank] / src / hb-currency.h
1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2012 Maxime DOYEN
3 *
4 * This file is part of HomeBank.
5 *
6 * HomeBank is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * HomeBank is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef __HB_CURRENCY_H__
21 #define __HB_CURRENCY_H__
22
23 typedef struct _currency Currency;
24 typedef struct _iso4217 Currency4217;
25
26
27 struct _currency
28 {
29 guint32 key;
30 //gushort flags;
31 gchar *name;
32 //gchar *country;
33 gchar *iso_code;
34 gboolean sym_prefix;
35 gchar *symbol; /* max symbol is 3 digits in unicode but mostly is 1 digit */
36 gchar *decimal_char;
37 gchar *grouping_char;
38 gshort frac_digits;
39 gshort _pad1;
40 gdouble rate;
41 guint32 mdate;
42
43 /* unsaved datas */
44 gchar format[8]; /* hold decimal format: '%.xf' */
45 gchar monfmt[32]; /* hold monetary format: 'prefix %s suffix' */
46
47 };
48
49
50 struct _iso4217
51 {
52 gchar *curr_iso_code;
53 guint curr_frac_digit;
54 gchar *curr_dec_char;
55 gchar *curr_grp_char;
56 gboolean curr_is_prefix;
57 gchar *curr_symbol;
58 gchar *name;
59 };
60
61 typedef struct _ParseExchangeContext ParseExchangeContext;
62 struct _ParseExchangeContext
63 {
64 const gchar *elt_name;
65 gchar iso[8];
66 gdouble rate;
67
68 };
69
70
71 void da_cur_free(Currency *item);
72 Currency *da_cur_malloc(void);
73 void da_cur_destroy(void);
74 void da_cur_new(void);
75
76 guint da_cur_length(void);
77 gboolean da_cur_remove(guint32 key);
78
79 void da_cur_init_from4217(Currency *cur, Currency4217 *curfmt);
80 void da_cur_initformat(Currency *item);
81
82 gboolean da_cur_insert(Currency *item);
83 gboolean da_cur_append(Currency *item);
84 guint32 da_cur_get_max_key(void);
85
86 Currency *da_cur_get_by_iso_code(gchar *iso_code);
87 Currency *da_cur_get(guint32 key);
88
89 gboolean currency_is_used(guint32 key);
90 Currency *currency_add_from_user(Currency4217 *curfmt);
91 gboolean currency_sync_online(GError **error);
92
93
94 #endif
95
This page took 0.037658 seconds and 4 git commands to generate.