GnuCash  4.12-527-g05ffd3d4eb
gnc-pricedb-p.h
1 /********************************************************************
2  * gnc-pricedb-p.h -- a simple price database for gnucash. *
3  * Copyright (C) 2001 Rob Browning *
4  * Copyright (C) 2003 Linas Vepstas <linas@linas.org> *
5  * *
6  * This program is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU General Public License as *
8  * published by the Free Software Foundation; either version 2 of *
9  * the License, or (at your option) any later version. *
10  * *
11  * This program 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, contact: *
18  * *
19  * Free Software Foundation Voice: +1-617-542-5942 *
20  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
21  * Boston, MA 02110-1301, USA gnu@gnu.org *
22  * *
23  *******************************************************************/
24 
25 #ifndef GNC_PRICEDB_P_H
26 #define GNC_PRICEDB_P_H
27 
28 #include <glib.h>
29 #include "qof.h"
30 #include "gnc-engine.h"
31 #include "gnc-pricedb.h"
32 
34 {
35  /* 'public' data fields */
36  QofInstance inst; /* globally unique object identifier */
37 
38  GNCPriceDB *db;
39  gnc_commodity *commodity;
40  gnc_commodity *currency;
41  time64 tmspec;
42  PriceSource source;
43  const char *type;
44  gnc_numeric value;
45 
46  /* 'private' object management fields */
47  guint32 refcount; /* garbage collection reference count */
48 };
49 
51 {
52  QofInstanceClass parent_class;
53 };
54 
56 {
57  QofInstance inst; /* globally unique object identifier */
58  GHashTable *commodity_hash;
59  gboolean bulk_update; /* TRUE while reading XML file, etc. */
60  gboolean reset_nth_price_cache;
61 };
62 
64 {
65  QofInstanceClass parent_class;
66 };
67 
68 /* These structs define the kind of price lookup being done
69  * so that it can be passed to the backend. This is a rather
70  * cheesy, low-brow interface. It could stand improvement.
71  */
72 typedef enum
73 {
74  LOOKUP_LATEST = 1,
75  LOOKUP_ALL,
76  LOOKUP_AT_TIME,
77  LOOKUP_NEAREST_IN_TIME,
78  LOOKUP_LATEST_BEFORE,
79  LOOKUP_EARLIEST_AFTER
80 } PriceLookupType;
81 
82 typedef struct gnc_price_lookup_helper_s
83 {
84  GList **return_list;
85  gnc_commodity *key;
86  time64 time;
88 
89 #define gnc_price_set_guid(P,G) qof_instance_set_guid(QOF_INSTANCE(P),(G))
90 void gnc_pricedb_substitute_commodity(GNCPriceDB *db,
91  gnc_commodity *old_c,
92  gnc_commodity *new_c);
93 
95 gboolean gnc_pricedb_register (void);
96 
97 QofBackend * xaccPriceDBGetBackend (GNCPriceDB *prdb);
98 
99 #endif
a simple price database for gnucash
Data type.
Definition: gnc-pricedb-p.h:55
Price of commodity on a given date.
Definition: gnc-pricedb-p.h:33
All type declarations for the whole Gnucash engine.
PriceSource
Price source enum.
Definition: gnc-pricedb.h:169
gint64 time64
Many systems, including Microsoft Windows and BSD-derived Unixes like Darwin, are retaining the int-3...
Definition: gnc-date.h:93