GnuCash  5.6-150-g038405b370+
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 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
38 {
39  /* 'public' data fields */
40  QofInstance inst; /* globally unique object identifier */
41 
42  GNCPriceDB *db;
43  gnc_commodity *commodity;
44  gnc_commodity *currency;
45  time64 tmspec;
46  PriceSource source;
47  const char *type;
48  gnc_numeric value;
49 
50  /* 'private' object management fields */
51  guint32 refcount; /* garbage collection reference count */
52 };
53 
55 {
56  QofInstanceClass parent_class;
57 };
58 
60 {
61  QofInstance inst; /* globally unique object identifier */
62  GHashTable *commodity_hash;
63  gboolean bulk_update; /* TRUE while reading XML file, etc. */
64  gboolean reset_nth_price_cache;
65 };
66 
68 {
69  QofInstanceClass parent_class;
70 };
71 
72 /* These structs define the kind of price lookup being done
73  * so that it can be passed to the backend. This is a rather
74  * cheesy, low-brow interface. It could stand improvement.
75  */
76 typedef enum
77 {
78  LOOKUP_LATEST = 1,
79  LOOKUP_ALL,
80  LOOKUP_AT_TIME,
81  LOOKUP_NEAREST_IN_TIME,
82  LOOKUP_LATEST_BEFORE,
83  LOOKUP_EARLIEST_AFTER
84 } PriceLookupType;
85 
86 typedef struct gnc_price_lookup_helper_s
87 {
88  GList **return_list;
89  gnc_commodity *key;
90  time64 time;
92 
93 #define gnc_price_set_guid(P,G) qof_instance_set_guid(QOF_INSTANCE(P),(G))
94 void gnc_pricedb_substitute_commodity(GNCPriceDB *db,
95  gnc_commodity *old_c,
96  gnc_commodity *new_c);
97 
99 gboolean gnc_pricedb_register (void);
100 
101 QofBackend * xaccPriceDBGetBackend (GNCPriceDB *prdb);
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
107 #endif
a simple price database for gnucash
Data type.
Definition: gnc-pricedb-p.h:59
Price of commodity on a given date.
Definition: gnc-pricedb-p.h:37
All type declarations for the whole Gnucash engine.
PriceSource
Price source enum.
Definition: gnc-pricedb.h:169
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition: gnc-date.h:87