GnuCash c935c2f+
Loading...
Searching...
No Matches
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
44extern "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"
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
136typedef struct account_s Account;
137
148typedef struct split_s Split;
149
159typedef struct transaction_s Transaction;
160
175typedef struct gnc_commodity_s gnc_commodity;
176
178typedef struct gnc_commodity_namespace_s gnc_commodity_namespace;
179
181typedef struct gnc_commodity_table_s gnc_commodity_table;
182
192typedef struct gnc_lot_s GNCLot;
193
199typedef struct gnc_price_s GNCPrice;
200typedef struct gnc_quote_source_s gnc_quote_source;
201
203typedef GList AccountList;
205typedef GList LotList;
207typedef GList SplitList;
209typedef GList TransList;
211typedef GList AccountGUIDList;
213typedef GList BookGUIDList;
214
215typedef void (*EngineCommitErrorCallback)( gpointer data, QofBackendError errcode );
216
217typedef gint (*SplitCallback)(Split *s, gpointer data);
218typedef gint (*TransactionCallback)(Transaction *t, void *data);
219
221typedef void (* gnc_engine_init_hook_t)(int, char **);
222
223
228void gnc_engine_init(int argc, char ** argv);
229
233void gnc_engine_init_static(int argc, char ** argv);
234
236void gnc_engine_shutdown (void);
237
239gboolean gnc_engine_is_initialized(void);
240
243
247
250void gnc_engine_add_commit_error_callback( EngineCommitErrorCallback cb, gpointer data );
251
252void 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
QofBackendError
The errors that can be reported to the GUI & other front-end users.
Definition qofbackend.h:58
void gnc_engine_add_commit_error_callback(EngineCommitErrorCallback cb, gpointer data)
Set a callback function to be called in case an engine commit fails.
GList LotList
GList of GNCLots.
Definition gnc-engine.h:205
void gnc_engine_init(int argc, char **argv)
PROTOTYPES.
void(* gnc_engine_init_hook_t)(int, char **)
Function type for init hooks in the engine.
Definition gnc-engine.h:221
void gnc_log_default(void)
enable default log modules
void gnc_engine_init_static(int argc, char **argv)
This is the statically linked-in version of gnc_engine_init.
GList TransList
GList of Transaction.
Definition gnc-engine.h:209
GList AccountList
GList of Account.
Definition gnc-engine.h:203
GList AccountGUIDList
GList of GUIDs of a Account.
Definition gnc-engine.h:211
GList BookGUIDList
GList of GUIDs of a QofBook.
Definition gnc-engine.h:213
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...
gboolean gnc_engine_is_initialized(void)
check the engine is fully initialized
void gnc_engine_shutdown(void)
Called to shutdown the engine.
GList SplitList
GList of Split.
Definition gnc-engine.h:207
STRUCTS.
Account in Gnucash.
Definition AccountP.hpp:142
A gnc_commodity_namespace is an collection of commodities.
An article that is bought and sold.
A gnc_commodity_table is a database of commodity info.
Identifies that something sold at one time was bought at another.
Definition gnc-lot.cpp:61
Price of commodity on a given date.
Split in Gnucash.
Definition SplitP.hpp:72