misc cleanup

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8564 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2003-06-11 00:43:28 +00:00
parent e2c669d2da
commit 4bc24127fc
11 changed files with 28 additions and 125 deletions

View File

@ -90,10 +90,8 @@ typedef enum {
} GNCBackendError;
/** \brief Pseudo-object providing an interface between the
* engine and a persistant data store
*
* (e.g. a server, a database, or
* a file).
* engine and a persistant data store (e.g. a server, a database,
* or a file).
*
* There are no backend functions that are 'public' to users of the
* engine. The backend can, however, report errors to the GUI & other

View File

@ -33,6 +33,7 @@
#include <glib.h>
#include "GNCId.h"
#include "gnc-book.h"
#include "gnc-engine.h"
/**

View File

@ -1279,21 +1279,6 @@ xaccGroupForEachAccount (AccountGroup *grp,
/* ============================================================== */
/* gncObject function implementation and registration */
static void
group_foreach (GNCBook *book, foreachObjectCB cb, gpointer ud)
{
// GNCEntityTable *et;
g_return_if_fail (book);
g_return_if_fail (cb);
printf ("duude calling group foreach \n");
/*
et = gnc_book_get_entity_table (book);
xaccForeachEntity (et, GNC_ID_GROUP, cb, ud);
*/
}
static void
group_book_begin (GNCBook *book)
{
@ -1327,7 +1312,7 @@ static GncObject_t group_object_def =
book_end: group_book_end,
is_dirty: group_is_dirty,
mark_clean: group_mark_clean,
foreach: group_foreach,
foreach: NULL,
printable: NULL,
};

View File

@ -25,14 +25,16 @@
#ifndef ENGINE_HELPERS_H
#define ENGINE_HELPERS_H
#include <gnc-engine.h>
#include <gnc-book.h>
#include <Transaction.h>
#include <Account.h>
#include <GNCId.h>
#include <Query.h>
#include <glib.h>
#include <libguile.h>
#include "gnc-engine.h"
#include "gnc-book.h"
#include "gnc-session.h"
#include "Account.h"
#include "GNCId.h"
#include "Query.h"
#include "Transaction.h"
#include "guile-mappings.h"
Timespec gnc_transaction_get_date_posted(Transaction *t);

View File

@ -33,7 +33,6 @@
#include "Backend.h"
#include "GNCIdP.h"
#include "gnc-book.h"
#include "gnc-engine.h"
#include "kvp_frame.h"
struct gnc_book_struct

View File

@ -20,8 +20,8 @@
/** @addtogroup Engine
@{ */
/** @file gnc-book.h
* @brief dataset access (set of accounting books)
* Encapsulate all the information about a gnucash dataset.
* @brief dataset access (an "accounting book")
* Encapsulate all the information about a dataset.
* See src/docs/books.txt for implementation overview.
*
* HISTORY:
@ -34,9 +34,14 @@
#define GNC_BOOK_H
#include "GNCId.h"
#include "gnc-engine.h"
#include "kvp_frame.h"
/** @brief Encapsulates all the information about a dataset
* manipulated by GnuCash. This is the top-most structure
* used for anchoring data.
*/
typedef struct gnc_book_struct GNCBook;
/** Allocate, initialise and return a new GNCBook. The new book will
contain a newly allocated AccountGroup */
GNCBook * gnc_book_new (void);

View File

@ -1101,21 +1101,6 @@ gnc_commodity_table_add_default_data(gnc_commodity_table *table)
********************************************************************/
/* gncObject function implementation and registration */
static void
commodity_table_foreach (GNCBook *book, foreachObjectCB cb, gpointer ud)
{
// GNCEntityTable *et;
g_return_if_fail (book);
g_return_if_fail (cb);
printf ("duude calling commodity_table foreach \n");
/*
et = gnc_book_get_entity_table (book);
xaccForeachEntity (et, GNC_ID_COMMODITY, cb, ud);
*/
}
static void
commodity_table_book_begin (GNCBook *book)
{
@ -1150,7 +1135,7 @@ static GncObject_t commodity_table_object_def =
book_end: commodity_table_book_end,
is_dirty: NULL,
mark_clean: NULL,
foreach: commodity_table_foreach,
foreach: NULL,
printable: NULL,
};

View File

