qofbook.h

Go to the documentation of this file.
00001 /********************************************************************\
00002  * qofbook.h -- Encapsulate all the information about a dataset.    *
00003  * This program is free software; you can redistribute it and/or    *
00004  * modify it under the terms of the GNU General Public License as   *
00005  * published by the Free Software Foundation; either version 2 of   *
00006  * the License, or (at your option) any later version.              *
00007  *                                                                  *
00008  * This program is distributed in the hope that it will be useful,  *
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00011  * GNU General Public License for more details.                     *
00012  *                                                                  *
00013  * You should have received a copy of the GNU General Public License*
00014  * along with this program; if not, contact:                        *
00015  *                                                                  *
00016  * Free Software Foundation           Voice:  +1-617-542-5942       *
00017  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
00018  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
00019  *                                                                  *
00020 \********************************************************************/
00040 #ifndef QOF_BOOK_H
00041 #define QOF_BOOK_H
00042 
00043 #include "qofid.h"
00044 #include "kvp_frame.h"
00045 
00052 #define QOF_BOOK_LOOKUP_ENTITY(book,guid,e_type,c_type) ({  \
00053   QofEntity *val = NULL;                                    \
00054   if (guid && book) {                                       \
00055     QofCollection *col;                                     \
00056     col = qof_book_get_collection (book, e_type);           \
00057     val = qof_collection_lookup_entity (col, guid);         \
00058   }                                                         \
00059   (c_type *) val;                                           \
00060 })
00061 
00063 typedef struct _QofBook       QofBook;
00064 
00066 typedef GList                 QofBookList;
00067 
00068 typedef void (*QofBookFinalCB) (QofBook *, gpointer key, gpointer user_data);
00069 
00071 gboolean qof_book_register (void);
00072 
00075 QofBook * qof_book_new (void);
00076 
00079 void      qof_book_destroy (QofBook *book);
00080 
00086 void qof_book_mark_closed (QofBook *book);
00087 
00101 QofCollection  * qof_book_get_collection (QofBook *, QofIdType);
00102 
00104 typedef void (*QofCollectionForeachCB) (QofCollection *, gpointer user_data);
00105 void qof_book_foreach_collection (QofBook *, QofCollectionForeachCB, gpointer);
00106 
00114 #define qof_book_get_slots(book) qof_instance_get_slots(QOF_INSTANCE(book))
00115 
00126 void qof_book_set_data (QofBook *book, const gchar *key, gpointer data);
00127 
00132 void qof_book_set_data_fin (QofBook *book, const gchar *key, gpointer data, 
00133                             QofBookFinalCB);
00134 
00136 gpointer qof_book_get_data (QofBook *book, const gchar *key);
00137 
00139 gboolean qof_book_shutting_down (QofBook *book);
00140 
00149 gboolean qof_book_not_saved (QofBook *book);
00150 
00156 void qof_book_mark_saved(QofBook *book);
00157 
00160 void qof_book_kvp_changed (QofBook *book);
00161 
00165 gboolean qof_book_equal (QofBook *book_1, QofBook *book_2);
00166 
00170 gint64 qof_book_get_counter (QofBook *book, const char *counter_name);
00171 
00173 #define qof_book_get_guid(X) qof_entity_get_guid (QOF_ENTITY(X))
00174 
00175 #endif /* QOF_BOOK_H */
00176 

Generated on Fri May 12 18:00:32 2006 for QOF by  doxygen 1.4.4