qofbookmerge.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  * qofbookmerge.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  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
00020  * Boston, MA  02110-1301,  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 
00082 #include "qofutil.h"
00083 #include "qofbook.h"
00084 #include "qofclass.h"
00085 #include "qofobject.h"
00086 #include "qofinstance.h"
00087 #include "qoflog.h"
00088 
00126 typedef enum { 
00127         MERGE_UNDEF,     
00128         MERGE_ABSOLUTE,  
00129         MERGE_NEW,       
00131         MERGE_REPORT,    
00132         MERGE_DUPLICATE, 
00134         MERGE_UPDATE,    
00136         MERGE_INVALID    
00138 }QofBookMergeResult;
00139 
00164 typedef struct 
00165 {
00166         /* internal counters and reference variables */
00167         gboolean mergeAbsolute;   
00169         double difference;       
00171         gboolean updated;        
00173         /* rule objects set from or by external calls */
00174         QofIdType mergeType;     
00176         const gchar* mergeLabel;  
00178         GSList *mergeParam;      
00179         GSList *linkedEntList;   
00188         QofBookMergeResult mergeResult; 
00189         QofEntity *importEnt;    
00190         QofEntity *targetEnt;    
00192 }QofBookMergeRule;
00193 
00194 
00209 typedef struct
00210 {
00211         GSList  *mergeObjectParams;  
00213         GList   *mergeList;          
00215         GSList  *targetList;         
00217         QofBook *mergeBook;          
00219         QofBook *targetBook;         
00221         gboolean abort;              
00222         QofBookMergeRule *currentRule; 
00224         GSList *orphan_list;         
00232         GHashTable *target_table;    
00235 }QofBookMergeData;
00236 
00237 
00238 /* ======================================================================== */
00274 QofBookMergeData*
00275 qof_book_merge_init( QofBook *importBook, QofBook *targetBook);
00276 
00277 
00321 typedef void (* QofBookMergeRuleForeachCB)( QofBookMergeData*, QofBookMergeRule*, guint);
00322 
00347 void qof_book_merge_rule_foreach( QofBookMergeData* mergeData,
00348                                 QofBookMergeRuleForeachCB callback , 
00349                                 QofBookMergeResult mergeResult);
00350 
00365 gchar* qof_book_merge_param_as_string(QofParam *qtparam, QofEntity *qtEnt);
00366 
00446 QofBookMergeData*
00447 qof_book_merge_update_result(QofBookMergeData *mergeData, QofBookMergeResult tag);
00448 
00482 gint
00483 qof_book_merge_commit(QofBookMergeData *mergeData );
00484 
00492 void
00493 qof_book_merge_abort(QofBookMergeData *mergeData);
00494 
00495 #endif // QOFBOOKMERGE_H
00496 

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