GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 <[email protected]> *
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 [email protected] *
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  Timespec tmspec;
42  char *source;
43  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 };
61 
63 {
64  QofInstanceClass parent_class;
65 };
66 
67 /* These structs define the kind of price lookup being done
68  * so that it can be passed to the backend. This is a rather
69  * cheesy, low-brow interface. It could stand improvement.
70  */
71 typedef enum
72 {
73  LOOKUP_LATEST = 1,
74  LOOKUP_ALL,
75  LOOKUP_AT_TIME,
76  LOOKUP_NEAREST_IN_TIME,
77  LOOKUP_LATEST_BEFORE,
78  LOOKUP_EARLIEST_AFTER
79 } PriceLookupType;
80 
81 
83 {
84  PriceLookupType type;
85  GNCPriceDB *prdb;
86  const gnc_commodity *commodity;
87  const gnc_commodity *currency;
88  Timespec date;
89 };
90 
91 
93 {
94  GList **return_list;
95  Timespec time;
97 
98 #define gnc_price_set_guid(P,G) qof_instance_set_guid(QOF_INSTANCE(P),(G))
99 void gnc_pricedb_substitute_commodity(GNCPriceDB *db,
100  gnc_commodity *old_c,
101  gnc_commodity *new_c);
102 
104 gboolean gnc_pricedb_register (void);
105 
106 QofBackend * xaccPriceDBGetBackend (GNCPriceDB *prdb);
107 
108 #endif
a simple price database for gnucash
Use a 64-bit unsigned int timespec.
Definition: gnc-date.h:299
All type declarations for the whole Gnucash engine.