GnuCash  4.901
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 #include <glib.h>
40 
41 #include "qof.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
48 // @{
49 #define GNC_MOD_ROOT "gnc"
50 #define GNC_MOD_ENGINE "gnc.engine"
51 #define GNC_MOD_ACCOUNT "gnc.account"
52 #define GNC_MOD_SX "gnc.engine.sx"
53 #define GNC_MOD_QUERY "gnc.query"
54 #define GNC_MOD_SCRUB "gnc.scrub"
55 #define GNC_MOD_LOT "gnc.lots"
56 #define GNC_MOD_COMMODITY "gnc.commodity"
57 #define GNC_MOD_BACKEND "gnc.backend"
58 #define GNC_MOD_PRICE "gnc.pricedb"
59 #define GNC_MOD_BUSINESS "gnc.business"
60 #define GNC_MOD_IO "gnc.io"
61 #define GNC_MOD_BOOK "gnc.book-period"
62 #define GNC_MOD_GUI "gnc.gui"
63 #define GNC_MOD_GUI_SX "gnc.gui.sx"
64 #define GNC_MOD_GUILE "gnc.guile"
65 #define GNC_MOD_LEDGER "gnc.ledger"
66 #define GNC_MOD_REGISTER "gnc.register"
67 #define GNC_MOD_HTML "gnc.html"
68 #define GNC_MOD_PREFS "gnc.pref"
69 #define GNC_MOD_IMPORT "gnc.import"
70 #define GNC_MOD_ASSISTANT "gnc.assistant"
71 #define GNC_MOD_BUDGET "gnc.budget"
72 
73 
91 #define GNC_ID_NONE QOF_ID_NONE
92 #define GNC_ID_BOOK QOF_ID_BOOK
93 #define GNC_ID_SESSION QOF_ID_SESSION
94 #define GNC_ID_NULL QOF_ID_NULL
95 
96 #define GNC_ID_ACCOUNT "Account"
97 #define GNC_ID_COMMODITY "Commodity"
98 #define GNC_ID_COMMODITY_NAMESPACE "CommodityNamespace"
99 #define GNC_ID_COMMODITY_TABLE "CommodityTable"
100 #define GNC_ID_LOT "Lot"
101 #define GNC_ID_PERIOD "Period"
102 #define GNC_ID_PRICE "Price"
103 #define GNC_ID_PRICEDB "PriceDB"
104 #define GNC_ID_SPLIT "Split"
105 #define GNC_ID_BUDGET "Budget"
106 #define GNC_ID_SCHEDXACTION "SchedXaction"
107 #define GNC_ID_SXES "SchedXactions"
108 #define GNC_ID_SXTG "SXTGroup"
109 #define GNC_ID_SXTT "SXTTrans"
110 #define GNC_ID_TRANS "Trans"
111 
112 /* TYPES **********************************************************/
113 
114 /* CAS: ISTM, it would make more sense to put the typedefs in their
115  corresponding header files, (e.g. Account.h), and to #include all
116  the engine API header files right here. After all, when I jump to
117  the definition "Account", I want to end up in Account.h, not this
118  file, like I do now.
119 
120  Also, as it is now, if I want to use the engine api, I need to
121  include this header, plus all the other engine headers for the
122  types whose functions I call, so this header is providing almost no
123  benefit of aggregation. But, if it included all the headers I
124  could just include this file. Or would that cause a massive
125  recompile every time one engine header changed?
126  Even if including all the headers here doesn't make sense, I think
127  distributing the stuff in the "Types" section does.
128 */
129 
130 
136 typedef struct account_s Account;
137 
148 typedef struct split_s Split;
149 
159 typedef struct transaction_s Transaction;
160 
175 typedef struct gnc_commodity_s gnc_commodity;
176 
178 typedef struct gnc_commodity_namespace_s gnc_commodity_namespace;
179 
181 typedef struct gnc_commodity_table_s gnc_commodity_table;
182 
192 typedef struct gnc_lot_s GNCLot;
193 
199 typedef struct gnc_price_s GNCPrice;
200 typedef struct gnc_quote_source_s gnc_quote_source;
201 
203 typedef GList AccountList;
205 typedef GList LotList;
207 typedef GList SplitList;
209 typedef GList TransList;
211 typedef GList AccountGUIDList;
213 typedef GList BookGUIDList;
214 
215 typedef void (*EngineCommitErrorCallback)( gpointer data, QofBackendError errcode );
216 
217 typedef gint (*SplitCallback)(Split *s, gpointer data);
218 typedef gint (*TransactionCallback)(Transaction *t, void *data);
219 
221 typedef void (* gnc_engine_init_hook_t)(int, char **);
222 
223 
228 void gnc_engine_init(int argc, char ** argv);
229 
233 void gnc_engine_init_static(int argc, char ** argv);
234 
236 void gnc_engine_shutdown (void);
237 
239 gboolean gnc_engine_is_initialized(void);
240 
242 void gnc_log_default(void);
243 
247 
250 void gnc_engine_add_commit_error_callback( EngineCommitErrorCallback cb, gpointer data );
251 
252 void gnc_engine_signal_commit_error( QofBackendError errcode );
253 
257 #define GNC_INVOICE_ID "gncInvoice"
258 #define GNC_INVOICE_GUID "invoice-guid"
259 #define GNC_OWNER_ID "gncOwner"
260 #define GNC_OWNER_TYPE "owner-type"
261 #define GNC_OWNER_GUID "owner-guid"
262 #define GNC_SX_ID "sched-xaction"
263 
264 #ifdef __cplusplus
265 } /* extern "C" */
266 #endif
267 
268 #endif
269 
GList BookGUIDList
GList of GUIDs of a QofBook.
Definition: gnc-engine.h:213
GList TransList
GList of Transaction.
Definition: gnc-engine.h:209
A gnc_commodity_table is a database of commodity info.
GList LotList
GList of GNCLots.
Definition: gnc-engine.h:205
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:221
STRUCTS.
Definition: TransactionP.h:78
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:207
void gnc_log_default(void)
enable default log modules
Price of commodity on a given date.
Definition: gnc-pricedb-p.h:37
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:155
GList AccountList
GList of Account.
Definition: gnc-engine.h:203
Split in Gnucash.
Definition: SplitP.h:75
GList AccountGUIDList
GList of GUIDs of a Account.
Definition: gnc-engine.h:211
An article that is bought and sold.
Definition: gnc-commodity.c:66