mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
rename the entity functions from xaccEntity to qof_entity
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8749 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
35163676f1
commit
88c88039dc
@ -31,7 +31,6 @@
|
|||||||
#include "AccountP.h"
|
#include "AccountP.h"
|
||||||
#include "Backend.h"
|
#include "Backend.h"
|
||||||
#include "BackendP.h"
|
#include "BackendP.h"
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "GroupP.h"
|
#include "GroupP.h"
|
||||||
#include "TransactionP.h"
|
#include "TransactionP.h"
|
||||||
@ -48,6 +47,7 @@
|
|||||||
|
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
#include "qofbook-p.h"
|
#include "qofbook-p.h"
|
||||||
|
#include "qofid-p.h"
|
||||||
#include "qofobject.h"
|
#include "qofobject.h"
|
||||||
#include "qofqueryobject.h"
|
#include "qofqueryobject.h"
|
||||||
|
|
||||||
@ -127,8 +127,8 @@ xaccInitAccount (Account * acc, QofBook *book)
|
|||||||
|
|
||||||
acc->book = book;
|
acc->book = book;
|
||||||
|
|
||||||
xaccGUIDNew(&acc->guid, book);
|
qof_entity_guid_new (book->entity_table, &acc->guid);
|
||||||
xaccStoreEntity(book->entity_table, acc, &acc->guid, GNC_ID_ACCOUNT);
|
qof_entity_store(book->entity_table, acc, &acc->guid, GNC_ID_ACCOUNT);
|
||||||
LEAVE ("account=%p\n", acc);
|
LEAVE ("account=%p\n", acc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ xaccFreeAccount (Account *acc)
|
|||||||
|
|
||||||
gnc_engine_generate_event (&acc->guid, GNC_EVENT_DESTROY);
|
gnc_engine_generate_event (&acc->guid, GNC_EVENT_DESTROY);
|
||||||
|
|
||||||
xaccRemoveEntity (acc->book->entity_table, &acc->guid);
|
qof_entity_remove (acc->book->entity_table, &acc->guid);
|
||||||
|
|
||||||
if (acc->children)
|
if (acc->children)
|
||||||
{
|
{
|
||||||
@ -826,7 +826,7 @@ const GUID *
|
|||||||
xaccAccountGetGUID (Account *account)
|
xaccAccountGetGUID (Account *account)
|
||||||
{
|
{
|
||||||
if (!account)
|
if (!account)
|
||||||
return xaccGUIDNULL();
|
return guid_null();
|
||||||
|
|
||||||
return &account->guid;
|
return &account->guid;
|
||||||
}
|
}
|
||||||
@ -835,7 +835,7 @@ GUID
|
|||||||
xaccAccountReturnGUID (Account *account)
|
xaccAccountReturnGUID (Account *account)
|
||||||
{
|
{
|
||||||
if (!account)
|
if (!account)
|
||||||
return *xaccGUIDNULL();
|
return *guid_null();
|
||||||
|
|
||||||
return account->guid;
|
return account->guid;
|
||||||
}
|
}
|
||||||
@ -850,11 +850,11 @@ xaccAccountSetGUID (Account *account, const GUID *guid)
|
|||||||
|
|
||||||
PINFO("acct=%p", account);
|
PINFO("acct=%p", account);
|
||||||
xaccAccountBeginEdit (account);
|
xaccAccountBeginEdit (account);
|
||||||
xaccRemoveEntity (account->book->entity_table, &account->guid);
|
qof_entity_remove (account->book->entity_table, &account->guid);
|
||||||
|
|
||||||
account->guid = *guid;
|
account->guid = *guid;
|
||||||
|
|
||||||
xaccStoreEntity (account->book->entity_table, account,
|
qof_entity_store (account->book->entity_table, account,
|
||||||
&account->guid, GNC_ID_ACCOUNT);
|
&account->guid, GNC_ID_ACCOUNT);
|
||||||
account->core_dirty = TRUE;
|
account->core_dirty = TRUE;
|
||||||
xaccAccountCommitEdit (account);
|
xaccAccountCommitEdit (account);
|
||||||
@ -867,7 +867,7 @@ Account *
|
|||||||
xaccAccountLookup (const GUID *guid, QofBook *book)
|
xaccAccountLookup (const GUID *guid, QofBook *book)
|
||||||
{
|
{
|
||||||
if (!guid || !book) return NULL;
|
if (!guid || !book) return NULL;
|
||||||
return xaccLookupEntity (qof_book_get_entity_table (book),
|
return qof_entity_lookup (qof_book_get_entity_table (book),
|
||||||
guid, GNC_ID_ACCOUNT);
|
guid, GNC_ID_ACCOUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -875,7 +875,7 @@ Account *
|
|||||||
xaccAccountLookupDirect (GUID guid, QofBook *book)
|
xaccAccountLookupDirect (GUID guid, QofBook *book)
|
||||||
{
|
{
|
||||||
if (!book) return NULL;
|
if (!book) return NULL;
|
||||||
return xaccLookupEntity (qof_book_get_entity_table (book),
|
return qof_entity_lookup (qof_book_get_entity_table (book),
|
||||||
&guid, GNC_ID_ACCOUNT);
|
&guid, GNC_ID_ACCOUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3164,15 +3164,15 @@ xaccAccountGetBackend (Account * acc)
|
|||||||
/* gncObject function implementation and registration */
|
/* gncObject function implementation and registration */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
account_foreach (QofBook *book, foreachObjectCB cb, gpointer ud)
|
account_foreach (QofBook *book, QofEntityForeachCB cb, gpointer ud)
|
||||||
{
|
{
|
||||||
GNCEntityTable *et;
|
QofEntityTable *et;
|
||||||
|
|
||||||
g_return_if_fail (book);
|
g_return_if_fail (book);
|
||||||
g_return_if_fail (cb);
|
g_return_if_fail (cb);
|
||||||
|
|
||||||
et = qof_book_get_entity_table (book);
|
et = qof_book_get_entity_table (book);
|
||||||
xaccForeachEntity (et, GNC_ID_ACCOUNT, cb, ud);
|
qof_entity_foreach (et, GNC_ID_ACCOUNT, cb, ud);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QofObject account_object_def = {
|
static QofObject account_object_def = {
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
#ifndef XACC_ACCOUNT_H
|
#ifndef XACC_ACCOUNT_H
|
||||||
#define XACC_ACCOUNT_H
|
#define XACC_ACCOUNT_H
|
||||||
|
|
||||||
#include "GNCId.h"
|
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
|
#include "guid.h"
|
||||||
#include "kvp_frame.h"
|
#include "kvp_frame.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
|
||||||
|
@ -43,12 +43,12 @@
|
|||||||
|
|
||||||
#include "Account.h"
|
#include "Account.h"
|
||||||
#include "Backend.h"
|
#include "Backend.h"
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "gnc-commodity.h"
|
#include "gnc-commodity.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-numeric.h"
|
#include "gnc-numeric.h"
|
||||||
#include "kvp_frame.h"
|
#include "kvp_frame.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
#include "qofid.h"
|
||||||
|
|
||||||
|
|
||||||
/** STRUCTS *********************************************************/
|
/** STRUCTS *********************************************************/
|
||||||
|
@ -235,9 +235,9 @@ struct backend_s
|
|||||||
|
|
||||||
void (*load) (Backend *, QofBook *);
|
void (*load) (Backend *, QofBook *);
|
||||||
|
|
||||||
void (*begin) (Backend *, GNCIdTypeConst, gpointer);
|
void (*begin) (Backend *, QofIdTypeConst, gpointer);
|
||||||
void (*commit) (Backend *, GNCIdTypeConst, gpointer);
|
void (*commit) (Backend *, QofIdTypeConst, gpointer);
|
||||||
void (*rollback) (Backend *, GNCIdTypeConst, gpointer);
|
void (*rollback) (Backend *, QofIdTypeConst, gpointer);
|
||||||
|
|
||||||
gpointer (*compile_query) (Backend *, QofQuery *);
|
gpointer (*compile_query) (Backend *, QofQuery *);
|
||||||
void (*free_query) (Backend *, gpointer);
|
void (*free_query) (Backend *, gpointer);
|
||||||
|
@ -85,13 +85,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "FreqSpecP.h"
|
#include "FreqSpecP.h"
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "gnc-date.h"
|
#include "gnc-date.h"
|
||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
#include "gnc-event-p.h"
|
#include "gnc-event-p.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
#include "qofbook-p.h"
|
#include "qofbook-p.h"
|
||||||
|
#include "qofid-p.h"
|
||||||
|
|
||||||
/* I have done this to prevent compiler warnings...
|
/* I have done this to prevent compiler warnings...
|
||||||
* This is used to convert a const GDate* to a GDate* for passing
|
* This is used to convert a const GDate* to a GDate* for passing
|
||||||
@ -184,8 +184,8 @@ xaccFreqSpecInit( FreqSpec *fs, QofBook *book )
|
|||||||
|
|
||||||
fs->entity_table = qof_book_get_entity_table (book);
|
fs->entity_table = qof_book_get_entity_table (book);
|
||||||
|
|
||||||
xaccGUIDNew( &fs->guid, book );
|
qof_entity_guid_new (fs->entity_table, &fs->guid);
|
||||||
xaccStoreEntity( fs->entity_table, fs, &fs->guid, GNC_ID_FREQSPEC );
|
qof_entity_store( fs->entity_table, fs, &fs->guid, GNC_ID_FREQSPEC );
|
||||||
|
|
||||||
fs->type = INVALID;
|
fs->type = INVALID;
|
||||||
fs->uift = UIFREQ_ONCE;
|
fs->uift = UIFREQ_ONCE;
|
||||||
@ -234,7 +234,7 @@ xaccFreqSpecFree( FreqSpec *fs )
|
|||||||
{
|
{
|
||||||
if ( fs == NULL ) return;
|
if ( fs == NULL ) return;
|
||||||
gnc_engine_generate_event( &fs->guid, GNC_EVENT_DESTROY );
|
gnc_engine_generate_event( &fs->guid, GNC_EVENT_DESTROY );
|
||||||
xaccRemoveEntity( fs->entity_table, &fs->guid );
|
qof_entity_remove( fs->entity_table, &fs->guid );
|
||||||
|
|
||||||
xaccFreqSpecCleanUp( fs );
|
xaccFreqSpecCleanUp( fs );
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "GNCId.h"
|
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
|
#include "guid.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +34,7 @@ Currently the only files which include this file are:
|
|||||||
#define XACC_FREQSPECP_H
|
#define XACC_FREQSPECP_H
|
||||||
|
|
||||||
#include "FreqSpec.h"
|
#include "FreqSpec.h"
|
||||||
#include "GNCIdP.h"
|
#include "qofid.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scheduled transactions have a frequency defined by a frequency
|
* Scheduled transactions have a frequency defined by a frequency
|
||||||
@ -108,7 +108,7 @@ struct gncp_freq_spec {
|
|||||||
} composites;
|
} composites;
|
||||||
} s;
|
} s;
|
||||||
GUID guid;
|
GUID guid;
|
||||||
GNCEntityTable *entity_table;
|
QofEntityTable *entity_table;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* XACC_FREQSPECP_H */
|
#endif /* XACC_FREQSPECP_H */
|
||||||
|
@ -1,93 +1,38 @@
|
|||||||
/********************************************************************\
|
|
||||||
* GNCId.h -- Gnucash entity identifier API *
|
|
||||||
* Copyright (C) 2000 Dave Peticolas <peticola@cs.ucdavis.edu> *
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or *
|
|
||||||
* modify it under the terms of the GNU General Public License as *
|
|
||||||
* published by the Free Software Foundation; either version 2 of *
|
|
||||||
* the License, or (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* This program is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License*
|
|
||||||
* along with this program; if not, contact: *
|
|
||||||
* *
|
|
||||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
|
||||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
|
||||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
#ifndef GNC_ID_H
|
#include "qofid.h"
|
||||||
#define GNC_ID_H
|
|
||||||
|
|
||||||
/* This file defines an API for using gnucash entity identifiers.
|
|
||||||
*
|
|
||||||
* Identifiers can be used to reference Accounts, Transactions, and
|
|
||||||
* Splits. These four Gnucash types are referred to as Gnucash
|
|
||||||
* entities. Identifiers are globally-unique and permanent, i.e., once
|
|
||||||
* an entity has been assigned an identifier, it retains that same
|
|
||||||
* identifier for its lifetime.
|
|
||||||
*
|
|
||||||
* Identifiers can be encoded as hex strings. */
|
|
||||||
|
|
||||||
#include "guid.h"
|
|
||||||
|
|
||||||
/* Identifiers are 'typed' with strings. The ids used in gnucash are
|
|
||||||
* defined below. An id with type GNC_ID_NONE does not refer to any
|
|
||||||
* entity, although that may change as new ids are created. An id with
|
|
||||||
* type GNC_ID_NULL does not refer to any entity, and will never refer
|
|
||||||
* to any entity. An identifier with any other type may refer to an
|
|
||||||
* actual entity, but that is not guaranteed. If an id does refer to
|
|
||||||
* an entity, the type of the entity will match the type of the
|
|
||||||
* identifier. */
|
|
||||||
|
|
||||||
typedef const char * GNCIdType;
|
|
||||||
typedef const char * GNCIdTypeConst;
|
|
||||||
|
|
||||||
#define GNC_ID_NONE NULL
|
|
||||||
#define GNC_ID_ACCOUNT "Account"
|
|
||||||
#define GNC_ID_BOOK "Book"
|
|
||||||
#define GNC_ID_COMMODITY_TABLE "CommodityTable"
|
|
||||||
#define GNC_ID_FREQSPEC "FreqSpec"
|
|
||||||
#define GNC_ID_GROUP "AccountGroup"
|
|
||||||
#define GNC_ID_LOT "Lot"
|
|
||||||
#define GNC_ID_NULL "null"
|
|
||||||
#define GNC_ID_PERIOD "Period"
|
|
||||||
#define GNC_ID_PRICE "Price"
|
|
||||||
#define GNC_ID_PRICEDB "PriceDB"
|
|
||||||
#define GNC_ID_SPLIT "Split"
|
|
||||||
#define GNC_ID_SCHEDXACTION "SchedXaction"
|
|
||||||
#define GNC_ID_SESSION "Session"
|
|
||||||
#define GNC_ID_SXTT "SXTT"
|
|
||||||
#define GNC_ID_TRANS "Trans"
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct gnc_entity_table GNCEntityTable;
|
|
||||||
|
|
||||||
GNCIdType xaccGUIDTypeEntityTable (const GUID * guid,
|
|
||||||
GNCEntityTable *entity_table);
|
|
||||||
|
|
||||||
/* Return the type of an identifier.
|
/* Return the type of an identifier.
|
||||||
* Equivalent function prototype:
|
* Equivalent function prototype:
|
||||||
* GNCIdType xaccGUIDType (const GUID * guid, QofBook *book);
|
* QofIdType xaccGUIDType (const GUID * guid, QofBook *book);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define xaccGUIDType(guid,book) \
|
#define xaccGUIDType(guid,book) \
|
||||||
xaccGUIDTypeEntityTable ((guid), qof_book_get_entity_table (book))
|
qof_entity_type (qof_book_get_entity_table (book), (guid))
|
||||||
|
|
||||||
|
/* Equivalent function prototype:
|
||||||
|
* void xaccGUIDNew (GUID *guid, QofBook *book)
|
||||||
|
*/
|
||||||
|
#define xaccGUIDNew(guid,book) \
|
||||||
|
qof_entity_guid_new (qof_book_get_entity_table (book), (guid))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Returns a GUID which is guaranteed to never reference any entity. */
|
#define xaccGUIDNULL guid_null
|
||||||
const GUID * xaccGUIDNULL (void);
|
#define xaccGUIDMalloc guid_malloc
|
||||||
|
#define xaccGUIDFree guid_free
|
||||||
|
|
||||||
/* Efficiently allocate & free memory for GUIDs */
|
#define GNCIdTypeConst QofIdTypeConst
|
||||||
GUID * xaccGUIDMalloc (void);
|
#define GNCIdType QofIdType
|
||||||
void xaccGUIDFree (GUID *guid);
|
#define GNCEntityTable QofEntityTable
|
||||||
|
#define xaccGUIDTypeEntityTable qof_guid_type
|
||||||
|
|
||||||
/* Callback type for xaccForeachEntity */
|
#define xaccEntityTableNew qof_entity_new
|
||||||
typedef void (*foreachObjectCB) (gpointer object, gpointer user_data);
|
#define xaccEntityTableDestroy qof_entity_destroy
|
||||||
|
#define xaccGUIDNewEntityTable qof_entity_guid_new
|
||||||
|
#define xaccLookupEntity qof_entity_lookup
|
||||||
|
#define xaccStoreEntity qof_entity_store
|
||||||
|
#define xaccRemoveEntity qof_entity_remove
|
||||||
|
#define xaccForeachEntity qof_entity_foreach
|
||||||
|
|
||||||
|
#define foreachObjectCB QofEntityForeachCB
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "AccountP.h"
|
#include "AccountP.h"
|
||||||
#include "Backend.h"
|
#include "Backend.h"
|
||||||
#include "BackendP.h"
|
#include "BackendP.h"
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "GroupP.h"
|
#include "GroupP.h"
|
||||||
#include "TransactionP.h"
|
#include "TransactionP.h"
|
||||||
@ -40,6 +39,7 @@
|
|||||||
#include "gnc-numeric.h"
|
#include "gnc-numeric.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
#include "qofbook-p.h"
|
#include "qofbook-p.h"
|
||||||
|
#include "qofid-p.h"
|
||||||
#include "qofobject.h"
|
#include "qofobject.h"
|
||||||
|
|
||||||
static short module = MOD_ENGINE;
|
static short module = MOD_ENGINE;
|
||||||
@ -746,9 +746,9 @@ xaccGroupInsertAccount (AccountGroup *grp, Account *acc)
|
|||||||
PWARN ("reparenting accounts accross books is not correctly supported\n");
|
PWARN ("reparenting accounts accross books is not correctly supported\n");
|
||||||
|
|
||||||
gnc_engine_generate_event (&acc->guid, GNC_EVENT_DESTROY);
|
gnc_engine_generate_event (&acc->guid, GNC_EVENT_DESTROY);
|
||||||
xaccRemoveEntity (acc->book->entity_table, &acc->guid);
|
qof_entity_remove (acc->book->entity_table, &acc->guid);
|
||||||
|
|
||||||
xaccStoreEntity (grp->book->entity_table, acc, &acc->guid, GNC_ID_ACCOUNT);
|
qof_entity_store (grp->book->entity_table, acc, &acc->guid, GNC_ID_ACCOUNT);
|
||||||
gnc_engine_generate_event (&acc->guid, GNC_EVENT_CREATE);
|
gnc_engine_generate_event (&acc->guid, GNC_EVENT_CREATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "Account.h"
|
#include "Account.h"
|
||||||
#include "GNCId.h"
|
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
|
#include "guid.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,10 +39,10 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "BackendP.h"
|
#include "BackendP.h"
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "Transaction.h"
|
#include "Transaction.h"
|
||||||
#include "gnc-numeric.h"
|
#include "gnc-numeric.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
#include "qofid.h"
|
||||||
|
|
||||||
|
|
||||||
/** STRUCTS *********************************************************/
|
/** STRUCTS *********************************************************/
|
||||||
|
@ -12,7 +12,6 @@ libgncmod_engine_la_SOURCES = \
|
|||||||
Account.c \
|
Account.c \
|
||||||
Backend.c \
|
Backend.c \
|
||||||
FreqSpec.c \
|
FreqSpec.c \
|
||||||
GNCId.c \
|
|
||||||
Group.c \
|
Group.c \
|
||||||
Period.c \
|
Period.c \
|
||||||
Query.c \
|
Query.c \
|
||||||
@ -42,6 +41,7 @@ libgncmod_engine_la_SOURCES = \
|
|||||||
md5.c \
|
md5.c \
|
||||||
messages.c \
|
messages.c \
|
||||||
qofbook.c \
|
qofbook.c \
|
||||||
|
qofid.c \
|
||||||
qofquery.c \
|
qofquery.c \
|
||||||
qofquerycore.c \
|
qofquerycore.c \
|
||||||
qofqueryobject.c \
|
qofqueryobject.c \
|
||||||
@ -90,6 +90,7 @@ gncinclude_HEADERS = \
|
|||||||
kvp-util.h \
|
kvp-util.h \
|
||||||
messages.h \
|
messages.h \
|
||||||
qofbook.h \
|
qofbook.h \
|
||||||
|
qofid.h \
|
||||||
qofquery.h \
|
qofquery.h \
|
||||||
qofquerycore.h \
|
qofquerycore.h \
|
||||||
qofqueryobject.h \
|
qofqueryobject.h \
|
||||||
@ -99,7 +100,6 @@ noinst_HEADERS = \
|
|||||||
AccountP.h \
|
AccountP.h \
|
||||||
BackendP.h \
|
BackendP.h \
|
||||||
FreqSpecP.h \
|
FreqSpecP.h \
|
||||||
GNCIdP.h \
|
|
||||||
GroupP.h \
|
GroupP.h \
|
||||||
QueryP.h \
|
QueryP.h \
|
||||||
SchedXactionP.h \
|
SchedXactionP.h \
|
||||||
@ -117,6 +117,7 @@ noinst_HEADERS = \
|
|||||||
gw-engine.h \
|
gw-engine.h \
|
||||||
gw-kvp.h \
|
gw-kvp.h \
|
||||||
qofbook-p.h \
|
qofbook-p.h \
|
||||||
|
qofid-p.h \
|
||||||
qofquery-p.h \
|
qofquery-p.h \
|
||||||
qofquerycore-p.h \
|
qofquerycore-p.h \
|
||||||
qofqueryobject-p.h \
|
qofqueryobject-p.h \
|
||||||
|
@ -46,6 +46,7 @@ Open questions: how do we deal with the backends ???
|
|||||||
#include "TransactionP.h"
|
#include "TransactionP.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
#include "qofbook-p.h"
|
#include "qofbook-p.h"
|
||||||
|
#include "qofid-p.h"
|
||||||
|
|
||||||
/* This static indicates the debugging module that this .o belongs to. */
|
/* This static indicates the debugging module that this .o belongs to. */
|
||||||
static short module = MOD_BOOK;
|
static short module = MOD_BOOK;
|
||||||
@ -81,7 +82,7 @@ gnc_book_insert_trans_clobber (QofBook *book, Transaction *trans)
|
|||||||
xaccTransCommitEdit (trans);
|
xaccTransCommitEdit (trans);
|
||||||
|
|
||||||
/* fiddle the transaction into place in the new book */
|
/* fiddle the transaction into place in the new book */
|
||||||
xaccStoreEntity(book->entity_table, newtrans, &newtrans->guid, GNC_ID_TRANS);
|
qof_entity_store(book->entity_table, newtrans, &newtrans->guid, GNC_ID_TRANS);
|
||||||
newtrans->book = book;
|
newtrans->book = book;
|
||||||
|
|
||||||
xaccTransBeginEdit (newtrans);
|
xaccTransBeginEdit (newtrans);
|
||||||
@ -92,7 +93,7 @@ gnc_book_insert_trans_clobber (QofBook *book, Transaction *trans)
|
|||||||
|
|
||||||
/* move the split into the new book ... */
|
/* move the split into the new book ... */
|
||||||
s->book = book;
|
s->book = book;
|
||||||
xaccStoreEntity(book->entity_table, s, &s->guid, GNC_ID_SPLIT);
|
qof_entity_store(book->entity_table, s, &s->guid, GNC_ID_SPLIT);
|
||||||
|
|
||||||
/* find the twin account, and re-parent to that. */
|
/* find the twin account, and re-parent to that. */
|
||||||
twin = xaccAccountLookupTwin (s->acc, book);
|
twin = xaccAccountLookupTwin (s->acc, book);
|
||||||
@ -140,9 +141,9 @@ gnc_book_insert_trans (QofBook *book, Transaction *trans)
|
|||||||
/* Fiddle the transaction into place in the new book */
|
/* Fiddle the transaction into place in the new book */
|
||||||
xaccTransBeginEdit (trans);
|
xaccTransBeginEdit (trans);
|
||||||
|
|
||||||
xaccRemoveEntity (trans->book->entity_table, &trans->guid);
|
qof_entity_remove (trans->book->entity_table, &trans->guid);
|
||||||
trans->book = book;
|
trans->book = book;
|
||||||
xaccStoreEntity(book->entity_table, trans, &trans->guid, GNC_ID_TRANS);
|
qof_entity_store(book->entity_table, trans, &trans->guid, GNC_ID_TRANS);
|
||||||
|
|
||||||
for (node = trans->splits; node; node = node->next)
|
for (node = trans->splits; node; node = node->next)
|
||||||
{
|
{
|
||||||
@ -150,9 +151,9 @@ gnc_book_insert_trans (QofBook *book, Transaction *trans)
|
|||||||
Split *s = node->data;
|
Split *s = node->data;
|
||||||
|
|
||||||
/* move the split into the new book ... */
|
/* move the split into the new book ... */
|
||||||
xaccRemoveEntity (s->book->entity_table, &s->guid);
|
qof_entity_remove (s->book->entity_table, &s->guid);
|
||||||
s->book = book;
|
s->book = book;
|
||||||
xaccStoreEntity(book->entity_table, s, &s->guid, GNC_ID_SPLIT);
|
qof_entity_store(book->entity_table, s, &s->guid, GNC_ID_SPLIT);
|
||||||
|
|
||||||
/* find the twin account, and re-parent to that. */
|
/* find the twin account, and re-parent to that. */
|
||||||
twin = xaccAccountLookupTwin (s->acc, book);
|
twin = xaccAccountLookupTwin (s->acc, book);
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
#include "gnc-numeric.h"
|
#include "gnc-numeric.h"
|
||||||
#include "Account.h"
|
#include "Account.h"
|
||||||
#include "GNCId.h"
|
|
||||||
#include "Query.h"
|
#include "Query.h"
|
||||||
#include "Transaction.h"
|
#include "Transaction.h"
|
||||||
#include "TransactionP.h"
|
#include "TransactionP.h"
|
||||||
@ -476,7 +475,7 @@ xaccQueryAddClearedMatch(Query * q, cleared_match_t how, QofQueryOp op)
|
|||||||
|
|
||||||
void
|
void
|
||||||
xaccQueryAddGUIDMatch(Query * q, const GUID *guid,
|
xaccQueryAddGUIDMatch(Query * q, const GUID *guid,
|
||||||
GNCIdType id_type, QofQueryOp op)
|
QofIdType id_type, QofQueryOp op)
|
||||||
{
|
{
|
||||||
GSList *param_list = NULL;
|
GSList *param_list = NULL;
|
||||||
|
|
||||||
@ -513,7 +512,7 @@ xaccQueryAddGUIDMatchGL (QofQuery *q, GList *param_list,
|
|||||||
|
|
||||||
void
|
void
|
||||||
xaccQueryAddKVPMatch(QofQuery *q, GSList *path, const kvp_value *value,
|
xaccQueryAddKVPMatch(QofQuery *q, GSList *path, const kvp_value *value,
|
||||||
QofQueryCompare how, GNCIdType id_type,
|
QofQueryCompare how, QofIdType id_type,
|
||||||
QofQueryOp op)
|
QofQueryOp op)
|
||||||
{
|
{
|
||||||
GSList *param_list = NULL;
|
GSList *param_list = NULL;
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include "gnc-date.h"
|
#include "gnc-date.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "GNCId.h"
|
|
||||||
#include "guid.h"
|
#include "guid.h"
|
||||||
#include "kvp_frame.h"
|
#include "kvp_frame.h"
|
||||||
|
|
||||||
@ -202,13 +201,13 @@ typedef enum {
|
|||||||
|
|
||||||
void xaccQueryAddClearedMatch(Query * q, cleared_match_t how, QofQueryOp op);
|
void xaccQueryAddClearedMatch(Query * q, cleared_match_t how, QofQueryOp op);
|
||||||
void xaccQueryAddGUIDMatch(Query * q, const GUID *guid,
|
void xaccQueryAddGUIDMatch(Query * q, const GUID *guid,
|
||||||
GNCIdType id_type, QofQueryOp op);
|
QofIdType id_type, QofQueryOp op);
|
||||||
void xaccQueryAddGUIDMatchGL (QofQuery *q, GList *param_list,
|
void xaccQueryAddGUIDMatchGL (QofQuery *q, GList *param_list,
|
||||||
GUID guid, QofQueryOp op);
|
GUID guid, QofQueryOp op);
|
||||||
|
|
||||||
/* given kvp value is on right side of comparison */
|
/* given kvp value is on right side of comparison */
|
||||||
void xaccQueryAddKVPMatch(Query *q, GSList *path, const kvp_value *value,
|
void xaccQueryAddKVPMatch(Query *q, GSList *path, const kvp_value *value,
|
||||||
QofQueryCompare how, GNCIdType id_type,
|
QofQueryCompare how, QofIdType id_type,
|
||||||
QofQueryOp op);
|
QofQueryOp op);
|
||||||
|
|
||||||
void xaccQuerySetSortOrder(Query *q, GList *p1, GList *p2, GList *p3);
|
void xaccQuerySetSortOrder(Query *q, GList *p1, GList *p2, GList *p3);
|
||||||
|
@ -80,7 +80,7 @@ typedef struct {
|
|||||||
pr_type_t term_type;
|
pr_type_t term_type;
|
||||||
int sense;
|
int sense;
|
||||||
GUID guid;
|
GUID guid;
|
||||||
GNCIdType id_type;
|
QofIdType id_type;
|
||||||
} GUIDPredicateData;
|
} GUIDPredicateData;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "FreqSpec.h"
|
#include "FreqSpec.h"
|
||||||
#include "GNCId.h"
|
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "GroupP.h"
|
#include "GroupP.h"
|
||||||
#include "SX-book.h"
|
#include "SX-book.h"
|
||||||
@ -42,6 +41,7 @@
|
|||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
#include "qofbook-p.h"
|
#include "qofbook-p.h"
|
||||||
|
#include "qofid-p.h"
|
||||||
|
|
||||||
static short module = MOD_SX;
|
static short module = MOD_SX;
|
||||||
|
|
||||||
@ -59,8 +59,8 @@ xaccSchedXactionInit( SchedXaction *sx, QofBook *book)
|
|||||||
|
|
||||||
sx->freq = xaccFreqSpecMalloc(book);
|
sx->freq = xaccFreqSpecMalloc(book);
|
||||||
|
|
||||||
xaccGUIDNew( &sx->guid, book );
|
qof_entity_guid_new (sx->entity_table, &sx->guid);
|
||||||
xaccStoreEntity( sx->entity_table, sx,
|
qof_entity_store( sx->entity_table, sx,
|
||||||
&sx->guid, GNC_ID_SCHEDXACTION );
|
&sx->guid, GNC_ID_SCHEDXACTION );
|
||||||
g_date_clear( &sx->last_date, 1 );
|
g_date_clear( &sx->last_date, 1 );
|
||||||
g_date_clear( &sx->start_date, 1 );
|
g_date_clear( &sx->start_date, 1 );
|
||||||
@ -154,7 +154,7 @@ xaccSchedXactionFree( SchedXaction *sx )
|
|||||||
|
|
||||||
xaccFreqSpecFree( sx->freq );
|
xaccFreqSpecFree( sx->freq );
|
||||||
gnc_engine_generate_event( &sx->guid, GNC_EVENT_DESTROY );
|
gnc_engine_generate_event( &sx->guid, GNC_EVENT_DESTROY );
|
||||||
xaccRemoveEntity( sx->entity_table, &sx->guid );
|
qof_entity_remove( sx->entity_table, &sx->guid );
|
||||||
|
|
||||||
if ( sx->name )
|
if ( sx->name )
|
||||||
g_free( sx->name );
|
g_free( sx->name );
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "GNCId.h"
|
|
||||||
#include "FreqSpec.h"
|
#include "FreqSpec.h"
|
||||||
#include "gnc-date.h"
|
#include "gnc-date.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
|
#include "guid.h"
|
||||||
#include "kvp_frame.h"
|
#include "kvp_frame.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
#ifndef XACC_SCHEDXACTION_P_H
|
#ifndef XACC_SCHEDXACTION_P_H
|
||||||
#define XACC_SCHEDXACTION_P_H
|
#define XACC_SCHEDXACTION_P_H
|
||||||
|
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "SchedXaction.h"
|
#include "SchedXaction.h"
|
||||||
|
#include "qofid.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A single scheduled transaction.
|
* A single scheduled transaction.
|
||||||
@ -75,7 +75,7 @@ struct gncp_SchedXaction
|
|||||||
|
|
||||||
Account *template_acct;
|
Account *template_acct;
|
||||||
GUID guid;
|
GUID guid;
|
||||||
GNCEntityTable *entity_table;
|
QofEntityTable *entity_table;
|
||||||
|
|
||||||
/** The list of deferred SX instances. This list is of temporalStateData
|
/** The list of deferred SX instances. This list is of temporalStateData
|
||||||
* instances. */
|
* instances. */
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include "AccountP.h"
|
#include "AccountP.h"
|
||||||
#include "Backend.h"
|
#include "Backend.h"
|
||||||
#include "BackendP.h"
|
#include "BackendP.h"
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "TransactionP.h"
|
#include "TransactionP.h"
|
||||||
#include "TransLog.h"
|
#include "TransLog.h"
|
||||||
@ -49,6 +48,7 @@
|
|||||||
|
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
#include "qofbook-p.h"
|
#include "qofbook-p.h"
|
||||||
|
#include "qofid-p.h"
|
||||||
#include "qofobject.h"
|
#include "qofobject.h"
|
||||||
#include "qofqueryobject.h"
|
#include "qofqueryobject.h"
|
||||||
|
|
||||||
@ -132,8 +132,8 @@ xaccInitSplit(Split * split, QofBook *book)
|
|||||||
|
|
||||||
split->book = book;
|
split->book = book;
|
||||||
|
|
||||||
xaccGUIDNew (&split->guid, book);
|
qof_entity_guid_new (book->entity_table, &split->guid);
|
||||||
xaccStoreEntity(book->entity_table, split, &split->guid, GNC_ID_SPLIT);
|
qof_entity_store(book->entity_table, split, &split->guid, GNC_ID_SPLIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
@ -213,8 +213,8 @@ xaccSplitClone (Split *s)
|
|||||||
split->reconciled_balance = s->reconciled_balance;
|
split->reconciled_balance = s->reconciled_balance;
|
||||||
split->idata = 0;
|
split->idata = 0;
|
||||||
|
|
||||||
xaccGUIDNew(&split->guid, s->book);
|
qof_entity_guid_new(s->book->entity_table, &split->guid);
|
||||||
xaccStoreEntity(s->book->entity_table, split, &split->guid, GNC_ID_SPLIT);
|
qof_entity_store(s->book->entity_table, split, &split->guid, GNC_ID_SPLIT);
|
||||||
|
|
||||||
xaccAccountInsertSplit(s->acc, split);
|
xaccAccountInsertSplit(s->acc, split);
|
||||||
if (s->lot) {
|
if (s->lot) {
|
||||||
@ -439,14 +439,14 @@ xaccSplitGetAccount (const Split *s)
|
|||||||
const GUID *
|
const GUID *
|
||||||
xaccSplitGetGUID (const Split *split)
|
xaccSplitGetGUID (const Split *split)
|
||||||
{
|
{
|
||||||
if (!split) return xaccGUIDNULL();
|
if (!split) return guid_null();
|
||||||
return &split->guid;
|
return &split->guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUID
|
GUID
|
||||||
xaccSplitReturnGUID (const Split *split)
|
xaccSplitReturnGUID (const Split *split)
|
||||||
{
|
{
|
||||||
if (!split) return *xaccGUIDNULL();
|
if (!split) return *guid_null();
|
||||||
return split->guid;
|
return split->guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,9 +458,9 @@ xaccSplitSetGUID (Split *split, const GUID *guid)
|
|||||||
{
|
{
|
||||||
if (!split || !guid) return;
|
if (!split || !guid) return;
|
||||||
check_open (split->parent);
|
check_open (split->parent);
|
||||||
xaccRemoveEntity(split->book->entity_table, &split->guid);
|
qof_entity_remove(split->book->entity_table, &split->guid);
|
||||||
split->guid = *guid;
|
split->guid = *guid;
|
||||||
xaccStoreEntity(split->book->entity_table, split,
|
qof_entity_store(split->book->entity_table, split,
|
||||||
&split->guid, GNC_ID_SPLIT);
|
&split->guid, GNC_ID_SPLIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ Split *
|
|||||||
xaccSplitLookup (const GUID *guid, QofBook *book)
|
xaccSplitLookup (const GUID *guid, QofBook *book)
|
||||||
{
|
{
|
||||||
if (!guid || !book) return NULL;
|
if (!guid || !book) return NULL;
|
||||||
return xaccLookupEntity(qof_book_get_entity_table (book),
|
return qof_entity_lookup(qof_book_get_entity_table (book),
|
||||||
guid, GNC_ID_SPLIT);
|
guid, GNC_ID_SPLIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,7 +479,7 @@ Split *
|
|||||||
xaccSplitLookupDirect (GUID guid, QofBook *book)
|
xaccSplitLookupDirect (GUID guid, QofBook *book)
|
||||||
{
|
{
|
||||||
if (!book) return NULL;
|
if (!book) return NULL;
|
||||||
return xaccLookupEntity(qof_book_get_entity_table (book),
|
return qof_entity_lookup(qof_book_get_entity_table (book),
|
||||||
&guid, GNC_ID_SPLIT);
|
&guid, GNC_ID_SPLIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -839,8 +839,8 @@ xaccInitTransaction (Transaction * trans, QofBook *book)
|
|||||||
|
|
||||||
trans->book = book;
|
trans->book = book;
|
||||||
|
|
||||||
xaccGUIDNew (&trans->guid, book);
|
qof_entity_guid_new (book->entity_table, &trans->guid);
|
||||||
xaccStoreEntity (book->entity_table, trans, &trans->guid, GNC_ID_TRANS);
|
qof_entity_store (book->entity_table, trans, &trans->guid, GNC_ID_TRANS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
@ -1005,8 +1005,8 @@ xaccTransClone (Transaction *t)
|
|||||||
trans->orig = NULL;
|
trans->orig = NULL;
|
||||||
trans->idata = 0;
|
trans->idata = 0;
|
||||||
|
|
||||||
xaccGUIDNew (&trans->guid, t->book);
|
qof_entity_guid_new (t->book->entity_table, &trans->guid);
|
||||||
xaccStoreEntity (t->book->entity_table, trans, &trans->guid, GNC_ID_TRANS);
|
qof_entity_store (t->book->entity_table, trans, &trans->guid, GNC_ID_TRANS);
|
||||||
|
|
||||||
xaccTransBeginEdit(trans);
|
xaccTransBeginEdit(trans);
|
||||||
for (node = t->splits; node; node = node->next)
|
for (node = t->splits; node; node = node->next)
|
||||||
@ -1269,14 +1269,14 @@ xaccTransSetSlots_nc (Transaction *t, kvp_frame *frm)
|
|||||||
const GUID *
|
const GUID *
|
||||||
xaccTransGetGUID (const Transaction *trans)
|
xaccTransGetGUID (const Transaction *trans)
|
||||||
{
|
{
|
||||||
if (!trans) return xaccGUIDNULL();
|
if (!trans) return guid_null();
|
||||||
return &trans->guid;
|
return &trans->guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUID
|
GUID
|
||||||
xaccTransReturnGUID (const Transaction *trans)
|
xaccTransReturnGUID (const Transaction *trans)
|
||||||
{
|
{
|
||||||
if (!trans) return *xaccGUIDNULL();
|
if (!trans) return *guid_null();
|
||||||
return trans->guid;
|
return trans->guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1287,9 +1287,9 @@ void
|
|||||||
xaccTransSetGUID (Transaction *trans, const GUID *guid)
|
xaccTransSetGUID (Transaction *trans, const GUID *guid)
|
||||||
{
|
{
|
||||||
if (!trans || !guid) return;
|
if (!trans || !guid) return;
|
||||||
xaccRemoveEntity(trans->book->entity_table, &trans->guid);
|
qof_entity_remove(trans->book->entity_table, &trans->guid);
|
||||||
trans->guid = *guid;
|
trans->guid = *guid;
|
||||||
xaccStoreEntity(trans->book->entity_table, trans,
|
qof_entity_store(trans->book->entity_table, trans,
|
||||||
&trans->guid, GNC_ID_TRANS);
|
&trans->guid, GNC_ID_TRANS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1301,7 +1301,7 @@ Transaction *
|
|||||||
xaccTransLookup (const GUID *guid, QofBook *book)
|
xaccTransLookup (const GUID *guid, QofBook *book)
|
||||||
{
|
{
|
||||||
if (!guid || !book) return NULL;
|
if (!guid || !book) return NULL;
|
||||||
return xaccLookupEntity (qof_book_get_entity_table (book),
|
return qof_entity_lookup (qof_book_get_entity_table (book),
|
||||||
guid, GNC_ID_TRANS);
|
guid, GNC_ID_TRANS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1309,7 +1309,7 @@ Transaction *
|
|||||||
xaccTransLookupDirect (GUID guid, QofBook *book)
|
xaccTransLookupDirect (GUID guid, QofBook *book)
|
||||||
{
|
{
|
||||||
if (!book) return NULL;
|
if (!book) return NULL;
|
||||||
return xaccLookupEntity (qof_book_get_entity_table (book),
|
return qof_entity_lookup (qof_book_get_entity_table (book),
|
||||||
&guid, GNC_ID_TRANS);
|
&guid, GNC_ID_TRANS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1867,7 +1867,7 @@ xaccTransCommitEdit (Transaction *trans)
|
|||||||
PINFO ("delete trans at addr=%p", trans);
|
PINFO ("delete trans at addr=%p", trans);
|
||||||
/* Make a log in the journal before destruction. */
|
/* Make a log in the journal before destruction. */
|
||||||
xaccTransWriteLog (trans, 'D');
|
xaccTransWriteLog (trans, 'D');
|
||||||
xaccRemoveEntity(trans->book->entity_table, &trans->guid);
|
qof_entity_remove(trans->book->entity_table, &trans->guid);
|
||||||
xaccFreeTransaction (trans);
|
xaccFreeTransaction (trans);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1920,7 +1920,7 @@ xaccTransRollbackEdit (Transaction *trans)
|
|||||||
|
|
||||||
/* If the transaction had been deleted before the rollback,
|
/* If the transaction had been deleted before the rollback,
|
||||||
* the guid would have been unlisted. Restore that */
|
* the guid would have been unlisted. Restore that */
|
||||||
xaccStoreEntity(trans->book->entity_table, trans,
|
qof_entity_store(trans->book->entity_table, trans,
|
||||||
&trans->guid, GNC_ID_TRANS);
|
&trans->guid, GNC_ID_TRANS);
|
||||||
|
|
||||||
trans->common_currency = orig->common_currency;
|
trans->common_currency = orig->common_currency;
|
||||||
@ -2046,7 +2046,7 @@ xaccTransRollbackEdit (Transaction *trans)
|
|||||||
xaccAccountRemoveSplit (acc, s);
|
xaccAccountRemoveSplit (acc, s);
|
||||||
xaccAccountRecomputeBalance (acc);
|
xaccAccountRecomputeBalance (acc);
|
||||||
gen_event (s);
|
gen_event (s);
|
||||||
xaccRemoveEntity(s->book->entity_table, &s->guid);
|
qof_entity_remove(s->book->entity_table, &s->guid);
|
||||||
xaccFreeSplit (s);
|
xaccFreeSplit (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2064,7 +2064,7 @@ xaccTransRollbackEdit (Transaction *trans)
|
|||||||
|
|
||||||
s->parent = trans;
|
s->parent = trans;
|
||||||
s->acc = NULL;
|
s->acc = NULL;
|
||||||
xaccStoreEntity(s->book->entity_table, s, &s->guid, GNC_ID_SPLIT);
|
qof_entity_store(s->book->entity_table, s, &s->guid, GNC_ID_SPLIT);
|
||||||
xaccAccountInsertSplit (account, s);
|
xaccAccountInsertSplit (account, s);
|
||||||
mark_split (s);
|
mark_split (s);
|
||||||
xaccAccountRecomputeBalance (account);
|
xaccAccountRecomputeBalance (account);
|
||||||
@ -2191,7 +2191,7 @@ xaccTransDestroy (Transaction *trans)
|
|||||||
xaccAccountRemoveSplit (split->acc, split);
|
xaccAccountRemoveSplit (split->acc, split);
|
||||||
xaccAccountRecomputeBalance (split->acc);
|
xaccAccountRecomputeBalance (split->acc);
|
||||||
gen_event (split);
|
gen_event (split);
|
||||||
xaccRemoveEntity(split->book->entity_table, &split->guid);
|
qof_entity_remove(split->book->entity_table, &split->guid);
|
||||||
xaccFreeSplit (split);
|
xaccFreeSplit (split);
|
||||||
|
|
||||||
node->data = NULL;
|
node->data = NULL;
|
||||||
@ -2200,7 +2200,7 @@ xaccTransDestroy (Transaction *trans)
|
|||||||
g_list_free (trans->splits);
|
g_list_free (trans->splits);
|
||||||
trans->splits = NULL;
|
trans->splits = NULL;
|
||||||
|
|
||||||
xaccRemoveEntity(trans->book->entity_table, &trans->guid);
|
qof_entity_remove(trans->book->entity_table, &trans->guid);
|
||||||
|
|
||||||
/* the actual free is done with the commit call, else its rolled back */
|
/* the actual free is done with the commit call, else its rolled back */
|
||||||
/* xaccFreeTransaction (trans); don't do this here ... */
|
/* xaccFreeTransaction (trans); don't do this here ... */
|
||||||
@ -2257,7 +2257,7 @@ xaccSplitDestroy (Split *split)
|
|||||||
xaccAccountRecomputeBalance (acc);
|
xaccAccountRecomputeBalance (acc);
|
||||||
|
|
||||||
gen_event (split);
|
gen_event (split);
|
||||||
xaccRemoveEntity (split->book->entity_table, &split->guid);
|
qof_entity_remove (split->book->entity_table, &split->guid);
|
||||||
xaccFreeSplit (split);
|
xaccFreeSplit (split);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -3542,19 +3542,19 @@ xaccTransactionGetBackend (Transaction *trans)
|
|||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
/* gncObject function implementation */
|
/* gncObject function implementation */
|
||||||
static void
|
static void
|
||||||
do_foreach (QofBook *book, GNCIdType type, foreachObjectCB cb, gpointer ud)
|
do_foreach (QofBook *book, QofIdType type, QofEntityForeachCB cb, gpointer ud)
|
||||||
{
|
{
|
||||||
GNCEntityTable *et;
|
QofEntityTable *et;
|
||||||
|
|
||||||
g_return_if_fail (book);
|
g_return_if_fail (book);
|
||||||
g_return_if_fail (cb);
|
g_return_if_fail (cb);
|
||||||
|
|
||||||
et = qof_book_get_entity_table (book);
|
et = qof_book_get_entity_table (book);
|
||||||
xaccForeachEntity (et, type, cb, ud);
|
qof_entity_foreach (et, type, cb, ud);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
split_foreach (QofBook *book, foreachObjectCB fcn, gpointer user_data)
|
split_foreach (QofBook *book, QofEntityForeachCB fcn, gpointer user_data)
|
||||||
{
|
{
|
||||||
do_foreach (book, GNC_ID_SPLIT, fcn, user_data);
|
do_foreach (book, GNC_ID_SPLIT, fcn, user_data);
|
||||||
}
|
}
|
||||||
@ -3642,7 +3642,7 @@ gboolean xaccSplitRegister (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
trans_foreach (QofBook *book, foreachObjectCB fcn, gpointer user_data)
|
trans_foreach (QofBook *book, QofEntityForeachCB fcn, gpointer user_data)
|
||||||
{
|
{
|
||||||
do_foreach (book, GNC_ID_TRANS, fcn, user_data);
|
do_foreach (book, GNC_ID_TRANS, fcn, user_data);
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
#include "gnc-commodity.h"
|
#include "gnc-commodity.h"
|
||||||
#include "gnc-date.h"
|
#include "gnc-date.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
|
#include "guid.h"
|
||||||
#include "kvp_frame.h"
|
#include "kvp_frame.h"
|
||||||
#include "GNCId.h"
|
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
|
||||||
/** @name Split Reconciled field values
|
/** @name Split Reconciled field values
|
||||||
|
@ -53,9 +53,9 @@
|
|||||||
#include "Backend.h"
|
#include "Backend.h"
|
||||||
#include "gnc-engine.h" /* for typedefs */
|
#include "gnc-engine.h" /* for typedefs */
|
||||||
#include "gnc-numeric.h"
|
#include "gnc-numeric.h"
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "kvp_frame.h"
|
#include "kvp_frame.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
#include "qofid.h"
|
||||||
|
|
||||||
|
|
||||||
/** STRUCTS *********************************************************/
|
/** STRUCTS *********************************************************/
|
||||||
|
@ -434,10 +434,10 @@ gnc_scm2balance_match_how (SCM how_scm, gboolean *resp)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GNCIdType
|
static QofIdType
|
||||||
gnc_scm2kvp_match_where (SCM where_scm)
|
gnc_scm2kvp_match_where (SCM where_scm)
|
||||||
{
|
{
|
||||||
GNCIdType res;
|
QofIdType res;
|
||||||
char *where;
|
char *where;
|
||||||
|
|
||||||
if (!SCM_LISTP (where_scm))
|
if (!SCM_LISTP (where_scm))
|
||||||
@ -490,7 +490,7 @@ gnc_scm2guid_glist (SCM guids_scm)
|
|||||||
SCM guid_scm = SCM_CAR (guids_scm);
|
SCM guid_scm = SCM_CAR (guids_scm);
|
||||||
GUID *guid;
|
GUID *guid;
|
||||||
|
|
||||||
guid = xaccGUIDMalloc ();
|
guid = guid_malloc ();
|
||||||
*guid = gnc_scm2guid (guid_scm);
|
*guid = gnc_scm2guid (guid_scm);
|
||||||
|
|
||||||
guids = g_list_prepend (guids, guid);
|
guids = g_list_prepend (guids, guid);
|
||||||
@ -507,7 +507,7 @@ gnc_guid_glist_free (GList *guids)
|
|||||||
GList *node;
|
GList *node;
|
||||||
|
|
||||||
for (node = guids; node; node = node->next)
|
for (node = guids; node; node = node->next)
|
||||||
xaccGUIDFree (node->data);
|
guid_free (node->data);
|
||||||
|
|
||||||
g_list_free (guids);
|
g_list_free (guids);
|
||||||
}
|
}
|
||||||
@ -1410,7 +1410,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
|
|||||||
|
|
||||||
} else if (!safe_strcmp (pd_type, "pd-guid")) {
|
} else if (!safe_strcmp (pd_type, "pd-guid")) {
|
||||||
GUID guid;
|
GUID guid;
|
||||||
GNCIdType id_type;
|
QofIdType id_type;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
/* guid */
|
/* guid */
|
||||||
@ -1435,7 +1435,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
|
|||||||
GSList *path;
|
GSList *path;
|
||||||
kvp_value *value;
|
kvp_value *value;
|
||||||
QofQueryCompare how;
|
QofQueryCompare how;
|
||||||
GNCIdType where;
|
QofIdType where;
|
||||||
|
|
||||||
/* how */
|
/* how */
|
||||||
if (SCM_NULLP (query_term_scm))
|
if (SCM_NULLP (query_term_scm))
|
||||||
|
@ -31,9 +31,9 @@
|
|||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-session.h"
|
#include "gnc-session.h"
|
||||||
#include "Account.h"
|
#include "Account.h"
|
||||||
#include "GNCId.h"
|
|
||||||
#include "Query.h"
|
#include "Query.h"
|
||||||
#include "Transaction.h"
|
#include "Transaction.h"
|
||||||
|
#include "guid.h"
|
||||||
#include "guile-mappings.h"
|
#include "guile-mappings.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
|
||||||
|
@ -29,11 +29,11 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "AccountP.h"
|
#include "AccountP.h"
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "gnc-associate-account.h"
|
#include "gnc-associate-account.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
#include "qofid.h"
|
||||||
|
|
||||||
static short module = MOD_ENGINE;
|
static short module = MOD_ENGINE;
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ back_associate_expense_accounts(Account *stock_account,
|
|||||||
g_return_if_fail(kvp_value_get_type(val) == KVP_TYPE_GUID);
|
g_return_if_fail(kvp_value_get_type(val) == KVP_TYPE_GUID);
|
||||||
existing_acc_guid = kvp_value_get_guid(val);
|
existing_acc_guid = kvp_value_get_guid(val);
|
||||||
|
|
||||||
g_return_if_fail(GNC_ID_NONE == xaccGUIDType (existing_acc_guid, stock_account->book));
|
g_return_if_fail(GNC_ID_NONE == qof_entity_type (qof_book_get_entity_table (stock_account->book), existing_acc_guid));
|
||||||
|
|
||||||
kvp_frame_set_slot_nc(acc_frame, "associated-stock-account",
|
kvp_frame_set_slot_nc(acc_frame, "associated-stock-account",
|
||||||
stock_acc_guid_kvpval);
|
stock_acc_guid_kvpval);
|
||||||
@ -129,8 +129,7 @@ back_associate_income_accounts(Account *stock_account,
|
|||||||
g_return_if_fail(kvp_value_get_type(val) == KVP_TYPE_GUID);
|
g_return_if_fail(kvp_value_get_type(val) == KVP_TYPE_GUID);
|
||||||
existing_acc_guid = kvp_value_get_guid(val);
|
existing_acc_guid = kvp_value_get_guid(val);
|
||||||
|
|
||||||
g_return_if_fail(xaccGUIDType(existing_acc_guid,
|
g_return_if_fail(qof_entity_type(qof_book_get_entity_table(stock_account->book), existing_acc_guid) ==
|
||||||
stock_account->book) ==
|
|
||||||
GNC_ID_NONE);
|
GNC_ID_NONE);
|
||||||
|
|
||||||
kvp_frame_set_slot_nc(acc_frame, "associated-stock-account",
|
kvp_frame_set_slot_nc(acc_frame, "associated-stock-account",
|
||||||
@ -449,7 +448,7 @@ gnc_tracking_dissociate_account(Account *inc_or_expense_account)
|
|||||||
|
|
||||||
stock_account_guid = kvp_value_get_guid(stock_account_kvpval);
|
stock_account_guid = kvp_value_get_guid(stock_account_kvpval);
|
||||||
if(!safe_strcmp
|
if(!safe_strcmp
|
||||||
(xaccGUIDType(stock_account_guid, inc_or_expense_account->book),
|
(qof_entity_type(qof_book_get_entity_table(inc_or_expense_account->book), stock_account_guid),
|
||||||
GNC_ID_NULL))
|
GNC_ID_NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
|
|
||||||
@ -38,6 +37,7 @@
|
|||||||
#include "gnc-pricedb-p.h"
|
#include "gnc-pricedb-p.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
#include "qofbook-p.h"
|
#include "qofbook-p.h"
|
||||||
|
#include "qofid.h"
|
||||||
#include "qofobject.h"
|
#include "qofobject.h"
|
||||||
#include "qofobject-p.h"
|
#include "qofobject-p.h"
|
||||||
#include "qofquery.h"
|
#include "qofquery.h"
|
||||||
@ -82,7 +82,7 @@ gnc_engine_init(int argc, char ** argv)
|
|||||||
/* initialize the string cache */
|
/* initialize the string cache */
|
||||||
gnc_engine_get_string_cache();
|
gnc_engine_get_string_cache();
|
||||||
|
|
||||||
xaccGUIDInit ();
|
guid_init ();
|
||||||
qof_object_initialize ();
|
qof_object_initialize ();
|
||||||
qof_query_init ();
|
qof_query_init ();
|
||||||
qof_book_register ();
|
qof_book_register ();
|
||||||
@ -116,11 +116,9 @@ void
|
|||||||
gnc_engine_shutdown (void)
|
gnc_engine_shutdown (void)
|
||||||
{
|
{
|
||||||
qof_query_shutdown ();
|
qof_query_shutdown ();
|
||||||
|
|
||||||
gnc_engine_string_cache_destroy ();
|
|
||||||
|
|
||||||
qof_object_shutdown ();
|
qof_object_shutdown ();
|
||||||
xaccGUIDShutdown ();
|
guid_shutdown();
|
||||||
|
gnc_engine_string_cache_destroy ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
@brief All type declarations for the whole Gnucash engine
|
@brief All type declarations for the whole Gnucash engine
|
||||||
@author Copyright (C) 1997 Robin D. Clark
|
@author Copyright (C) 1997 Robin D. Clark
|
||||||
@author Copyright (C) 2000 Bill Gribble <grib@billgribble.com>
|
@author Copyright (C) 2000 Bill Gribble <grib@billgribble.com>
|
||||||
|
@author Copyright (C) 2000 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
@author Copyright (C) 1997-2001 Linas Vepstas <linas@linas.org>
|
@author Copyright (C) 1997-2001 Linas Vepstas <linas@linas.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -32,6 +33,48 @@
|
|||||||
#define GNC_ENGINE_H
|
#define GNC_ENGINE_H
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include "qofid.h"
|
||||||
|
|
||||||
|
/* IDENTIFIERS *****************************************************/
|
||||||
|
/** GUID Identifiers can be used to reference Accounts, Transactions,
|
||||||
|
* Splits and other objects. These Gnucash types are referred to as Gnucash
|
||||||
|
* entities. GUID Identifiers are globally-unique and permanent, i.e., once
|
||||||
|
* an entity has been assigned an identifier, it retains that same
|
||||||
|
* identifier for its lifetime.
|
||||||
|
*
|
||||||
|
* Identifiers are 'typed' with strings. The ids used in gnucash are
|
||||||
|
* defined below. An id with type GNC_ID_NONE does not refer to any
|
||||||
|
* entity, although that may change as new ids are created. An id with
|
||||||
|
* type GNC_ID_NULL does not refer to any entity, and will never refer
|
||||||
|
* to any entity. An identifier with any other type may refer to an
|
||||||
|
* actual entity, but that is not guaranteed. If an id does refer to
|
||||||
|
* an entity, the type of the entity will match the type of the
|
||||||
|
* identifier.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GNC_ID_NONE QOF_ID_NONE
|
||||||
|
#define GNC_ID_BOOK QOF_ID_BOOK
|
||||||
|
#define GNC_ID_SESSION QOF_ID_SESSION
|
||||||
|
#define GNC_ID_NULL QOF_ID_NULL
|
||||||
|
|
||||||
|
#define GNC_ID_ACCOUNT "Account"
|
||||||
|
#define GNC_ID_COMMODITY_TABLE "CommodityTable"
|
||||||
|
#define GNC_ID_FREQSPEC "FreqSpec"
|
||||||
|
#define GNC_ID_GROUP "AccountGroup"
|
||||||
|
#define GNC_ID_LOT "Lot"
|
||||||
|
#define GNC_ID_PERIOD "Period"
|
||||||
|
#define GNC_ID_PRICE "Price"
|
||||||
|
#define GNC_ID_PRICEDB "PriceDB"
|
||||||
|
#define GNC_ID_SPLIT "Split"
|
||||||
|
#define GNC_ID_SCHEDXACTION "SchedXaction"
|
||||||
|
#define GNC_ID_SXTT "SXTT"
|
||||||
|
#define GNC_ID_TRANS "Trans"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* TYPES **********************************************************/
|
/* TYPES **********************************************************/
|
||||||
|
|
||||||
|
@ -37,10 +37,10 @@
|
|||||||
#ifndef GNC_LOT_P_H
|
#ifndef GNC_LOT_P_H
|
||||||
#define GNC_LOT_P_H
|
#define GNC_LOT_P_H
|
||||||
|
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "kvp_frame.h"
|
#include "kvp_frame.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
#include "qofid.h"
|
||||||
|
|
||||||
struct gnc_lot_struct
|
struct gnc_lot_struct
|
||||||
{
|
{
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include "qofqueryobject.h"
|
#include "qofqueryobject.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
#include "qofbook-p.h"
|
#include "qofbook-p.h"
|
||||||
|
#include "qofid-p.h"
|
||||||
|
|
||||||
/* This static indicates the debugging module that this .o belongs to. */
|
/* This static indicates the debugging module that this .o belongs to. */
|
||||||
static short module = MOD_LOT;
|
static short module = MOD_LOT;
|
||||||
@ -60,8 +61,8 @@ gnc_lot_init (GNCLot *lot, QofBook *book)
|
|||||||
lot->is_closed = -1;
|
lot->is_closed = -1;
|
||||||
|
|
||||||
lot->book = book;
|
lot->book = book;
|
||||||
xaccGUIDNew (&lot->guid, book);
|
qof_entity_guid_new (book->entity_table, &lot->guid);
|
||||||
xaccStoreEntity (book->entity_table, lot, &lot->guid, GNC_ID_LOT);
|
qof_entity_store (book->entity_table, lot, &lot->guid, GNC_ID_LOT);
|
||||||
LEAVE ("(lot=%p, book=%p)", lot, book);
|
LEAVE ("(lot=%p, book=%p)", lot, book);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +86,7 @@ gnc_lot_destroy (GNCLot *lot)
|
|||||||
ENTER ("(lot=%p)", lot);
|
ENTER ("(lot=%p)", lot);
|
||||||
gnc_engine_generate_event (&lot->guid, GNC_EVENT_DESTROY);
|
gnc_engine_generate_event (&lot->guid, GNC_EVENT_DESTROY);
|
||||||
|
|
||||||
xaccRemoveEntity (lot->book->entity_table, &lot->guid);
|
qof_entity_remove (lot->book->entity_table, &lot->guid);
|
||||||
|
|
||||||
for (node=lot->splits; node; node=node->next)
|
for (node=lot->splits; node; node=node->next)
|
||||||
{
|
{
|
||||||
@ -119,16 +120,16 @@ gnc_lot_set_guid (GNCLot *lot, GUID uid)
|
|||||||
|
|
||||||
if (guid_equal (&lot->guid, &uid)) return;
|
if (guid_equal (&lot->guid, &uid)) return;
|
||||||
|
|
||||||
xaccRemoveEntity(lot->book->entity_table, &lot->guid);
|
qof_entity_remove(lot->book->entity_table, &lot->guid);
|
||||||
lot->guid = uid;
|
lot->guid = uid;
|
||||||
xaccStoreEntity(lot->book->entity_table, lot, &lot->guid, GNC_ID_LOT);
|
qof_entity_store(lot->book->entity_table, lot, &lot->guid, GNC_ID_LOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
GNCLot *
|
GNCLot *
|
||||||
gnc_lot_lookup (const GUID *guid, QofBook *book)
|
gnc_lot_lookup (const GUID *guid, QofBook *book)
|
||||||
{
|
{
|
||||||
if (!guid || !book) return NULL;
|
if (!guid || !book) return NULL;
|
||||||
return xaccLookupEntity (qof_book_get_entity_table (book),
|
return qof_entity_lookup (qof_book_get_entity_table (book),
|
||||||
guid, GNC_ID_LOT);
|
guid, GNC_ID_LOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "Backend.h"
|
#include "Backend.h"
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-pricedb.h"
|
#include "gnc-pricedb.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
#include "qofid.h"
|
||||||
|
|
||||||
struct gnc_price_s
|
struct gnc_price_s
|
||||||
{
|
{
|
||||||
@ -50,7 +50,7 @@ struct gnc_price_s
|
|||||||
guint32 version_check; /* data aging timestamp */
|
guint32 version_check; /* data aging timestamp */
|
||||||
|
|
||||||
/* 'private' object management fields */
|
/* 'private' object management fields */
|
||||||
GNCEntityTable *entity_table; /* table in which price is stored */
|
QofEntityTable *entity_table; /* table in which price is stored */
|
||||||
guint32 refcount; /* garbage collection reference count */
|
guint32 refcount; /* garbage collection reference count */
|
||||||
gint32 editlevel; /* nesting level of begin/end edit calls */
|
gint32 editlevel; /* nesting level of begin/end edit calls */
|
||||||
gboolean not_saved; /* price edit saved flag */
|
gboolean not_saved; /* price edit saved flag */
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "BackendP.h"
|
#include "BackendP.h"
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
#include "gnc-event-p.h"
|
#include "gnc-event-p.h"
|
||||||
@ -37,6 +36,7 @@
|
|||||||
#include "kvp-util.h"
|
#include "kvp-util.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
#include "qofbook-p.h"
|
#include "qofbook-p.h"
|
||||||
|
#include "qofid-p.h"
|
||||||
#include "qofobject.h"
|
#include "qofobject.h"
|
||||||
|
|
||||||
/* This static indicates the debugging module that this .o belongs to. */
|
/* This static indicates the debugging module that this .o belongs to. */
|
||||||
@ -70,8 +70,8 @@ gnc_price_create (QofBook *book)
|
|||||||
p->book = book;
|
p->book = book;
|
||||||
p->entity_table = qof_book_get_entity_table (book);
|
p->entity_table = qof_book_get_entity_table (book);
|
||||||
|
|
||||||
xaccGUIDNew (&p->guid, book);
|
qof_entity_guid_new (p->entity_table, &p->guid);
|
||||||
xaccStoreEntity (p->entity_table, p, &p->guid, GNC_ID_PRICE);
|
qof_entity_store (p->entity_table, p, &p->guid, GNC_ID_PRICE);
|
||||||
gnc_engine_generate_event (&p->guid, GNC_EVENT_CREATE);
|
gnc_engine_generate_event (&p->guid, GNC_EVENT_CREATE);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
@ -82,7 +82,7 @@ gnc_price_destroy (GNCPrice *p)
|
|||||||
{
|
{
|
||||||
ENTER(" ");
|
ENTER(" ");
|
||||||
gnc_engine_generate_event (&p->guid, GNC_EVENT_DESTROY);
|
gnc_engine_generate_event (&p->guid, GNC_EVENT_DESTROY);
|
||||||
xaccRemoveEntity(p->entity_table, &p->guid);
|
qof_entity_remove(p->entity_table, &p->guid);
|
||||||
|
|
||||||
if(p->type) g_cache_remove(gnc_engine_get_string_cache(), p->type);
|
if(p->type) g_cache_remove(gnc_engine_get_string_cache(), p->type);
|
||||||
if(p->source) g_cache_remove(gnc_engine_get_string_cache(), p->source);
|
if(p->source) g_cache_remove(gnc_engine_get_string_cache(), p->source);
|
||||||
@ -243,10 +243,10 @@ void
|
|||||||
gnc_price_set_guid (GNCPrice *p, const GUID *guid)
|
gnc_price_set_guid (GNCPrice *p, const GUID *guid)
|
||||||
{
|
{
|
||||||
if (!p || !guid) return;
|
if (!p || !guid) return;
|
||||||
xaccRemoveEntity (p->entity_table, &p->guid);
|
qof_entity_remove (p->entity_table, &p->guid);
|
||||||
p->guid = *guid;
|
p->guid = *guid;
|
||||||
if(p->db) p->db->dirty = TRUE;
|
if(p->db) p->db->dirty = TRUE;
|
||||||
xaccStoreEntity(p->entity_table, p, &p->guid, GNC_ID_PRICE);
|
qof_entity_store(p->entity_table, p, &p->guid, GNC_ID_PRICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -380,21 +380,21 @@ gnc_price_lookup (const GUID *guid, QofBook *book)
|
|||||||
{
|
{
|
||||||
if (!guid) return NULL;
|
if (!guid) return NULL;
|
||||||
g_return_val_if_fail (book, NULL);
|
g_return_val_if_fail (book, NULL);
|
||||||
return xaccLookupEntity (qof_book_get_entity_table (book),
|
return qof_entity_lookup (qof_book_get_entity_table (book),
|
||||||
guid, GNC_ID_PRICE);
|
guid, GNC_ID_PRICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const GUID *
|
const GUID *
|
||||||
gnc_price_get_guid (GNCPrice *p)
|
gnc_price_get_guid (GNCPrice *p)
|
||||||
{
|
{
|
||||||
if (!p) return xaccGUIDNULL();
|
if (!p) return guid_null();
|
||||||
return &p->guid;
|
return &p->guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GUID
|
const GUID
|
||||||
gnc_price_return_guid (GNCPrice *p)
|
gnc_price_return_guid (GNCPrice *p)
|
||||||
{
|
{
|
||||||
if (!p) return *xaccGUIDNULL();
|
if (!p) return *guid_null();
|
||||||
return p->guid;
|
return p->guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,10 +56,63 @@
|
|||||||
/** Static global variables *****************************************/
|
/** Static global variables *****************************************/
|
||||||
static gboolean guid_initialized = FALSE;
|
static gboolean guid_initialized = FALSE;
|
||||||
static struct md5_ctx guid_context;
|
static struct md5_ctx guid_context;
|
||||||
|
static GMemChunk *guid_memchunk = NULL;
|
||||||
|
|
||||||
/* This static indicates the debugging module that this .o belongs to. */
|
/* This static indicates the debugging module that this .o belongs to. */
|
||||||
static short module = MOD_ENGINE;
|
static short module = MOD_ENGINE;
|
||||||
|
|
||||||
|
/** Memory management routines ***************************************/
|
||||||
|
static void
|
||||||
|
guid_memchunk_init (void)
|
||||||
|
{
|
||||||
|
if (!guid_memchunk)
|
||||||
|
guid_memchunk = g_mem_chunk_create (GUID, 512, G_ALLOC_AND_FREE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
guid_memchunk_shutdown (void)
|
||||||
|
{
|
||||||
|
if (guid_memchunk)
|
||||||
|
{
|
||||||
|
g_mem_chunk_destroy (guid_memchunk);
|
||||||
|
guid_memchunk = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GUID *
|
||||||
|
guid_malloc (void)
|
||||||
|
{
|
||||||
|
return g_chunk_new (GUID, guid_memchunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
guid_free (GUID *guid)
|
||||||
|
{
|
||||||
|
if (!guid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_chunk_free (guid, guid_memchunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const GUID *
|
||||||
|
guid_null(void)
|
||||||
|
{
|
||||||
|
static int null_inited = (0 == 1);
|
||||||
|
static GUID null_guid;
|
||||||
|
|
||||||
|
if (!null_inited)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 16; i++)
|
||||||
|
null_guid.data[i] = 0;
|
||||||
|
|
||||||
|
null_inited = (0 == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return &null_guid;
|
||||||
|
}
|
||||||
|
|
||||||
/** Function implementations ****************************************/
|
/** Function implementations ****************************************/
|
||||||
|
|
||||||
@ -230,6 +283,8 @@ guid_init(void)
|
|||||||
{
|
{
|
||||||
size_t bytes = 0;
|
size_t bytes = 0;
|
||||||
|
|
||||||
|
guid_memchunk_init();
|
||||||
|
|
||||||
md5_init_ctx(&guid_context);
|
md5_init_ctx(&guid_context);
|
||||||
|
|
||||||
/* entropy pool */
|
/* entropy pool */
|
||||||
@ -369,6 +424,12 @@ guid_init_only_salt(const void *salt, size_t salt_len)
|
|||||||
guid_initialized = TRUE;
|
guid_initialized = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
guid_shutdown (void)
|
||||||
|
{
|
||||||
|
guid_memchunk_shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
#define GUID_PERIOD 5000
|
#define GUID_PERIOD 5000
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -48,7 +48,7 @@ typedef union _GUID
|
|||||||
#define GUID_ENCODING_LENGTH 32
|
#define GUID_ENCODING_LENGTH 32
|
||||||
|
|
||||||
|
|
||||||
/* Three functions to initialize the id generator. Only one needs to
|
/** Three functions to initialize the id generator. Only one needs to
|
||||||
* be called. Calling any initialization function a second time will
|
* be called. Calling any initialization function a second time will
|
||||||
* reset the generator and erase the effect of the first call.
|
* reset the generator and erase the effect of the first call.
|
||||||
*
|
*
|
||||||
@ -62,10 +62,12 @@ typedef union _GUID
|
|||||||
* guid_init_only_salt() will initialize the generator with the data
|
* guid_init_only_salt() will initialize the generator with the data
|
||||||
* given in the salt argument, but not with any other source. Calling
|
* given in the salt argument, but not with any other source. Calling
|
||||||
* guid_init_only_salt() with a specific argument will produce a
|
* guid_init_only_salt() with a specific argument will produce a
|
||||||
* specific sequence of ids reliably. */
|
* specific sequence of ids reliably.
|
||||||
|
*/
|
||||||
void guid_init(void);
|
void guid_init(void);
|
||||||
void guid_init_with_salt(const void *salt, size_t salt_len);
|
void guid_init_with_salt(const void *salt, size_t salt_len);
|
||||||
void guid_init_only_salt(const void *salt, size_t salt_len);
|
void guid_init_only_salt(const void *salt, size_t salt_len);
|
||||||
|
void guid_shutdown (void);
|
||||||
|
|
||||||
|
|
||||||
/* Generate a new id. If no initialization function has been called,
|
/* Generate a new id. If no initialization function has been called,
|
||||||
@ -73,8 +75,16 @@ void guid_init_only_salt(const void *salt, size_t salt_len);
|
|||||||
void guid_new(GUID *guid);
|
void guid_new(GUID *guid);
|
||||||
GUID guid_new_return(void);
|
GUID guid_new_return(void);
|
||||||
|
|
||||||
|
/** Returns a GUID which is guaranteed to never reference any entity. */
|
||||||
|
const GUID * guid_null (void);
|
||||||
|
|
||||||
/* The guid_to_string() routine returns a null-terminated string
|
/** Efficiently allocate & free memory for GUIDs */
|
||||||
|
GUID * guid_malloc (void);
|
||||||
|
|
||||||
|
/* Return a guid set to all zero's */
|
||||||
|
void guid_free (GUID *guid);
|
||||||
|
|
||||||
|
/** The guid_to_string() routine returns a null-terminated string
|
||||||
* encoding of the id. String encodings of identifiers are hex
|
* encoding of the id. String encodings of identifiers are hex
|
||||||
* numbers printed only with the characters '0' through '9' and
|
* numbers printed only with the characters '0' through '9' and
|
||||||
* 'a' through 'f'. The encoding will always be GUID_ENCODING_LENGTH
|
* 'a' through 'f'. The encoding will always be GUID_ENCODING_LENGTH
|
||||||
@ -92,7 +102,7 @@ char * guid_to_string (const GUID * guid);
|
|||||||
char * guid_to_string_buff (const GUID * guid, char *buff);
|
char * guid_to_string_buff (const GUID * guid, char *buff);
|
||||||
|
|
||||||
|
|
||||||
/* Given a string, decode the id into the guid if guid is non-NULL.
|
/** Given a string, decode the id into the guid if guid is non-NULL.
|
||||||
* The function returns TRUE if the string was a valid 32 character
|
* The function returns TRUE if the string was a valid 32 character
|
||||||
* hexadecimal number. This function accepts both upper and lower case
|
* hexadecimal number. This function accepts both upper and lower case
|
||||||
* hex digits. If the return value is FALSE, the effect on guid is
|
* hex digits. If the return value is FALSE, the effect on guid is
|
||||||
@ -100,12 +110,12 @@ char * guid_to_string_buff (const GUID * guid, char *buff);
|
|||||||
gboolean string_to_guid(const char * string, GUID * guid);
|
gboolean string_to_guid(const char * string, GUID * guid);
|
||||||
|
|
||||||
|
|
||||||
/* Given two GUIDs, return TRUE if they are non-NULL and equal.
|
/** Given two GUIDs, return TRUE if they are non-NULL and equal.
|
||||||
* Return FALSE, otherwise. */
|
* Return FALSE, otherwise. */
|
||||||
gboolean guid_equal(const GUID *guid_1, const GUID *guid_2);
|
gboolean guid_equal(const GUID *guid_1, const GUID *guid_2);
|
||||||
gint guid_compare(const GUID *g1, const GUID *g2);
|
gint guid_compare(const GUID *g1, const GUID *g2);
|
||||||
|
|
||||||
/* Given a GUID *, hash it to a guint */
|
/** Given a GUID *, hash it to a guint */
|
||||||
guint guid_hash_to_guint(gconstpointer ptr);
|
guint guid_hash_to_guint(gconstpointer ptr);
|
||||||
|
|
||||||
GHashTable *guid_hash_table_new(void);
|
GHashTable *guid_hash_table_new(void);
|
||||||
|
@ -93,7 +93,7 @@
|
|||||||
|
|
||||||
(gw:wrap-as-wct ws '<gnc:GList*> "GList*" "const GList*")
|
(gw:wrap-as-wct ws '<gnc:GList*> "GList*" "const GList*")
|
||||||
|
|
||||||
(gw:wrap-as-wct ws '<gnc:id-type> "GNCIdType" "GNCIdTypeConst")
|
(gw:wrap-as-wct ws '<gnc:id-type> "QofIdType" "QofIdTypeConst")
|
||||||
(gw:wrap-as-wct ws '<gnc:Account*> "Account*" "const Account*")
|
(gw:wrap-as-wct ws '<gnc:Account*> "Account*" "const Account*")
|
||||||
(gw:wrap-as-wct ws '<gnc:Account**> "Account**" "const Account**")
|
(gw:wrap-as-wct ws '<gnc:Account**> "Account**" "const Account**")
|
||||||
(gw:wrap-as-wct ws '<gnc:InvAcct*> "InvAcct*" "const InvAcct*")
|
(gw:wrap-as-wct ws '<gnc:InvAcct*> "InvAcct*" "const InvAcct*")
|
||||||
@ -252,7 +252,7 @@
|
|||||||
#t)
|
#t)
|
||||||
|
|
||||||
;
|
;
|
||||||
; Definitions from GNCId.h
|
; Definitions from gnc-engine.h
|
||||||
;
|
;
|
||||||
(gw:wrap-value ws 'gnc:id-account '<gnc:id-type> "GNC_ID_ACCOUNT")
|
(gw:wrap-value ws 'gnc:id-account '<gnc:id-type> "GNC_ID_ACCOUNT")
|
||||||
(gw:wrap-value ws 'gnc:id-book '<gnc:id-type> "GNC_ID_BOOK")
|
(gw:wrap-value ws 'gnc:id-book '<gnc:id-type> "GNC_ID_BOOK")
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "GNCId.h"
|
#include "guid.h"
|
||||||
#include "kvp_frame.h"
|
#include "kvp_frame.h"
|
||||||
|
|
||||||
/* PRIVATE FILE
|
/* PRIVATE FILE
|
||||||
|
@ -31,9 +31,9 @@
|
|||||||
#define QOF_BOOK_P_H
|
#define QOF_BOOK_P_H
|
||||||
|
|
||||||
#include "Backend.h"
|
#include "Backend.h"
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "kvp_frame.h"
|
#include "kvp_frame.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
#include "qofid.h"
|
||||||
|
|
||||||
struct _QofBook
|
struct _QofBook
|
||||||
{
|
{
|
||||||
@ -48,7 +48,7 @@ struct _QofBook
|
|||||||
* belonging to this book, with their pointers to the respective
|
* belonging to this book, with their pointers to the respective
|
||||||
* objects. This allows a lookup of objects based on thier guid.
|
* objects. This allows a lookup of objects based on thier guid.
|
||||||
*/
|
*/
|
||||||
GNCEntityTable *entity_table;
|
QofEntityTable *entity_table;
|
||||||
|
|
||||||
/* In order to store arbitrary data, for extensibility, add a table
|
/* In order to store arbitrary data, for extensibility, add a table
|
||||||
* that will be used to hold arbitrary pointers.
|
* that will be used to hold arbitrary pointers.
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include "gnc-trace.h"
|
#include "gnc-trace.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
#include "qofbook-p.h"
|
#include "qofbook-p.h"
|
||||||
|
#include "qofid-p.h"
|
||||||
#include "qofobject-p.h"
|
#include "qofobject-p.h"
|
||||||
#include "qofqueryobject.h"
|
#include "qofqueryobject.h"
|
||||||
|
|
||||||
@ -60,10 +61,10 @@ qof_book_init (QofBook *book)
|
|||||||
{
|
{
|
||||||
if (!book) return;
|
if (!book) return;
|
||||||
|
|
||||||
book->entity_table = xaccEntityTableNew ();
|
book->entity_table = qof_entity_new ();
|
||||||
|
|
||||||
xaccGUIDNew(&book->guid, book);
|
qof_entity_guid_new (book->entity_table, &book->guid);
|
||||||
xaccStoreEntity(book->entity_table, book, &book->guid, GNC_ID_BOOK);
|
qof_entity_store(book->entity_table, book, &book->guid, QOF_ID_BOOK);
|
||||||
|
|
||||||
book->kvp_data = kvp_frame_new ();
|
book->kvp_data = kvp_frame_new ();
|
||||||
|
|
||||||
@ -101,8 +102,8 @@ qof_book_destroy (QofBook *book)
|
|||||||
|
|
||||||
qof_object_book_end (book);
|
qof_object_book_end (book);
|
||||||
|
|
||||||
xaccRemoveEntity (book->entity_table, &book->guid);
|
qof_entity_remove (book->entity_table, &book->guid);
|
||||||
xaccEntityTableDestroy (book->entity_table);
|
qof_entity_destroy (book->entity_table);
|
||||||
book->entity_table = NULL;
|
book->entity_table = NULL;
|
||||||
|
|
||||||
/* FIXME: Make sure the data_table is empty */
|
/* FIXME: Make sure the data_table is empty */
|
||||||
@ -159,7 +160,7 @@ qof_book_get_slots (QofBook *book)
|
|||||||
return book->kvp_data;
|
return book->kvp_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
GNCEntityTable *
|
QofEntityTable *
|
||||||
qof_book_get_entity_table (QofBook *book)
|
qof_book_get_entity_table (QofBook *book)
|
||||||
{
|
{
|
||||||
if (!book) return NULL;
|
if (!book) return NULL;
|
||||||
@ -183,9 +184,9 @@ qof_book_set_guid (QofBook *book, GUID uid)
|
|||||||
|
|
||||||
if (guid_equal (&book->guid, &uid)) return;
|
if (guid_equal (&book->guid, &uid)) return;
|
||||||
|
|
||||||
xaccRemoveEntity(book->entity_table, &book->guid);
|
qof_entity_remove(book->entity_table, &book->guid);
|
||||||
book->guid = uid;
|
book->guid = uid;
|
||||||
xaccStoreEntity(book->entity_table, book, &book->guid, GNC_ID_BOOK);
|
qof_entity_store(book->entity_table, book, &book->guid, QOF_ID_BOOK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -298,7 +299,7 @@ gboolean qof_book_register (void)
|
|||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
qof_query_object_register (GNC_ID_BOOK, NULL, params);
|
qof_query_object_register (QOF_ID_BOOK, NULL, params);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "GNCId.h"
|
#include "qofid.h"
|
||||||
#include "kvp_frame.h"
|
#include "kvp_frame.h"
|
||||||
|
|
||||||
/** @brief Encapsulates all the information about a dataset
|
/** @brief Encapsulates all the information about a dataset
|
||||||
@ -56,7 +56,7 @@ QofBook * qof_book_new (void);
|
|||||||
void qof_book_destroy (QofBook *book);
|
void qof_book_destroy (QofBook *book);
|
||||||
|
|
||||||
/** \return The Entity table for the book. */
|
/** \return The Entity table for the book. */
|
||||||
GNCEntityTable * qof_book_get_entity_table (QofBook *book);
|
QofEntityTable * qof_book_get_entity_table (QofBook *book);
|
||||||
|
|
||||||
/** \return The GUID for the book. */
|
/** \return The GUID for the book. */
|
||||||
const GUID * qof_book_get_guid (QofBook *book);
|
const GUID * qof_book_get_guid (QofBook *book);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* GNCIdP.h -- Gnucash entity identifier engine-only API *
|
* qofid-p.h -- QOF entity identifier engine-only API *
|
||||||
* Copyright (C) 2000 Dave Peticolas <peticola@cs.ucdavis.edu> *
|
* Copyright (C) 2000 Dave Peticolas <peticola@cs.ucdavis.edu> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* This program is free software; you can redistribute it and/or *
|
||||||
@ -21,19 +21,19 @@
|
|||||||
* *
|
* *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
#ifndef GNC_ID_P_H
|
#ifndef QOF_ID_P_H
|
||||||
#define GNC_ID_P_H 1
|
#define QOF_ID_P_H
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "GNCId.h"
|
#include "qofid.h"
|
||||||
|
|
||||||
/* This file defines an engine-only API for using gnucash entity
|
/* This file defines an engine-only API for using gnucash entity
|
||||||
* identifiers. */
|
* identifiers. */
|
||||||
|
|
||||||
/* Create and destroy entity tables */
|
/* Create and destroy entity tables */
|
||||||
GNCEntityTable * xaccEntityTableNew (void);
|
QofEntityTable * qof_entity_new (void);
|
||||||
void xaccEntityTableDestroy (GNCEntityTable *table);
|
void qof_entity_destroy (QofEntityTable *table);
|
||||||
|
|
||||||
/* Generate a new id. This function is guaranteed to return an id that
|
/* Generate a new id. This function is guaranteed to return an id that
|
||||||
* is unique within the scope of all GnuCash entities being managed by
|
* is unique within the scope of all GnuCash entities being managed by
|
||||||
@ -43,39 +43,29 @@ void xaccEntityTableDestroy (GNCEntityTable *table);
|
|||||||
* When considered over all possible instances of gnucash, the odds of
|
* When considered over all possible instances of gnucash, the odds of
|
||||||
* this routine returning a non-unique id are still astronomically small.
|
* this routine returning a non-unique id are still astronomically small.
|
||||||
* If you had a gazzillion computers computing new ids, for the entire
|
* If you had a gazzillion computers computing new ids, for the entire
|
||||||
* age of teh universe, you'd still have a one-in-a-million chance of
|
* age of the universe, you'd still have a one-in-a-million chance of
|
||||||
* coming up with a duplicate. 2^128 is a really really big number.
|
* coming up with a duplicate. 2^128 is a really really big number.
|
||||||
*/
|
*/
|
||||||
void xaccGUIDNewEntityTable (GUID *guid, GNCEntityTable *entity_table);
|
void qof_entity_guid_new (QofEntityTable *entity_table, GUID *guid);
|
||||||
|
|
||||||
/* Equivalent function prototype:
|
|
||||||
* void xaccGUIDNew (GUID *guid, QofBook *book)
|
|
||||||
*/
|
|
||||||
#define xaccGUIDNew(guid,book) \
|
|
||||||
xaccGUIDNewEntityTable ((guid), qof_book_get_entity_table (book))
|
|
||||||
|
|
||||||
|
|
||||||
/* Lookup an entity given an id and a type. If there is no entity
|
/* Lookup an entity given an id and a type. If there is no entity
|
||||||
* associated with the id, or if it has a different type, NULL
|
* associated with the id, or if it has a different type, NULL
|
||||||
* is returned. */
|
* is returned. Input: GUID, returns reference (pointer) to object.
|
||||||
gpointer xaccLookupEntity (GNCEntityTable *entity_table,
|
*/
|
||||||
const GUID * guid, GNCIdType entity_type);
|
gpointer qof_entity_lookup (QofEntityTable *entity_table,
|
||||||
|
const GUID * guid, QofIdType entity_type);
|
||||||
|
|
||||||
/* Store the given entity under the given id with the given type. */
|
/* Store the given entity under the given id with the given type. */
|
||||||
void xaccStoreEntity (GNCEntityTable *entity_table,
|
void qof_entity_store (QofEntityTable *entity_table,
|
||||||
gpointer entity, const GUID * guid,
|
gpointer entity, const GUID * guid,
|
||||||
GNCIdType entity_type);
|
QofIdType entity_type);
|
||||||
|
|
||||||
/* Remove any existing association between an entity and the given
|
/* Remove any existing association between an entity and the given
|
||||||
* id. The entity is not changed in any way. */
|
* id. The entity is not changed in any way. */
|
||||||
void xaccRemoveEntity (GNCEntityTable *entity_table, const GUID * guid);
|
void qof_entity_remove (QofEntityTable *entity_table, const GUID * guid);
|
||||||
|
|
||||||
/* Call a function for each object of type 'type' in the entity table */
|
/* Call a function for each object of type 'type' in the entity table */
|
||||||
void xaccForeachEntity (GNCEntityTable *entity_table, GNCIdType type,
|
void qof_entity_foreach (QofEntityTable *entity_table, QofIdType type,
|
||||||
foreachObjectCB cb_func, gpointer user_data);
|
QofEntityForeachCB cb_func, gpointer user_data);
|
||||||
|
|
||||||
/* Initialize and shutdown the GNC Id system. */
|
#endif /* QOF_ID_P_H */
|
||||||
void xaccGUIDInit (void);
|
|
||||||
void xaccGUIDShutdown (void);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
* GNCId.c -- Gnucash entity identifier implementation *
|
* qofid.c -- QOF entity identifier implementation *
|
||||||
* Copyright (C) 2000 Dave Peticolas <dave@krondo.com> *
|
* Copyright (C) 2000 Dave Peticolas <dave@krondo.com> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* This program is free software; you can redistribute it and/or *
|
||||||
@ -26,69 +26,36 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "GNCId.h"
|
#include "qofid.h"
|
||||||
#include "GNCIdP.h"
|
#include "qofid-p.h"
|
||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
|
|
||||||
#define CACHE_INSERT(str) g_cache_insert(gnc_engine_get_string_cache(), (gpointer)(str));
|
#define CACHE_INSERT(str) g_cache_insert(gnc_engine_get_string_cache(), (gpointer)(str));
|
||||||
#define CACHE_REMOVE(str) g_cache_remove(gnc_engine_get_string_cache(), (gpointer)(str));
|
#define CACHE_REMOVE(str) g_cache_remove(gnc_engine_get_string_cache(), (gpointer)(str));
|
||||||
|
|
||||||
/** #defines ********************************************************/
|
/** #defines ********************************************************/
|
||||||
#define GNCID_DEBUG 0
|
#define QOFID_DEBUG 0
|
||||||
|
|
||||||
|
|
||||||
/** Type definitions ************************************************/
|
/** Type definitions ************************************************/
|
||||||
typedef struct entity_node
|
typedef struct entity_node
|
||||||
{
|
{
|
||||||
GNCIdType entity_type;
|
QofIdType entity_type;
|
||||||
gpointer entity;
|
gpointer entity;
|
||||||
} EntityNode;
|
} EntityNode;
|
||||||
|
|
||||||
struct gnc_entity_table
|
struct _QofEntityTable
|
||||||
{
|
{
|
||||||
GHashTable * hash;
|
GHashTable * hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** Static global variables *****************************************/
|
/** Static global variables *****************************************/
|
||||||
static GMemChunk *guid_memchunk = NULL;
|
|
||||||
static short module = MOD_ENGINE;
|
static short module = MOD_ENGINE;
|
||||||
|
|
||||||
|
|
||||||
/** Function implementations ****************************************/
|
/** Function implementations ****************************************/
|
||||||
|
|
||||||
void
|
|
||||||
xaccGUIDInit (void)
|
|
||||||
{
|
|
||||||
if (!guid_memchunk)
|
|
||||||
guid_memchunk = g_mem_chunk_create (GUID, 512, G_ALLOC_AND_FREE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
xaccGUIDShutdown (void)
|
|
||||||
{
|
|
||||||
if (guid_memchunk)
|
|
||||||
{
|
|
||||||
g_mem_chunk_destroy (guid_memchunk);
|
|
||||||
guid_memchunk = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GUID *
|
|
||||||
xaccGUIDMalloc (void)
|
|
||||||
{
|
|
||||||
return g_chunk_new (GUID, guid_memchunk);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
xaccGUIDFree (GUID *guid)
|
|
||||||
{
|
|
||||||
if (!guid)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_chunk_free (guid, guid_memchunk);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
entity_node_destroy(gpointer key, gpointer value, gpointer not_used)
|
entity_node_destroy(gpointer key, gpointer value, gpointer not_used)
|
||||||
{
|
{
|
||||||
@ -96,17 +63,17 @@ entity_node_destroy(gpointer key, gpointer value, gpointer not_used)
|
|||||||
EntityNode *e_node = value;
|
EntityNode *e_node = value;
|
||||||
|
|
||||||
CACHE_REMOVE (e_node->entity_type);
|
CACHE_REMOVE (e_node->entity_type);
|
||||||
e_node->entity_type = GNC_ID_NONE;
|
e_node->entity_type = QOF_ID_NONE;
|
||||||
e_node->entity = NULL;
|
e_node->entity = NULL;
|
||||||
|
|
||||||
xaccGUIDFree(guid);
|
guid_free(guid);
|
||||||
g_free(e_node);
|
g_free(e_node);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xaccEntityTableDestroy (GNCEntityTable *entity_table)
|
qof_entity_destroy (QofEntityTable *entity_table)
|
||||||
{
|
{
|
||||||
if (entity_table == NULL)
|
if (entity_table == NULL)
|
||||||
return;
|
return;
|
||||||
@ -152,7 +119,7 @@ id_compare(gconstpointer key_1, gconstpointer key_2)
|
|||||||
return guid_equal (key_1, key_2);
|
return guid_equal (key_1, key_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GNCID_DEBUG
|
#if QOFID_DEBUG
|
||||||
static void
|
static void
|
||||||
print_node(gpointer key, gpointer value, gpointer not_used)
|
print_node(gpointer key, gpointer value, gpointer not_used)
|
||||||
{
|
{
|
||||||
@ -164,48 +131,48 @@ print_node(gpointer key, gpointer value, gpointer not_used)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
summarize_table (GNCEntityTable *entity_table)
|
summarize_table (QofEntityTable *entity_table)
|
||||||
{
|
{
|
||||||
if (entity_table == NULL)
|
if (entity_table == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_hash_table_foreach (entity_table->hash, print_node, NULL);
|
g_hash_table_foreach (entity_table->hash, print_node, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* QOFID_DEBUG */
|
||||||
|
|
||||||
GNCEntityTable *
|
QofEntityTable *
|
||||||
xaccEntityTableNew (void)
|
qof_entity_new (void)
|
||||||
{
|
{
|
||||||
GNCEntityTable *entity_table;
|
QofEntityTable *entity_table;
|
||||||
|
|
||||||
entity_table = g_new0 (GNCEntityTable, 1);
|
entity_table = g_new0 (QofEntityTable, 1);
|
||||||
|
|
||||||
entity_table->hash = g_hash_table_new (id_hash, id_compare);
|
entity_table->hash = g_hash_table_new (id_hash, id_compare);
|
||||||
|
|
||||||
xaccStoreEntity (entity_table, NULL, xaccGUIDNULL(), GNC_ID_NULL);
|
qof_entity_store (entity_table, NULL, guid_null(), QOF_ID_NULL);
|
||||||
|
|
||||||
return entity_table;
|
return entity_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
GNCIdType
|
QofIdType
|
||||||
xaccGUIDTypeEntityTable (const GUID * guid, GNCEntityTable *entity_table)
|
qof_entity_type (QofEntityTable *entity_table, const GUID * guid)
|
||||||
{
|
{
|
||||||
EntityNode *e_node;
|
EntityNode *e_node;
|
||||||
|
|
||||||
if (guid == NULL)
|
if (guid == NULL)
|
||||||
return GNC_ID_NONE;
|
return QOF_ID_NONE;
|
||||||
|
|
||||||
g_return_val_if_fail (entity_table, GNC_ID_NONE);
|
g_return_val_if_fail (entity_table, QOF_ID_NONE);
|
||||||
|
|
||||||
e_node = g_hash_table_lookup (entity_table->hash, guid->data);
|
e_node = g_hash_table_lookup (entity_table->hash, guid->data);
|
||||||
if (e_node == NULL)
|
if (e_node == NULL)
|
||||||
return GNC_ID_NONE;
|
return QOF_ID_NONE;
|
||||||
|
|
||||||
return e_node->entity_type;
|
return e_node->entity_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xaccGUIDNewEntityTable (GUID *guid, GNCEntityTable *entity_table)
|
qof_entity_guid_new (QofEntityTable *entity_table, GUID *guid)
|
||||||
{
|
{
|
||||||
if (guid == NULL)
|
if (guid == NULL)
|
||||||
return;
|
return;
|
||||||
@ -216,35 +183,16 @@ xaccGUIDNewEntityTable (GUID *guid, GNCEntityTable *entity_table)
|
|||||||
{
|
{
|
||||||
guid_new(guid);
|
guid_new(guid);
|
||||||
|
|
||||||
if (xaccGUIDTypeEntityTable (guid, entity_table) == GNC_ID_NONE)
|
if (qof_entity_type (entity_table, guid) == QOF_ID_NONE)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
PWARN("duplicate id created, trying again");
|
PWARN("duplicate id created, trying again");
|
||||||
} while(1);
|
} while(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const GUID *
|
|
||||||
xaccGUIDNULL(void)
|
|
||||||
{
|
|
||||||
static int null_inited = (0 == 1);
|
|
||||||
static GUID null_guid;
|
|
||||||
|
|
||||||
if (!null_inited)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
|
||||||
null_guid.data[i] = 0;
|
|
||||||
|
|
||||||
null_inited = (0 == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return &null_guid;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpointer
|
gpointer
|
||||||
xaccLookupEntity (GNCEntityTable *entity_table,
|
qof_entity_lookup (QofEntityTable *entity_table,
|
||||||
const GUID * guid, GNCIdType entity_type)
|
const GUID * guid, QofIdType entity_type)
|
||||||
{
|
{
|
||||||
EntityNode *e_node;
|
EntityNode *e_node;
|
||||||
|
|
||||||
@ -264,8 +212,8 @@ xaccLookupEntity (GNCEntityTable *entity_table,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xaccStoreEntity (GNCEntityTable *entity_table, gpointer entity,
|
qof_entity_store (QofEntityTable *entity_table, gpointer entity,
|
||||||
const GUID * guid, GNCIdType entity_type)
|
const GUID * guid, QofIdType entity_type)
|
||||||
{
|
{
|
||||||
EntityNode *e_node;
|
EntityNode *e_node;
|
||||||
GUID *new_guid;
|
GUID *new_guid;
|
||||||
@ -277,15 +225,15 @@ xaccStoreEntity (GNCEntityTable *entity_table, gpointer entity,
|
|||||||
|
|
||||||
if (!entity_type) return;
|
if (!entity_type) return;
|
||||||
|
|
||||||
if (guid_equal(guid, xaccGUIDNULL())) return;
|
if (guid_equal(guid, guid_null())) return;
|
||||||
|
|
||||||
xaccRemoveEntity (entity_table, guid);
|
qof_entity_remove (entity_table, guid);
|
||||||
|
|
||||||
e_node = g_new(EntityNode, 1);
|
e_node = g_new(EntityNode, 1);
|
||||||
e_node->entity_type = CACHE_INSERT (entity_type);
|
e_node->entity_type = CACHE_INSERT (entity_type);
|
||||||
e_node->entity = entity;
|
e_node->entity = entity;
|
||||||
|
|
||||||
new_guid = xaccGUIDMalloc ();
|
new_guid = guid_malloc ();
|
||||||
|
|
||||||
if (!new_guid) return;
|
if (!new_guid) return;
|
||||||
|
|
||||||
@ -295,7 +243,7 @@ xaccStoreEntity (GNCEntityTable *entity_table, gpointer entity,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xaccRemoveEntity (GNCEntityTable *entity_table, const GUID * guid)
|
qof_entity_remove (QofEntityTable *entity_table, const GUID * guid)
|
||||||
{
|
{
|
||||||
EntityNode *e_node;
|
EntityNode *e_node;
|
||||||
gpointer old_guid;
|
gpointer old_guid;
|
||||||
@ -310,7 +258,7 @@ xaccRemoveEntity (GNCEntityTable *entity_table, const GUID * guid)
|
|||||||
{
|
{
|
||||||
e_node = node;
|
e_node = node;
|
||||||
|
|
||||||
if (!safe_strcmp (e_node->entity_type, GNC_ID_NULL))
|
if (!safe_strcmp (e_node->entity_type, QOF_ID_NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_hash_table_remove (entity_table->hash, old_guid);
|
g_hash_table_remove (entity_table->hash, old_guid);
|
||||||
@ -319,9 +267,9 @@ xaccRemoveEntity (GNCEntityTable *entity_table, const GUID * guid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct _iterate {
|
struct _iterate {
|
||||||
foreachObjectCB fcn;
|
QofEntityForeachCB fcn;
|
||||||
gpointer data;
|
gpointer data;
|
||||||
GNCIdType type;
|
QofIdType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void foreach_cb (gpointer key, gpointer item, gpointer arg)
|
static void foreach_cb (gpointer key, gpointer item, gpointer arg)
|
||||||
@ -335,8 +283,8 @@ static void foreach_cb (gpointer key, gpointer item, gpointer arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xaccForeachEntity (GNCEntityTable *entity_table, GNCIdType type,
|
qof_entity_foreach (QofEntityTable *entity_table, QofIdType type,
|
||||||
foreachObjectCB cb_func, gpointer user_data)
|
QofEntityForeachCB cb_func, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct _iterate iter;
|
struct _iterate iter;
|
||||||
|
|
77
src/engine/qofid.h
Normal file
77
src/engine/qofid.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/********************************************************************\
|
||||||
|
* qofid.h -- QOF entity type identification system *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation; either version 2 of *
|
||||||
|
* the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License*
|
||||||
|
* along with this program; if not, contact: *
|
||||||
|
* *
|
||||||
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||||
|
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||||
|
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||||
|
* *
|
||||||
|
\********************************************************************/
|
||||||
|
|
||||||
|
#ifndef QOF_ID_H
|
||||||
|
#define QOF_ID_H
|
||||||
|
|
||||||
|
/** @addtogroup Engine
|
||||||
|
@{ */
|
||||||
|
/** @file qofid.h
|
||||||
|
@brief QOF entity type identification system
|
||||||
|
@author Copyright (C) 2000 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||||
|
@author Copyright (C) 2003 Linas Vepstas <linas@linas.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** This file defines an API that adds types to the GUID's.
|
||||||
|
* GUID's with types cna be used to identify and reference
|
||||||
|
* typed entities.
|
||||||
|
*
|
||||||
|
* GUID Identifiers can be used to reference QOF Objects.
|
||||||
|
* Identifiers are globally-unique and permanent, i.e., once
|
||||||
|
* an entity has been assigned an identifier, it retains that same
|
||||||
|
* identifier for its lifetime.
|
||||||
|
*
|
||||||
|
* Identifiers can be encoded as hex strings.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "guid.h"
|
||||||
|
|
||||||
|
/** GUID Identifiers are 'typed' with strings. The native ids used
|
||||||
|
* by QOF are defined below. An id with type QOF_ID_NONE does not
|
||||||
|
* refer to any entity, although that may change (???). An id with
|
||||||
|
* type QOF_ID_NULL does not refer to any entity, and will never refer
|
||||||
|
* to any entity. An identifier with any other type may refer to an
|
||||||
|
* actual entity, but that is not guaranteed (??? Huh?). If an id
|
||||||
|
* does refer to an entity, the type of the entity will match the
|
||||||
|
* type of the identifier.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef const char * QofIdType;
|
||||||
|
typedef const char * QofIdTypeConst;
|
||||||
|
|
||||||
|
#define QOF_ID_NONE NULL
|
||||||
|
#define QOF_ID_BOOK "Book"
|
||||||
|
#define QOF_ID_NULL "null"
|
||||||
|
#define QOF_ID_SESSION "Session"
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _QofEntityTable QofEntityTable;
|
||||||
|
|
||||||
|
/** Return the type of the indicated guid */
|
||||||
|
QofIdType qof_entity_type (QofEntityTable *entity_table, const GUID * guid);
|
||||||
|
|
||||||
|
/* Callback type for qof_entity_foreach */
|
||||||
|
typedef void (*QofEntityForeachCB) (gpointer object, gpointer user_data);
|
||||||
|
|
||||||
|
#endif /* QOF_ID_H */
|
||||||
|
/** @} */
|
||||||
|
|
@ -106,8 +106,8 @@ void qof_object_foreach_type (QofForeachTypeCB cb, gpointer user_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qof_object_foreach (GNCIdTypeConst type_name, QofBook *book,
|
void qof_object_foreach (QofIdTypeConst type_name, QofBook *book,
|
||||||
foreachObjectCB cb, gpointer user_data)
|
QofEntityForeachCB cb, gpointer user_data)
|
||||||
{
|
{
|
||||||
const QofObject *obj;
|
const QofObject *obj;
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ void qof_object_foreach (GNCIdTypeConst type_name, QofBook *book,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
qof_object_printable (GNCIdTypeConst type_name, gpointer obj)
|
qof_object_printable (QofIdTypeConst type_name, gpointer obj)
|
||||||
{
|
{
|
||||||
const QofObject *b_obj;
|
const QofObject *b_obj;
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ qof_object_printable (GNCIdTypeConst type_name, gpointer obj)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * qof_object_get_type_label (GNCIdTypeConst type_name)
|
const char * qof_object_get_type_label (QofIdTypeConst type_name)
|
||||||
{
|
{
|
||||||
const QofObject *obj;
|
const QofObject *obj;
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ gboolean qof_object_register (const QofObject *object)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QofObject * qof_object_lookup (GNCIdTypeConst name)
|
const QofObject * qof_object_lookup (QofIdTypeConst name)
|
||||||
{
|
{
|
||||||
GList *iter;
|
GList *iter;
|
||||||
const QofObject *obj;
|
const QofObject *obj;
|
||||||
@ -224,7 +224,7 @@ const QofObject * qof_object_lookup (GNCIdTypeConst name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean qof_object_register_backend (GNCIdTypeConst type_name,
|
gboolean qof_object_register_backend (QofIdTypeConst type_name,
|
||||||
const char *backend_name,
|
const char *backend_name,
|
||||||
gpointer be_data)
|
gpointer be_data)
|
||||||
{
|
{
|
||||||
@ -250,7 +250,7 @@ gboolean qof_object_register_backend (GNCIdTypeConst type_name,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpointer qof_object_lookup_backend (GNCIdTypeConst type_name,
|
gpointer qof_object_lookup_backend (QofIdTypeConst type_name,
|
||||||
const char *backend_name)
|
const char *backend_name)
|
||||||
{
|
{
|
||||||
GHashTable *ht;
|
GHashTable *ht;
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#ifndef QOF_OBJECT_H_
|
#ifndef QOF_OBJECT_H_
|
||||||
#define QOF_OBJECT_H_
|
#define QOF_OBJECT_H_
|
||||||
|
|
||||||
#include "GNCId.h"
|
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
|
||||||
/* Defines the version of the core object object registration
|
/* Defines the version of the core object object registration
|
||||||
@ -40,14 +39,14 @@
|
|||||||
|
|
||||||
typedef struct _QofObject QofObject;
|
typedef struct _QofObject QofObject;
|
||||||
typedef void (*QofForeachTypeCB) (QofObject *type, gpointer user_data);
|
typedef void (*QofForeachTypeCB) (QofObject *type, gpointer user_data);
|
||||||
typedef void (*QofForeachBackendTypeCB) (GNCIdTypeConst type,
|
typedef void (*QofForeachBackendTypeCB) (QofIdTypeConst type,
|
||||||
gpointer backend_data,
|
gpointer backend_data,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
/* This is the Object Object descriptor */
|
/* This is the Object Object descriptor */
|
||||||
struct _QofObject {
|
struct _QofObject {
|
||||||
gint interface_version; /* of this object interface */
|
gint interface_version; /* of this object interface */
|
||||||
GNCIdType name; /* the Object's GNC_ID */
|
QofIdType name; /* the Object's GNC_ID */
|
||||||
const char * type_label; /* "Printable" type-label string */
|
const char * type_label; /* "Printable" type-label string */
|
||||||
|
|
||||||
/* book_begin is called from within the Book routines to create
|
/* book_begin is called from within the Book routines to create
|
||||||
@ -67,7 +66,7 @@ struct _QofObject {
|
|||||||
/* foreach() is used to execute a callback over each object
|
/* foreach() is used to execute a callback over each object
|
||||||
* stored in the particular book
|
* stored in the particular book
|
||||||
*/
|
*/
|
||||||
void (*foreach)(QofBook *, foreachObjectCB, gpointer);
|
void (*foreach)(QofBook *, QofEntityForeachCB, gpointer);
|
||||||
|
|
||||||
/* Given a particular object, return a printable string */
|
/* Given a particular object, return a printable string */
|
||||||
const char * (*printable)(gpointer obj);
|
const char * (*printable)(gpointer obj);
|
||||||
@ -76,10 +75,10 @@ struct _QofObject {
|
|||||||
|
|
||||||
void qof_object_foreach_type (QofForeachTypeCB cb, gpointer user_data);
|
void qof_object_foreach_type (QofForeachTypeCB cb, gpointer user_data);
|
||||||
|
|
||||||
void qof_object_foreach (GNCIdTypeConst type_name, QofBook *book,
|
void qof_object_foreach (QofIdTypeConst type_name, QofBook *book,
|
||||||
foreachObjectCB cb, gpointer user_data);
|
QofEntityForeachCB cb, gpointer user_data);
|
||||||
|
|
||||||
const char * qof_object_printable (GNCIdTypeConst type_name, gpointer obj);
|
const char * qof_object_printable (QofIdTypeConst type_name, gpointer obj);
|
||||||
|
|
||||||
|
|
||||||
/* REGISTRATION AND REG-LOOKUP FUNCTIONS */
|
/* REGISTRATION AND REG-LOOKUP FUNCTIONS */
|
||||||
@ -90,18 +89,18 @@ gboolean qof_object_register (const QofObject *object);
|
|||||||
/** Get the printable label for a type. This label is *not*
|
/** Get the printable label for a type. This label is *not*
|
||||||
* translated; you must use _() on it if you want a translated version.
|
* translated; you must use _() on it if you want a translated version.
|
||||||
*/
|
*/
|
||||||
const char * qof_object_get_type_label (GNCIdTypeConst type_name);
|
const char * qof_object_get_type_label (QofIdTypeConst type_name);
|
||||||
|
|
||||||
/** Lookup a object definition */
|
/** Lookup a object definition */
|
||||||
const QofObject * qof_object_lookup (GNCIdTypeConst type_name);
|
const QofObject * qof_object_lookup (QofIdTypeConst type_name);
|
||||||
|
|
||||||
|
|
||||||
/** Register and lookup backend-specific data for this particular object */
|
/** Register and lookup backend-specific data for this particular object */
|
||||||
gboolean qof_object_register_backend (GNCIdTypeConst type_name,
|
gboolean qof_object_register_backend (QofIdTypeConst type_name,
|
||||||
const char *backend_name,
|
const char *backend_name,
|
||||||
gpointer be_data);
|
gpointer be_data);
|
||||||
|
|
||||||
gpointer qof_object_lookup_backend (GNCIdTypeConst type_name,
|
gpointer qof_object_lookup_backend (QofIdTypeConst type_name,
|
||||||
const char *backend_name);
|
const char *backend_name);
|
||||||
|
|
||||||
void qof_object_foreach_backend (const char *backend_name,
|
void qof_object_foreach_backend (const char *backend_name,
|
||||||
|
@ -80,7 +80,7 @@ typedef struct _QofSortFunc
|
|||||||
struct _QofQuery
|
struct _QofQuery
|
||||||
{
|
{
|
||||||
/* The object type that we're searching for */
|
/* The object type that we're searching for */
|
||||||
GNCIdType search_for;
|
QofIdType search_for;
|
||||||
|
|
||||||
/* terms is a list of the OR-terms in a sum-of-products
|
/* terms is a list of the OR-terms in a sum-of-products
|
||||||
* logical expression. */
|
* logical expression. */
|
||||||
@ -402,7 +402,7 @@ check_object (QofQuery *q, gpointer object)
|
|||||||
*
|
*
|
||||||
* returns NULL if the first parameter is bad (and final is unchanged).
|
* returns NULL if the first parameter is bad (and final is unchanged).
|
||||||
*/
|
*/
|
||||||
static GSList * compile_params (GSList *param_list, GNCIdType start_obj,
|
static GSList * compile_params (GSList *param_list, QofIdType start_obj,
|
||||||
QofQueryObject const **final)
|
QofQueryObject const **final)
|
||||||
{
|
{
|
||||||
const QofQueryObject *objDef = NULL;
|
const QofQueryObject *objDef = NULL;
|
||||||
@ -413,7 +413,7 @@ static GSList * compile_params (GSList *param_list, GNCIdType start_obj,
|
|||||||
g_return_val_if_fail (final, NULL);
|
g_return_val_if_fail (final, NULL);
|
||||||
|
|
||||||
for (; param_list; param_list = param_list->next) {
|
for (; param_list; param_list = param_list->next) {
|
||||||
GNCIdType param_name = param_list->data;
|
QofIdType param_name = param_list->data;
|
||||||
objDef = qof_query_object_get_parameter (start_obj, param_name);
|
objDef = qof_query_object_get_parameter (start_obj, param_name);
|
||||||
|
|
||||||
/* If it doesn't exist, then we've reached the end */
|
/* If it doesn't exist, then we've reached the end */
|
||||||
@ -427,14 +427,14 @@ static GSList * compile_params (GSList *param_list, GNCIdType start_obj,
|
|||||||
*final = objDef;
|
*final = objDef;
|
||||||
|
|
||||||
/* And reset for the next parameter */
|
/* And reset for the next parameter */
|
||||||
start_obj = (GNCIdType) objDef->param_type;
|
start_obj = (QofIdType) objDef->param_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (g_slist_reverse (fcns));
|
return (g_slist_reverse (fcns));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
compile_sort (QofQuerySort *sort, GNCIdType obj)
|
compile_sort (QofQuerySort *sort, QofIdType obj)
|
||||||
{
|
{
|
||||||
const QofQueryObject *resObj = NULL;
|
const QofQueryObject *resObj = NULL;
|
||||||
|
|
||||||
@ -789,18 +789,18 @@ QofQuery * qof_query_create (void)
|
|||||||
return qp;
|
return qp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qof_query_search_for (QofQuery *q, GNCIdTypeConst obj_type)
|
void qof_query_search_for (QofQuery *q, QofIdTypeConst obj_type)
|
||||||
{
|
{
|
||||||
if (!q || !obj_type)
|
if (!q || !obj_type)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (safe_strcmp (q->search_for, obj_type)) {
|
if (safe_strcmp (q->search_for, obj_type)) {
|
||||||
q->search_for = (GNCIdType) obj_type;
|
q->search_for = (QofIdType) obj_type;
|
||||||
q->changed = 1;
|
q->changed = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QofQuery * qof_query_create_for (GNCIdTypeConst obj_type)
|
QofQuery * qof_query_create_for (QofIdTypeConst obj_type)
|
||||||
{
|
{
|
||||||
QofQuery *q;
|
QofQuery *q;
|
||||||
if (!obj_type)
|
if (!obj_type)
|
||||||
@ -975,7 +975,7 @@ QofQuery * qof_query_merge(QofQuery *q1, QofQuery *q2, QofQueryOp op)
|
|||||||
QofQuery * i1, * i2;
|
QofQuery * i1, * i2;
|
||||||
QofQuery * t1, * t2;
|
QofQuery * t1, * t2;
|
||||||
GList * i, * j;
|
GList * i, * j;
|
||||||
GNCIdType search_for;
|
QofIdType search_for;
|
||||||
|
|
||||||
if(!q1 || !q2 ) return NULL;
|
if(!q1 || !q2 ) return NULL;
|
||||||
if (q1->search_for && q2->search_for)
|
if (q1->search_for && q2->search_for)
|
||||||
@ -1193,7 +1193,7 @@ int qof_query_get_max_results (QofQuery *q)
|
|||||||
return q->max_results;
|
return q->max_results;
|
||||||
}
|
}
|
||||||
|
|
||||||
GNCIdType qof_query_get_search_for (QofQuery *q)
|
QofIdType qof_query_get_search_for (QofQuery *q)
|
||||||
{
|
{
|
||||||
if (!q) return NULL;
|
if (!q) return NULL;
|
||||||
return q->search_for;
|
return q->search_for;
|
||||||
@ -1405,7 +1405,7 @@ qof_query_printOutput (GList * output)
|
|||||||
static GList *
|
static GList *
|
||||||
qof_query_printSearchFor (QofQuery * query, GList * output)
|
qof_query_printSearchFor (QofQuery * query, GList * output)
|
||||||
{
|
{
|
||||||
GNCIdType searchFor;
|
QofIdType searchFor;
|
||||||
GString *gs;
|
GString *gs;
|
||||||
|
|
||||||
searchFor = qof_query_get_search_for (query);
|
searchFor = qof_query_get_search_for (query);
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#ifndef QOF_QUERYNEW_H
|
#ifndef QOF_QUERYNEW_H
|
||||||
#define QOF_QUERYNEW_H
|
#define QOF_QUERYNEW_H
|
||||||
|
|
||||||
#include "GNCId.h"
|
#include "guid.h"
|
||||||
#include "qofquerycore.h"
|
#include "qofquerycore.h"
|
||||||
#include "qofbook.h"
|
#include "qofbook.h"
|
||||||
|
|
||||||
@ -64,11 +64,11 @@ GSList * qof_query_build_param_list (char const *param, ...);
|
|||||||
/** Create a new query. A Query MUST be set with a 'search-for' type.
|
/** Create a new query. A Query MUST be set with a 'search-for' type.
|
||||||
* you can create and set this value in one step or two */
|
* you can create and set this value in one step or two */
|
||||||
QofQuery * qof_query_create (void);
|
QofQuery * qof_query_create (void);
|
||||||
QofQuery * qof_query_create_for (GNCIdTypeConst obj_type);
|
QofQuery * qof_query_create_for (QofIdTypeConst obj_type);
|
||||||
void qof_query_destroy (QofQuery *q);
|
void qof_query_destroy (QofQuery *q);
|
||||||
|
|
||||||
/** Set the object type to be searched for */
|
/** Set the object type to be searched for */
|
||||||
void qof_query_search_for (QofQuery *query, GNCIdTypeConst obj_type);
|
void qof_query_search_for (QofQuery *query, QofIdTypeConst obj_type);
|
||||||
|
|
||||||
/** Set the book to be searched (you can search multiple books) */
|
/** Set the book to be searched (you can search multiple books) */
|
||||||
void qof_query_set_book (QofQuery *q, QofBook *book);
|
void qof_query_set_book (QofQuery *q, QofBook *book);
|
||||||
@ -162,7 +162,7 @@ gboolean qof_query_equal (QofQuery *q1, QofQuery *q2);
|
|||||||
void qof_query_print (QofQuery *query);
|
void qof_query_print (QofQuery *query);
|
||||||
|
|
||||||
/* Return the type of data we're querying for */
|
/* Return the type of data we're querying for */
|
||||||
GNCIdType qof_query_get_search_for (QofQuery *q);
|
QofIdType qof_query_get_search_for (QofQuery *q);
|
||||||
|
|
||||||
/* Return the list of books we're using */
|
/* Return the list of books we're using */
|
||||||
GList * qof_query_get_books (QofQuery *q);
|
GList * qof_query_get_books (QofQuery *q);
|
||||||
|
@ -612,7 +612,7 @@ static void guid_free_pdata (QofQueryPredData *pd)
|
|||||||
GList *node;
|
GList *node;
|
||||||
VERIFY_PDATA (query_guid_type);
|
VERIFY_PDATA (query_guid_type);
|
||||||
for (node = pdata->guids; node; node = node->next)
|
for (node = pdata->guids; node; node = node->next)
|
||||||
xaccGUIDFree (node->data);
|
guid_free (node->data);
|
||||||
g_list_free (pdata->guids);
|
g_list_free (pdata->guids);
|
||||||
g_free (pdata);
|
g_free (pdata);
|
||||||
}
|
}
|
||||||
@ -652,7 +652,7 @@ qof_query_guid_predicate (QofGuidMatch options, GList *guids)
|
|||||||
pdata->options = options;
|
pdata->options = options;
|
||||||
pdata->guids = g_list_copy (guids);
|
pdata->guids = g_list_copy (guids);
|
||||||
for (node = pdata->guids; node; node = node->next) {
|
for (node = pdata->guids; node; node = node->next) {
|
||||||
GUID *guid = xaccGUIDMalloc ();
|
GUID *guid = guid_malloc ();
|
||||||
*guid = *((GUID *)node->data);
|
*guid = *((GUID *)node->data);
|
||||||
node->data = guid;
|
node->data = guid;
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,11 @@
|
|||||||
#ifndef QOF_QUERYOBJECTP_H
|
#ifndef QOF_QUERYOBJECTP_H
|
||||||
#define QOF_QUERYOBJECTP_H
|
#define QOF_QUERYOBJECTP_H
|
||||||
|
|
||||||
#include "GNCId.h"
|
|
||||||
#include "qofqueryobject.h"
|
#include "qofqueryobject.h"
|
||||||
|
|
||||||
void qof_query_object_init(void);
|
void qof_query_object_init(void);
|
||||||
void qof_query_object_shutdown (void);
|
void qof_query_object_shutdown (void);
|
||||||
|
|
||||||
QofSortFunc qof_query_object_default_sort (GNCIdTypeConst obj_name);
|
QofSortFunc qof_query_object_default_sort (QofIdTypeConst obj_name);
|
||||||
|
|
||||||
#endif /* QOF_QUERYOBJECTP_H */
|
#endif /* QOF_QUERYOBJECTP_H */
|
||||||
|
@ -44,7 +44,7 @@ static gboolean clear_table (gpointer key, gpointer value, gpointer user_data)
|
|||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
/* PUBLISHED API FUNCTIONS */
|
/* PUBLISHED API FUNCTIONS */
|
||||||
|
|
||||||
void qof_query_object_register (GNCIdTypeConst obj_name,
|
void qof_query_object_register (QofIdTypeConst obj_name,
|
||||||
QofSortFunc default_sort_function,
|
QofSortFunc default_sort_function,
|
||||||
const QofQueryObject *params)
|
const QofQueryObject *params)
|
||||||
{
|
{
|
||||||
@ -92,7 +92,7 @@ void qof_query_object_shutdown (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const QofQueryObject * qof_query_object_get_parameter (GNCIdTypeConst obj_name,
|
const QofQueryObject * qof_query_object_get_parameter (QofIdTypeConst obj_name,
|
||||||
const char *parameter)
|
const char *parameter)
|
||||||
{
|
{
|
||||||
GHashTable *ht;
|
GHashTable *ht;
|
||||||
@ -108,7 +108,7 @@ const QofQueryObject * qof_query_object_get_parameter (GNCIdTypeConst obj_name,
|
|||||||
return (g_hash_table_lookup (ht, parameter));
|
return (g_hash_table_lookup (ht, parameter));
|
||||||
}
|
}
|
||||||
|
|
||||||
QofAccessFunc qof_query_object_get_parameter_getter (GNCIdTypeConst obj_name,
|
QofAccessFunc qof_query_object_get_parameter_getter (QofIdTypeConst obj_name,
|
||||||
const char *parameter)
|
const char *parameter)
|
||||||
{
|
{
|
||||||
const QofQueryObject *obj;
|
const QofQueryObject *obj;
|
||||||
@ -123,7 +123,7 @@ QofAccessFunc qof_query_object_get_parameter_getter (GNCIdTypeConst obj_name,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
QofQueryCoreType qof_query_object_parameter_type (GNCIdTypeConst obj_name,
|
QofQueryCoreType qof_query_object_parameter_type (QofIdTypeConst obj_name,
|
||||||
const char *param_name)
|
const char *param_name)
|
||||||
{
|
{
|
||||||
const QofQueryObject *obj;
|
const QofQueryObject *obj;
|
||||||
@ -137,7 +137,7 @@ QofQueryCoreType qof_query_object_parameter_type (GNCIdTypeConst obj_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
QofSortFunc
|
QofSortFunc
|
||||||
qof_query_object_default_sort (GNCIdTypeConst obj_name)
|
qof_query_object_default_sort (QofIdTypeConst obj_name)
|
||||||
{
|
{
|
||||||
if (!obj_name) return NULL;
|
if (!obj_name) return NULL;
|
||||||
return g_hash_table_lookup (sortTable, obj_name);
|
return g_hash_table_lookup (sortTable, obj_name);
|
||||||
|
@ -54,7 +54,7 @@ typedef int (*QofSortFunc)(gpointer, gpointer);
|
|||||||
* "converters" are NULL-terminated arrays of structures. Either
|
* "converters" are NULL-terminated arrays of structures. Either
|
||||||
* argument may be NULL if there is nothing to be registered.
|
* argument may be NULL if there is nothing to be registered.
|
||||||
*/
|
*/
|
||||||
void qof_query_object_register (GNCIdTypeConst obj_name,
|
void qof_query_object_register (QofIdTypeConst obj_name,
|
||||||
QofSortFunc default_sort_fcn,
|
QofSortFunc default_sort_fcn,
|
||||||
const QofQueryObject *params);
|
const QofQueryObject *params);
|
||||||
|
|
||||||
@ -79,15 +79,15 @@ void qof_query_object_register (GNCIdTypeConst obj_name,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/** Return the core datatype of the specified object's parameter */
|
/** Return the core datatype of the specified object's parameter */
|
||||||
QofQueryCoreType qof_query_object_parameter_type (GNCIdTypeConst obj_name,
|
QofQueryCoreType qof_query_object_parameter_type (QofIdTypeConst obj_name,
|
||||||
const char *param_name);
|
const char *param_name);
|
||||||
|
|
||||||
/** Return the registered Object Definition for the requested parameter */
|
/** Return the registered Object Definition for the requested parameter */
|
||||||
const QofQueryObject * qof_query_object_get_parameter (GNCIdTypeConst obj_name,
|
const QofQueryObject * qof_query_object_get_parameter (QofIdTypeConst obj_name,
|
||||||
const char *parameter);
|
const char *parameter);
|
||||||
|
|
||||||
/** Return the object's parameter getter function */
|
/** Return the object's parameter getter function */
|
||||||
QofAccessFunc qof_query_object_get_parameter_getter (GNCIdTypeConst obj_name,
|
QofAccessFunc qof_query_object_get_parameter_getter (QofIdTypeConst obj_name,
|
||||||
const char *parameter);
|
const char *parameter);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1265,7 +1265,7 @@ free_random_kvp_path (GSList *path)
|
|||||||
g_slist_free (path);
|
g_slist_free (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GNCIdType
|
static QofIdType
|
||||||
get_random_id_type (void)
|
get_random_id_type (void)
|
||||||
{
|
{
|
||||||
switch (get_random_int_in_range (1,3)) {
|
switch (get_random_int_in_range (1,3)) {
|
||||||
@ -1621,7 +1621,7 @@ make_random_changes_to_session (GNCSession *session)
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GNCIdType where;
|
QofIdType where;
|
||||||
GSList *path;
|
GSList *path;
|
||||||
Query *q;
|
Query *q;
|
||||||
} KVPQueryData;
|
} KVPQueryData;
|
||||||
@ -1648,7 +1648,7 @@ add_kvp_value_query (const char *key, kvp_value *value, gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_kvp_query (Query *q, kvp_frame *frame, GNCIdType where)
|
add_kvp_query (Query *q, kvp_frame *frame, QofIdType where)
|
||||||
{
|
{
|
||||||
KVPQueryData kqd;
|
KVPQueryData kqd;
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include "test-stuff.h"
|
#include "test-stuff.h"
|
||||||
#include "FreqSpec.h"
|
#include "FreqSpec.h"
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-module.h"
|
#include "gnc-module.h"
|
||||||
#include "gnc-book.h"
|
#include "gnc-book.h"
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "GroupP.h"
|
#include "GroupP.h"
|
||||||
#include "GNCIdP.h"
|
|
||||||
#include "TransLog.h"
|
#include "TransLog.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
#include "gnc-module.h"
|
#include "gnc-module.h"
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#define TEST_MODULE_NAME "object-test"
|
#define TEST_MODULE_NAME "object-test"
|
||||||
#define TEST_MODULE_DESC "Test Object"
|
#define TEST_MODULE_DESC "Test Object"
|
||||||
|
|
||||||
static void foreach (QofBook *, foreachObjectCB, gpointer);
|
static void foreach (QofBook *, QofEntityForeachCB, gpointer);
|
||||||
static const char * printable (gpointer obj);
|
static const char * printable (gpointer obj);
|
||||||
static void test_printable (const char *name, gpointer obj);
|
static void test_printable (const char *name, gpointer obj);
|
||||||
static void test_foreach (QofBook *, const char *);
|
static void test_foreach (QofBook *, const char *);
|
||||||
@ -52,7 +52,7 @@ static void test_object (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
foreach (QofBook *book, foreachObjectCB cb, gpointer u_d)
|
foreach (QofBook *book, QofEntityForeachCB cb, gpointer u_d)
|
||||||
{
|
{
|
||||||
int *foo = u_d;
|
int *foo = u_d;
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <libguile.h>
|
#include <libguile.h>
|
||||||
|
|
||||||
#include "GNCIdP.h"
|
|
||||||
|
|
||||||
#include "AccountP.h"
|
#include "AccountP.h"
|
||||||
#include "TransLog.h"
|
#include "TransLog.h"
|
||||||
#include "gnc-engine.h"
|
#include "gnc-engine.h"
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
#include <libguile.h>
|
#include <libguile.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "GNCIdP.h"
|
|
||||||
|
|
||||||
#include "Account.h"
|
#include "Account.h"
|
||||||
#include "TransLog.h"
|
#include "TransLog.h"
|
||||||
#include "Transaction.h"
|
#include "Transaction.h"
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
#include <libguile.h>
|
#include <libguile.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "GNCIdP.h"
|
|
||||||
|
|
||||||
#include "Account.h"
|
#include "Account.h"
|
||||||
#include "TransLog.h"
|
#include "TransLog.h"
|
||||||
#include "Transaction.h"
|
#include "Transaction.h"
|
||||||
|
@ -159,12 +159,24 @@ foreach (@files)
|
|||||||
# s/gncQueryObjectShutdown/qof_query_object_shutdown/g;
|
# s/gncQueryObjectShutdown/qof_query_object_shutdown/g;
|
||||||
# s/gncQueryObjectDefaultSort/qof_query_object_default_sort/g;
|
# s/gncQueryObjectDefaultSort/qof_query_object_default_sort/g;
|
||||||
|
|
||||||
s/QofQueryAccessFunc/QofAccessFunc/g;
|
# s/xaccGUIDNULL/guid_null/g;
|
||||||
s/QofQueryAccess/QofAccessFunc/g;
|
# s/xaccGUIDMalloc/guid_malloc/g;
|
||||||
s/QofQueryCompareFunc/QofCompareFunc/g;
|
# s/xaccGUIDFree/guid_free/g;
|
||||||
s/QofQueryCompare/QofCompareFunc/g;
|
|
||||||
s/QofQuerySortFunc/QofSortFunc/g;
|
# s/GNCIdTypeConst/QofIdTypeConst/g;
|
||||||
s/QofQuerySort/QofSortFunc/g;
|
# s/GNCIdType/QofIdType/g;
|
||||||
|
# s/GNCEntityTable/QofEntityTable/g;
|
||||||
|
# s/xaccGUIDTypeEntityTable/qof_guid_type/g;
|
||||||
|
|
||||||
|
# s/xaccEntityTableNew/qof_entity_new/g;
|
||||||
|
# s/xaccEntityTableDestroy/qof_entity_destroy/g;
|
||||||
|
# s/xaccGUIDNewEntityTable/qof_entity_guid_new/g;
|
||||||
|
# s/xaccLookupEntity/qof_entity_lookup/g;
|
||||||
|
# s/xaccStoreEntity/qof_entity_store/g;
|
||||||
|
# s/xaccRemoveEntity/qof_entity_remove/g;
|
||||||
|
# s/xaccForeachEntity/qof_entity_foreach/g;
|
||||||
|
|
||||||
|
s/foreachObjectCB/QofEntityForeachCB/g;
|
||||||
|
|
||||||
print OF $_;
|
print OF $_;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user