QOF 0.7.5
|
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 #define QOF_MOD_MERGE "qof-merge" 00028 00081 #include "qofutil.h" 00082 #include "qofbook.h" 00083 #include "qofclass.h" 00084 #include "qofobject.h" 00085 #include "qofinstance.h" 00086 #include "qoflog.h" 00087 00125 typedef enum 00126 { 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 *qof_book_merge_init (QofBook * importBook, 00275 QofBook * targetBook); 00276 00277 00321 typedef void (*QofBookMergeRuleForeachCB) (QofBookMergeData *, 00322 QofBookMergeRule *, guint); 00323 00348 void qof_book_merge_rule_foreach (QofBookMergeData * mergeData, 00349 QofBookMergeRuleForeachCB callback, 00350 QofBookMergeResult mergeResult); 00351 00366 gchar *qof_book_merge_param_as_string (QofParam * qtparam, QofEntity * qtEnt); 00367 00447 QofBookMergeData *qof_book_merge_update_result (QofBookMergeData * mergeData, 00448 QofBookMergeResult tag); 00449 00483 gint qof_book_merge_commit (QofBookMergeData * mergeData); 00484 00492 void qof_book_merge_abort (QofBookMergeData * mergeData); 00493 00494 #endif // QOFBOOKMERGE_H 00495