qofsession.h

Go to the documentation of this file.
00001 /********************************************************************\
00002  * qofsession.h -- session access (connection to backend)           *
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  * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       *
00019  * Boston, MA  02111-1307,  USA       gnu@gnu.org                   *
00020  *                                                                  *
00021 \********************************************************************/
00022 
00098 #ifndef QOF_SESSION_H
00099 #define QOF_SESSION_H
00100 
00101 #include "qofbackend.h"
00102 #include "qofbook.h"
00103 #include "qofclass.h"
00104 #include "qofobject.h"
00105 
00106 #define QOF_MOD_SESSION "qof-session"
00107 
00108 /* PROTOTYPES ******************************************************/
00109 
00110 typedef struct _QofSession    QofSession;
00111 
00112 QofSession * qof_session_new (void);
00113 void         qof_session_destroy (QofSession *session);
00114 QofSession * qof_session_get_current_session (void);
00115 void           qof_session_set_current_session (QofSession *session);
00116 
00120 void qof_session_swap_data (QofSession *session_1, QofSession *session_2);
00121 
00149 void qof_session_begin (QofSession *session, const char * book_id,
00150                          gboolean ignore_lock, gboolean create_if_nonexistent);
00151 
00152 
00166 typedef void (*QofPercentageFunc) (const char *message, double percent);
00167 void qof_session_load (QofSession *session,
00168                        QofPercentageFunc percentage_func);
00169 
00175 QofBackendError qof_session_get_error (QofSession *session);
00176 const char * qof_session_get_error_message(QofSession *session);
00177 
00188 QofBackendError qof_session_pop_error (QofSession *session);
00198 void qof_session_add_book (QofSession *session, QofBook *book);
00199 
00200 QofBook * qof_session_get_book (QofSession *session);
00201 
00216 const char * qof_session_get_file_path (QofSession *session);
00217 
00218 const char * qof_session_get_url (QofSession *session);
00219 
00224 gboolean qof_session_not_saved(QofSession *session);
00225 
00227 gboolean qof_session_save_may_clobber_data (QofSession *session);
00228 
00235 void     qof_session_save (QofSession *session,
00236                            QofPercentageFunc percentage_func);
00245 void     qof_session_end  (QofSession *session);
00246 
00294 gboolean qof_entity_copy_to_session(QofSession* new_session, QofEntity* original);
00295 
00314 gboolean qof_entity_copy_list(QofSession *new_session, GList *entity_list);
00315 
00329 gboolean qof_entity_copy_coll(QofSession *new_session, QofCollection *entity_coll);
00330 
00359 gboolean
00360 qof_entity_copy_coll_r(QofSession *new_session, QofCollection *coll);
00361 
00381 gboolean
00382 qof_entity_copy_one_r(QofSession *new_session, QofEntity *ent);
00383 
00417 typedef struct qof_entity_reference {
00418         QofIdType       choice_type;
00419         QofIdType        type;       
00420         GUID             *ref_guid;  
00421         const QofParam  *param;      
00422         const GUID      *ent_guid;   
00423 }QofEntityReference;
00424 
00452 QofEntityReference*
00453 qof_entity_get_reference_from(QofEntity *ent, const QofParam *param);
00454 
00462 void
00463 qof_session_update_reference_list(QofSession *session, QofEntityReference *reference);
00464 
00473 #define ENTITYREFERENCE "QofEntityReference"
00474 
00482 #define PARTIAL_QOFBOOK "PartialQofBook"
00483 
00502 #define QOF_STDOUT "file:"
00503 
00511 gboolean qof_session_events_pending (QofSession *session);
00512 
00517 gboolean qof_session_process_events (QofSession *session);
00526 void qof_session_add_close_hook (GFunc fn, gpointer data);
00527 
00532 void qof_session_call_close_hooks (QofSession *session);
00533 
00534 #endif /* QOF_SESSION_H */
00535 

Generated on Fri Oct 21 15:49:56 2005 for QOF by  doxygen 1.4.5