@ -72,13 +72,6 @@ typedef struct split_s Split;
* through the functions in Transaction.h .*/
typedef struct transaction_s Transaction;
/** @brief Encapsulates all the information about a dataset
* manipulated by GnuCash.
*
* A GNCBook holds the actual data.
*/
typedef struct gnc_book_struct GNCBook;
/** @brief An article that is bought and sold.
*
* A Commodity is the most general term of what an account keeps track
@ -107,61 +100,6 @@ typedef struct gnc_commodity_table_s gnc_commodity_table;
*/
typedef struct gnc_lot_struct GNCLot;
/** @brief Encapsulates a connection to a GnuCash backend.
*
* A GNCSession manages the connection to a persistant data store,
* whereas the backend is the thing that performs the actual datastore
* access.
*
* This class provides several important services:
*
* 1) It resolves and loads the appropriate backend, based on
* the URL.
*
* 2) It reports backend errors (e.g. network errors, storage
* corruption errors) through a single, backend-independent
* API.
*
* 3) It reports non-error events received from the backend.
*
* 4) It helps manage global dataset locks. For example, for the
* file backend, the lock prevents multiple users from editing
* the same file at the same time, thus avoiding lost data due
* to race conditions. Thus, an open session implies that the
* associated file is locked.
*
* 5) Misc utilities, such as a search path for the file to be
* edited, and/or other URL resolution utilities. This should
* simplify install & maintenance problems for naive users who
* may not have a good grasp on what a file system is, or where
* they want to keep their data files.
*
* 6) In the future, this class is probably a good place to manage
* a portion of the user authentication process, and hold user
* credentials/cookies/keys/tokens. This is because at the
* coarsest level, authorization can happen at the datastore
* level: i.e. does this user even have the authority to connect
* to and open this datastore?
*
* A brief note about books & sessions: A GNCBook encapsulates the
* datasets manipulated by GnuCash. A GNCBook holds the actual data.
* By contrast, the session mediates the connection between a book
* (the thing that lives in virtual memory in the local process) and
* the datastore (the place where book data lives permanently, e.g.,
* file, database).
*
* In the current design, a session may hold multiple books. For
* now, exactly what this means is somewhat vague, and code in
* various places makes some implicit assumptions: first, only
* one book is 'current' and open for editing. Next, its assumed
* that all of the books in a session are related in some way.
* i.e. that they are all earlier accounting periods of the
* currently open book. In particular, the backends probably
* make that assumption, in order to store the different accounting
* periods in a clump so that one can be found, given another.
*/
typedef struct gnc_session_struct GNCSession;
/** GList of Account */
typedef GList AccountList;
/** GList of GNCBook */

View File

@ -106,4 +106,6 @@ void gnc_price_set_guid (GNCPrice *p, const GUID *guid);
/** register the pricedb object with the gncObject system */
gboolean gnc_pricedb_register (void);
Backend * xaccPriceDBGetBackend (GNCPriceDB *prdb);
#endif

View File

@ -1915,21 +1915,6 @@ gnc_pricedb_print_contents(GNCPriceDB *db, FILE *f)
/* ==================================================================== */
/* gncObject function implementation and registration */
static void
pricedb_foreach (GNCBook *book, foreachObjectCB cb, gpointer ud)
{
// GNCEntityTable *et;
g_return_if_fail (book);
g_return_if_fail (cb);
printf ("duude calling pricedb foreach \n");
/*
et = gnc_book_get_entity_table (book);
xaccForeachEntity (et, GNC_ID_PRICEDB, cb, ud);
*/
}
static void
pricedb_book_begin (GNCBook *book)
{
@ -1964,7 +1949,7 @@ static GncObject_t pricedb_object_def =
book_end: pricedb_book_end,
is_dirty: pricedb_is_dirty,
mark_clean: pricedb_mark_clean,
foreach: pricedb_foreach,
foreach: NULL,
printable: NULL,
};

View File

@ -21,6 +21,7 @@
\********************************************************************/
/** @file gnc-session.h
* @brief Encapsulates a connection to a backednd (persistent store)
*
* FUNCTION:
* Encapsulates a connection to a GnuCash backend. That is, it
@ -86,10 +87,12 @@
#define GNC_SESSION_H
#include "Backend.h"
#include "gnc-engine.h"
#include "gnc-book.h"
/* PROTOTYPES ******************************************************/
typedef struct gnc_session_struct GNCSession;
GNCSession * gnc_session_new (void);
void gnc_session_destroy (GNCSession *session);
GNCSession * gnc_get_current_session (void);