00001 /********************************************************************\ 00002 * qof-book-p.h -- private functions for QOF books. * 00003 * * 00004 * This program is free software; you can redistribute it and/or * 00005 * modify it under the terms of the GNU General Public License as * 00006 * published by the Free Software Foundation; either version 2 of * 00007 * the License, or (at your option) any later version. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU General Public License* 00015 * along with this program; if not, contact: * 00016 * * 00017 * Free Software Foundation Voice: +1-617-542-5942 * 00018 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 00019 * Boston, MA 02110-1301, USA gnu@gnu.org * 00020 * * 00021 \********************************************************************/ 00029 /* 00030 * HISTORY: 00031 * Created 2001 by Rob Browning 00032 * Copyright (c) 2001 Rob Browning 00033 * Copyright (c) 2001,2003 Linas Vepstas <linas@linas.org> 00034 */ 00035 00036 #ifndef QOF_BOOK_P_H 00037 #define QOF_BOOK_P_H 00038 00039 #include "kvp_frame.h" 00040 #include "qofbackend.h" 00041 #include "qofbook.h" 00042 #include "qofid.h" 00043 #include "qofid-p.h" 00044 #include "qofinstance-p.h" 00045 00046 /* Book structure */ 00047 struct _QofBook 00048 { 00049 QofInstance inst; /* Unique guid for this book. */ 00050 00051 /* The entity table associates the GUIDs of all the objects 00052 * belonging to this book, with their pointers to the respective 00053 * objects. This allows a lookup of objects based on thier guid. 00054 */ 00055 GHashTable * hash_of_collections; 00056 00057 /* In order to store arbitrary data, for extensibility, add a table 00058 * that will be used to hold arbitrary pointers. 00059 */ 00060 GHashTable *data_tables; 00061 00062 /* Hash table of destroy callbacks for the data table. */ 00063 GHashTable *data_table_finalizers; 00064 00065 /* state flag: 'y' means 'open for editing', 00066 * 'n' means 'book is closed' 00067 * xxxxx shouldn't this be replaced by the instance editlevel ??? 00068 */ 00069 char book_open; 00070 00071 /* a flag denoting whether the book is closing down, used to 00072 * help the QOF objects shut down cleanly without maintaining 00073 * internal consistency. 00074 * XXX shouldn't this be replaced by instance->do_free ??? 00075 */ 00076 gboolean shutting_down; 00077 00078 /* version number, used for tracking multiuser updates */ 00079 gint32 version; 00080 00081 /* To be technically correct, backends belong to sessions and 00082 * not books. So the pointer below "really shouldn't be here", 00083 * except that it provides a nice convenience, avoiding a lookup 00084 * from the session. Better solutions welcome ... */ 00085 QofBackend *backend; 00086 00087 /* -------------------------------------------------------------- */ 00088 /* Backend private expansion data */ 00089 guint32 idata; /* used by the sql backend for kvp management */ 00090 }; 00091 00092 /* 00093 * qof_book_set_backend() is used by backends to 00094 * initialize the pointers in the book structure to 00095 * something that contains actual data. These routines 00096 * should not be used otherwise. (Its somewhat questionable 00097 * if the backends should even be doing this much, but for 00098 * backwards compatibility, we leave these here.) 00099 */ 00100 void qof_book_set_backend (QofBook *book, QofBackend *be); 00101 00102 /* Register books with the engine */ 00103 gboolean qof_book_register (void); 00104 00107 #define qof_book_set_guid(book,guid) \ 00108 qof_entity_set_guid(QOF_ENTITY(book), guid) 00109 00110 /* @} */ 00111 /* @} */ 00112 /* @} */ 00113 #endif /* QOF_BOOK_P_H */