GnuCash
2.6.99
|
a simple price database for gnucash More...
Go to the source code of this file.
Macros | |
#define | GNC_TYPE_PRICE (gnc_price_get_type ()) |
#define | GNC_PRICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_PRICE, GNCPrice)) |
#define | GNC_PRICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_PRICE, GNCPriceClass)) |
#define | GNC_IS_PRICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_PRICE)) |
#define | GNC_IS_PRICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_PRICE)) |
#define | GNC_PRICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_PRICE, GNCPriceClass)) |
#define | GNC_TYPE_PRICEDB (gnc_pricedb_get_type ()) |
#define | GNC_PRICEDB(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_PRICEDB, GNCPriceDB)) |
#define | GNC_PRICEDB_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_PRICEDB, GNCPriceDBClass)) |
#define | GNC_IS_PRICEDB(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_PRICEDB)) |
#define | GNC_IS_PRICEDB_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_PRICEDB)) |
#define | GNC_PRICEDB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_PRICEDB, GNCPriceDBClass)) |
Price Parameter Names | |
For use with QofQuery | |
#define | PRICE_COMMODITY "price-commodity" |
#define | PRICE_CURRENCY "price-currency" |
#define | PRICE_DATE "price-date" |
#define | PRICE_SOURCE "price-source" |
#define | PRICE_TYPE "price-type" |
#define | PRICE_VALUE "price-value" |
Typedefs | |
typedef struct _GncPriceClass | GNCPriceClass |
typedef struct _GncPriceDBClass | GNCPriceDBClass |
typedef struct gnc_price_lookup_s | GNCPriceLookup |
typedef GList | PriceList |
typedef struct gnc_price_db_s | GNCPriceDB |
Functions | |
GType | gnc_price_get_type (void) |
GType | gnc_pricedb_get_type (void) |
GNCPriceDB * | gnc_pricedb_get_db (QofBook *book) |
GNCPriceDB * | gnc_collection_get_pricedb (QofCollection *col) |
void | gnc_pricedb_destroy (GNCPriceDB *db) |
void | gnc_pricedb_begin_edit (GNCPriceDB *) |
void | gnc_pricedb_commit_edit (GNCPriceDB *) |
void | gnc_pricedb_set_bulk_update (GNCPriceDB *db, gboolean bulk_update) |
gboolean | gnc_pricedb_add_price (GNCPriceDB *db, GNCPrice *p) |
gboolean | gnc_pricedb_remove_price (GNCPriceDB *db, GNCPrice *p) |
gboolean | gnc_pricedb_remove_old_prices (GNCPriceDB *db, Timespec cutoff, const gboolean delete_user, gboolean delete_last) |
GNCPrice * | gnc_pricedb_lookup_latest (GNCPriceDB *db, const gnc_commodity *commodity, const gnc_commodity *currency) |
PriceList * | gnc_pricedb_lookup_latest_any_currency (GNCPriceDB *db, const gnc_commodity *commodity) |
gboolean | gnc_pricedb_has_prices (GNCPriceDB *db, const gnc_commodity *commodity, const gnc_commodity *currency) |
PriceList * | gnc_pricedb_get_prices (GNCPriceDB *db, const gnc_commodity *commodity, const gnc_commodity *currency) |
PriceList * | gnc_pricedb_lookup_at_time (GNCPriceDB *db, const gnc_commodity *commodity, const gnc_commodity *currency, Timespec t) |
GNCPrice * | gnc_pricedb_lookup_day (GNCPriceDB *db, const gnc_commodity *commodity, const gnc_commodity *currency, Timespec t) |
GNCPrice * | gnc_pricedb_lookup_nearest_in_time (GNCPriceDB *db, const gnc_commodity *c, const gnc_commodity *currency, Timespec t) |
PriceList * | gnc_pricedb_lookup_nearest_in_time_any_currency (GNCPriceDB *db, const gnc_commodity *c, Timespec t) |
GNCPrice * | gnc_pricedb_lookup_latest_before (GNCPriceDB *db, gnc_commodity *c, gnc_commodity *currency, Timespec t) |
PriceList * | gnc_pricedb_lookup_latest_before_any_currency (GNCPriceDB *db, gnc_commodity *c, Timespec t) |
gnc_numeric | gnc_pricedb_convert_balance_latest_price (GNCPriceDB *pdb, gnc_numeric balance, const gnc_commodity *balance_currency, const gnc_commodity *new_currency) |
gnc_numeric | gnc_pricedb_convert_balance_nearest_price (GNCPriceDB *pdb, gnc_numeric balance, const gnc_commodity *balance_currency, const gnc_commodity *new_currency, Timespec t) |
gboolean | gnc_pricedb_foreach_price (GNCPriceDB *db, gboolean(*f)(GNCPrice *p, gpointer user_data), gpointer user_data, gboolean stable_order) |
guint | gnc_pricedb_get_num_prices (GNCPriceDB *db) |
gboolean | gnc_pricedb_equal (GNCPriceDB *db1, GNCPriceDB *db2) |
Constructors | |
GNCPrice * | gnc_price_create (QofBook *book) |
GNCPrice * | gnc_price_clone (GNCPrice *p, QofBook *book) |
Memory Management | |
void | gnc_price_ref (GNCPrice *p) |
void | gnc_price_unref (GNCPrice *p) |
Setters | |
All of the setters store copies of the data given, with the exception of the commodity field which just stores the pointer given. It is assumed that commodities are a global resource and are pointer unique. Invocations of the setters should be wrapped with calls to gnc_price_begin_edit() and commit_edit(). The begin/commit calls help ensure that the local price db is synchronized with the backend. | |
void | gnc_price_begin_edit (GNCPrice *p) |
void | gnc_price_commit_edit (GNCPrice *p) |
void | gnc_price_set_commodity (GNCPrice *p, gnc_commodity *c) |
void | gnc_price_set_currency (GNCPrice *p, gnc_commodity *c) |
void | gnc_price_set_time (GNCPrice *p, Timespec t) |
void | gnc_price_set_source (GNCPrice *p, const char *source) |
void | gnc_price_set_typestr (GNCPrice *p, const char *type) |
void | gnc_price_set_value (GNCPrice *p, gnc_numeric value) |
Internal/Debugging | |
void | gnc_price_print (GNCPrice *db, FILE *f, int indent) |
void | gnc_pricedb_print_contents (GNCPriceDB *db, FILE *f) |
GNCPrice lists | |
The database communicates multiple prices in and out via gnc price lists. These are just time sorted GLists of GNCPrice pointers. Functions for manipulating these lists are provided. These functions are helpful in that they handle maintaining proper reference counts on behalf of the price list for every price being held in a given list. I.e. insert "refs" the prices being inserted, remove and destroy "unref" the prices that will no longer be referred to by the list. | |
gboolean | gnc_price_list_insert (PriceList **prices, GNCPrice *p, gboolean check_dupl) |
gboolean | gnc_price_list_remove (PriceList **prices, GNCPrice *p) |
void | gnc_price_list_destroy (PriceList *prices) |
gboolean | gnc_price_list_equal (PriceList *prices1, PriceList *prices2) |
Getters | |
All of the getters return data that's internal to the GNCPrice, not copies, so don't free these values. | |
#define | gnc_price_get_guid(X) qof_entity_get_guid(QOF_INSTANCE(X)) |
#define | gnc_price_return_guid(X) (*(qof_entity_get_guid(QOF_INSTANCE(X)))) |
#define | gnc_price_get_book(X) qof_instance_get_book(QOF_INSTANCE(X)) |
GNCPrice * | gnc_price_lookup (const GncGUID *guid, QofBook *book) |
gnc_commodity * | gnc_price_get_commodity (const GNCPrice *p) |
gnc_commodity * | gnc_price_get_currency (const GNCPrice *p) |
Timespec | gnc_price_get_time (const GNCPrice *p) |
const char * | gnc_price_get_source (const GNCPrice *p) |
const char * | gnc_price_get_typestr (const GNCPrice *p) |
gnc_numeric | gnc_price_get_value (const GNCPrice *p) |
gboolean | gnc_price_equal (const GNCPrice *p1, const GNCPrice *p2) |
a simple price database for gnucash
Definition in file gnc-pricedb.h.