]> 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-2019 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 *iso_code;
33 gboolean sym_prefix;
34 gchar *symbol; /* max symbol is 3 digits in unicode but mostly is 1 digit */
35 gchar *decimal_char;
36 gchar *grouping_char;
37 gshort frac_digits;
38 gshort _pad1;
39 gdouble rate;
40 guint32 mdate;
41 /* unsaved datas */
42 gchar format[8]; /* hold decimal format: '%.xf' */
43 gchar monfmt[32]; /* hold monetary format: 'prefix %s suffix' */
44 };
45
46 // 0 is free
47 #define CF_CUSTOM (1<<1)
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
62 void da_cur_free(Currency *item);
63 Currency *da_cur_malloc(void);
64 void da_cur_destroy(void);
65 void da_cur_new(void);
66
67 guint da_cur_length(void);
68 gboolean da_cur_remove(guint32 key);
69
70 void da_cur_init_from4217(Currency *cur, Currency4217 *curfmt);
71 void da_cur_initformat(Currency *item);
72
73 gboolean da_cur_insert(Currency *item);
74 gboolean da_cur_append(Currency *item);
75 guint32 da_cur_get_max_key(void);
76
77 Currency *da_cur_get_by_name(gchar *name);
78 Currency *da_cur_get_by_iso_code(gchar *iso_code);
79 Currency *da_cur_get(guint32 key);
80
81 gboolean currency_is_euro(guint32 key);
82 gboolean currency_is_used(guint32 key);
83 Currency *currency_add_from_user(Currency4217 *curfmt);
84 gboolean currency_online_sync(GError **error);
85
86 Currency4217 *iso4217format_get(gchar *code);
87
88
89 #endif
90
This page took 0.035776 seconds and 4 git commands to generate.