qof_book_merge.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  * qof_book_merge.h -- api for QofBook merge with collision handling *
00003  * Copyright (C) 2004 Neil Williams <linux@codehelp.co.uk>           *
00004  *                                                                   *
00005  * This program is free software; you can redistribute it and/or     *
00006  * modify it under the terms of the GNU General Public License as    *
00007  * published by the Free Software Foundation; either version 2 of    *
00008  * the License, or (at your option) any later version.               *
00009  *                                                                   *
00010  * This program is distributed in the hope that it will be useful,   *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of    *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     *
00013  * GNU General Public License for more details.                      *
00014  *                                                                   *
00015  * You should have received a copy of the GNU General Public License *
00016  * along with this program; if not, contact:                         *
00017  *                                                                   *
00018  * Free Software Foundation           Voice:  +1-617-542-5942        *
00019  * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652        *
00020  * Boston, MA  02111-1307,  USA       gnu@gnu.org                    *
00021  *                                                                   *
00022  ********************************************************************/
00023 
00024 #ifndef QOFBOOKMERGE_H
00025 #define QOFBOOKMERGE_H
00026 
00027 #ifndef _GNU_SOURCE
00028 #define _GNU_SOURCE
00029 #endif
00030 #define QOF_MOD_MERGE "qof-merge"
00031 
00079 #include <glib.h>
00080 #include "gnc-engine-util.h"
00081 #include "qofbook.h"
00082 #include "qofclass.h"
00083 #include "qofobject.h"
00084 #include "qofinstance.h"
00085 #include "gnc-trace.h"
00086 
00123 typedef enum { 
00124         MERGE_UNDEF,            
00125         MERGE_ABSOLUTE,         
00126         MERGE_NEW,       
00127         MERGE_REPORT,           
00128         MERGE_DUPLICATE, 
00129         MERGE_UPDATE,    
00131         MERGE_INVALID    
00133 }qof_book_mergeResult;
00134 
00157 typedef struct 
00158 {
00159         /* internal counters and reference variables */
00160         gboolean mergeAbsolute;                 
00161         double difference;                              
00162         gboolean updated;                               
00163         /* rule objects set from or by external calls */
00164         QofIdType mergeType;                    
00165         const char* mergeLabel;                 
00167         GSList *mergeParam;                             
00168         GSList *linkedEntList;                  
00176         qof_book_mergeResult mergeResult; 
00177         QofEntity *importEnt;                   
00178         QofEntity *targetEnt;                   
00179 }qof_book_mergeRule;
00180 
00181 
00195 typedef struct
00196 {
00197         GSList  *mergeObjectParams;     
00198         GList   *mergeList;                     
00199         GSList  *targetList;            
00200         QofBook *mergeBook;                     
00201         QofBook *targetBook;            
00202         gboolean abort;                         
00203         qof_book_mergeRule *currentRule; 
00204         GSList *orphan_list;                    
00211         GHashTable *target_table;       
00213 }qof_book_mergeData;
00214 
00215 
00216 /* ======================================================================== */
00248 qof_book_mergeData*
00249 qof_book_mergeInit( QofBook *importBook, QofBook *targetBook);
00250 
00251 
00292 typedef void (* qof_book_mergeRuleForeachCB)( qof_book_mergeData*, qof_book_mergeRule*, guint);
00293 
00317 void qof_book_mergeRuleForeach( qof_book_mergeData* mergeData,
00318                                 qof_book_mergeRuleForeachCB callback , 
00319                                 qof_book_mergeResult mergeResult);
00320 
00334 char* qof_book_merge_param_as_string(QofParam *qtparam, QofEntity *qtEnt);
00335 
00413 qof_book_mergeData*
00414 qof_book_mergeUpdateResult(qof_book_mergeData *mergeData, qof_book_mergeResult tag);
00415 
00416 
00447 int
00448 qof_book_mergeCommit( qof_book_mergeData *mergeData );
00449 
00457 void
00458 qof_book_merge_abort(qof_book_mergeData *mergeData);
00459 
00460 #endif // QOFBOOKMERGE_H
00461 

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