X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fhomebank;a=blobdiff_plain;f=src%2Fhb-currency.h;fp=src%2Fhb-currency.h;h=b40d5152a7fbeab01e2638d8b8198d36508e5782;hp=0000000000000000000000000000000000000000;hb=996fa4ab9f6b836001f8ad0eecbfd3821687fea7;hpb=27f6e3b112df235c8e9afc9911b1f6bce208a001 diff --git a/src/hb-currency.h b/src/hb-currency.h new file mode 100644 index 0000000..b40d515 --- /dev/null +++ b/src/hb-currency.h @@ -0,0 +1,95 @@ +/* HomeBank -- Free, easy, personal accounting for everyone. + * Copyright (C) 1995-2012 Maxime DOYEN + * + * This file is part of HomeBank. + * + * HomeBank 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. + * + * HomeBank is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __HB_CURRENCY_H__ +#define __HB_CURRENCY_H__ + +typedef struct _currency Currency; +typedef struct _iso4217 Currency4217; + + +struct _currency +{ + guint32 key; + //gushort flags; + gchar *name; + //gchar *country; + gchar *iso_code; + gboolean sym_prefix; + gchar *symbol; /* max symbol is 3 digits in unicode but mostly is 1 digit */ + gchar *decimal_char; + gchar *grouping_char; + gshort frac_digits; + gshort _pad1; + gdouble rate; + guint32 mdate; + + /* unsaved datas */ + gchar format[8]; /* hold decimal format: '%.xf' */ + gchar monfmt[32]; /* hold monetary format: 'prefix %s suffix' */ + +}; + + +struct _iso4217 +{ + gchar *curr_iso_code; + guint curr_frac_digit; + gchar *curr_dec_char; + gchar *curr_grp_char; + gboolean curr_is_prefix; + gchar *curr_symbol; + gchar *name; +}; + +typedef struct _ParseExchangeContext ParseExchangeContext; +struct _ParseExchangeContext +{ + const gchar *elt_name; + gchar iso[8]; + gdouble rate; + +}; + + +void da_cur_free(Currency *item); +Currency *da_cur_malloc(void); +void da_cur_destroy(void); +void da_cur_new(void); + +guint da_cur_length(void); +gboolean da_cur_remove(guint32 key); + +void da_cur_init_from4217(Currency *cur, Currency4217 *curfmt); +void da_cur_initformat(Currency *item); + +gboolean da_cur_insert(Currency *item); +gboolean da_cur_append(Currency *item); +guint32 da_cur_get_max_key(void); + +Currency *da_cur_get_by_iso_code(gchar *iso_code); +Currency *da_cur_get(guint32 key); + +gboolean currency_is_used(guint32 key); +Currency *currency_add_from_user(Currency4217 *curfmt); +gboolean currency_sync_online(GError **error); + + +#endif +