GnuCash  4.8a-176-g88ecf8dd1
gnc-engine.h
Go to the documentation of this file.
1 /********************************************************************
2  * gnc-engine.h -- top-level include file for Gnucash Engine *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation; either version 2 of *
7  * the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License*
15  * along with this program; if not, contact: *
16  * *
17  * Free Software Foundation Voice: +1-617-542-5942 *
18  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19  * Boston, MA 02110-1301, USA gnu@gnu.org *
20  * *
21  ********************************************************************/
36 #ifndef GNC_ENGINE_H
37 #define GNC_ENGINE_H
38 
39 #ifdef __cplusplus
40 extern "C++" {
41 #include <glib.h>
42 }
43 #endif
44 
45 #include "qof.h"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
52 // @{
53 #define GNC_MOD_ROOT "gnc"
54 #define GNC_MOD_ENGINE "gnc.engine"
55 #define GNC_MOD_ACCOUNT "gnc.account"
56 #define GNC_MOD_SX "gnc.engine.sx"
57 #define GNC_MOD_QUERY "gnc.query"
58 #define GNC_MOD_SCRUB "gnc.scrub"
59 #define GNC_MOD_LOT "gnc.lots"
60 #define GNC_MOD_COMMODITY "gnc.commodity"
61 #define GNC_MOD_BACKEND "gnc.backend"
62 #define GNC_MOD_PRICE "gnc.pricedb"
63 #define GNC_MOD_BUSINESS "gnc.business"
64 #define GNC_MOD_IO "gnc.io"
65 #define GNC_MOD_BOOK "gnc.book-period"
66 #define GNC_MOD_GUI "gnc.gui"
67 #define GNC_MOD_GUI_SX "gnc.gui.sx"
68 #define GNC_MOD_GUILE "gnc.guile"
69 #define GNC_MOD_LEDGER "gnc.ledger"
70 #define GNC_MOD_REGISTER "gnc.register"
71 #define GNC_MOD_HTML "gnc.html"
72 #define GNC_MOD_PREFS "gnc.pref"
73 #define GNC_MOD_IMPORT "gnc.import"
74 #define GNC_MOD_ASSISTANT "gnc.assistant"
75 #define GNC_MOD_BUDGET "gnc.budget"
76 
77 
95 #define GNC_ID_NONE QOF_ID_NONE
96 #define GNC_ID_BOOK QOF_ID_BOOK
97 #define GNC_ID_SESSION QOF_ID_SESSION
98 #define GNC_ID_NULL QOF_ID_NULL
99 
100 #define GNC_ID_ACCOUNT "Account"
101 #define GNC_ID_COMMODITY "Commodity"
102 #define GNC_ID_COMMODITY_NAMESPACE "CommodityNamespace"
103 #define GNC_ID_COMMODITY_TABLE "CommodityTable"
104 #define GNC_ID_LOT "Lot"
105 #define GNC_ID_PERIOD "Period"
106 #define GNC_ID_PRICE "Price"
107 #define GNC_ID_PRICEDB "PriceDB"
108 #define GNC_ID_SPLIT "Split"
109 #define GNC_ID_BUDGET "Budget"
110 #define GNC_ID_SCHEDXACTION "SchedXaction"
111 #define GNC_ID_SXES "SchedXactions"
112 #define GNC_ID_SXTG "SXTGroup"
113 #define GNC_ID_SXTT "SXTTrans"
114 #define GNC_ID_TRANS "Trans"
115 
116 /* TYPES **********************************************************/
117 
118 /* CAS: ISTM, it would make more sense to put the typedefs in their
119  corresponding header files, (e.g. Account.h), and to #include all
120  the engine API header files right here. After all, when I jump to
121  the definition "Account", I want to end up in Account.h, not this
122  file, like I do now.
123 
124  Also, as it is now, if I want to use the engine api, I need to
125  include this header, plus all the other engine headers for the
126  types whose functions I call, so this header is providing almost no
127  benefit of aggregation. But, if it included all the headers I
128  could just include this file. Or would that cause a massive
129  recompile every time one engine header changed?
130  Even if including all the headers here doesn't make sense, I think
131  distributing the stuff in the "Types" section does.
132 */
133 
134 
140 typedef struct account_s Account;
141 
152 typedef struct split_s Split;
153 
163 typedef struct transaction_s Transaction;
164 
179 typedef struct gnc_commodity_s gnc_commodity;
180 
182 typedef struct gnc_commodity_namespace_s gnc_commodity_namespace;
183 
185 typedef struct gnc_commodity_table_s gnc_commodity_table;
186 
196 typedef struct gnc_lot_s GNCLot;
197 
203 typedef struct gnc_price_s GNCPrice;
204 typedef struct gnc_quote_source_s gnc_quote_source;
205 
207 typedef GList AccountList;
209 typedef GList LotList;
211 typedef GList SplitList;
213 typedef GList TransList;
215 typedef GList AccountGUIDList;
217 typedef GList BookGUIDList;
218 
219 typedef void (*EngineCommitErrorCallback)( gpointer data, QofBackendError errcode );
220 
221 typedef gint (*SplitCallback)(Split *s, gpointer data);
222 typedef gint (*TransactionCallback)(Transaction *t, void *data);
223 
225 typedef void (* gnc_engine_init_hook_t)(int, char **);
226 
227 
232 void gnc_engine_init(int argc, char ** argv);
233 
237 void gnc_engine_init_static(int argc, char ** argv);
238 
240 void gnc_engine_shutdown (void);
241 
243 gboolean gnc_engine_is_initialized(void);
244 
246 void gnc_log_default(void);
247 
251 
254 void gnc_engine_add_commit_error_callback( EngineCommitErrorCallback cb, gpointer data );
255 
256 void gnc_engine_signal_commit_error( QofBackendError errcode );
257 
261 #define GNC_INVOICE_ID "gncInvoice"
262 #define GNC_INVOICE_GUID "invoice-guid"
263 #define GNC_OWNER_ID "gncOwner"
264 #define GNC_OWNER_TYPE "owner-type"
265 #define GNC_OWNER_GUID "owner-guid"
266 #define GNC_SX_ID "sched-xaction"
267 
268 #ifdef __cplusplus
269 } /* extern "C" */
270 #endif
271 
272 #endif
273 
GList BookGUIDList
GList of GUIDs of a QofBook.
Definition: gnc-engine.h:217
GList TransList
GList of Transaction.
Definition: gnc-engine.h:213
A gnc_commodity_table is a database of commodity info.
GList LotList
GList of GNCLots.
Definition: gnc-engine.h:209
QofBackendError
The errors that can be reported to the GUI & other front-end users.
Definition: qofbackend.h:57
void gnc_engine_shutdown(void)
Called to shutdown the engine.
Definition: gnc-engine.c:141
Identifies that something sold at one time was bought at another.
Definition: gnc-lot.c:60
gboolean gnc_engine_is_initialized(void)
check the engine is fully initialized
Definition: gnc-engine.c:160
void gnc_engine_add_commit_error_callback(EngineCommitErrorCallback cb, gpointer data)
Set a callback function to be called in case an engine commit fails.
Definition: gnc-engine.c:166
A gnc_commodity_namespace is an collection of commodities.
void(* gnc_engine_init_hook_t)(int, char **)
Function type for init hooks in the engine.
Definition: gnc-engine.h:225
STRUCTS.
Definition: TransactionP.h:74
void gnc_engine_init_static(int argc, char **argv)
This is the statically linked-in version of gnc_engine_init.
Definition: gnc-engine.c:126
GList SplitList
GList of Split.
Definition: gnc-engine.h:211
void gnc_log_default(void)
enable default log modules
Price of commodity on a given date.
Definition: gnc-pricedb-p.h:33
void gnc_engine_init(int argc, char **argv)
PROTOTYPES.
Definition: gnc-engine.c:116
void gnc_engine_add_init_hook(gnc_engine_init_hook_t hook)
Pass a function pointer to gnc_engine_add_init_hook and it will be called during the evaluation of gn...
Definition: gnc-engine.c:154
Account in Gnucash.
Definition: AccountP.h:149
GList AccountList
GList of Account.
Definition: gnc-engine.h:207
Split in Gnucash.
Definition: SplitP.h:71
GList AccountGUIDList
GList of GUIDs of a Account.
Definition: gnc-engine.h:215
An article that is bought and sold.
Definition: gnc-commodity.c:64