crude attempt to add price query

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9090 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2003-08-16 14:13:50 +00:00
parent 96cf4db1f5
commit be3034128e
3 changed files with 30 additions and 8 deletions

View File

@ -58,6 +58,7 @@
#define GNC_ID_NULL QOF_ID_NULL
#define GNC_ID_ACCOUNT "Account"
#define GNC_ID_COMMODITY "Commodity"
#define GNC_ID_COMMODITY_TABLE "CommodityTable"
#define GNC_ID_FREQSPEC "FreqSpec"
#define GNC_ID_GROUP "AccountGroup"
@ -70,12 +71,6 @@
#define GNC_ID_SXTT "SXTT"
#define GNC_ID_TRANS "Trans"
/* TYPES **********************************************************/
/** @brief Account in Gnucash.

View File

@ -38,6 +38,7 @@
#include "qofbook-p.h"
#include "qofid-p.h"
#include "qofobject.h"
#include "qofqueryobject.h"
/* This static indicates the debugging module that this .o belongs to. */
static short module = MOD_PRICE;
@ -66,6 +67,8 @@ gnc_price_create (QofBook *book)
p->version = 0;
p->version_check = 0;
p->value = gnc_numeric_zero();
p->type = NULL;
p->source = NULL;
p->book = book;
p->entity_table = qof_book_get_entity_table (book);
@ -1979,6 +1982,18 @@ static QofObject pricedb_object_def =
gboolean
gnc_pricedb_register (void)
{
static QofQueryObject params[] = {
{ PRICE_COMMODITY, GNC_ID_COMMODITY, (QofAccessFunc)gnc_price_get_commodity },
{ PRICE_CURRENCY, GNC_ID_COMMODITY, (QofAccessFunc)gnc_price_get_currency },
{ PRICE_DATE, QOF_QUERYCORE_DATE, (QofAccessFunc)gnc_price_get_time },
{ PRICE_SOURCE, QOF_QUERYCORE_STRING, (QofAccessFunc)gnc_price_get_source },
{ PRICE_TYPE, QOF_QUERYCORE_STRING, (QofAccessFunc)gnc_price_get_type },
{ PRICE_VALUE, QOF_QUERYCORE_NUMERIC, (QofAccessFunc)gnc_price_get_value },
{ NULL },
};
qof_query_object_register (GNC_ID_PRICE, NULL, params);
return qof_object_register (&pricedb_object_def);
}

View File

@ -54,7 +54,6 @@
*/
/* *********************************************************************/
/** GNCPrice:
@ -358,5 +357,18 @@ gboolean gnc_pricedb_equal (GNCPriceDB *db1, GNCPriceDB *db2);
void gnc_price_print(GNCPrice *db, FILE *f, int indent);
void gnc_pricedb_print_contents(GNCPriceDB *db, FILE *f);
#endif
/** @name 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"
/**@}*/
#endif /* GNC_PRICEDB_H */
/** @} */