QOF: qofbookmerge.h Source File

QOF 0.7.5

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

qofbookmerge.h
Go to the documentation of this file.
1 /*********************************************************************
2 * qofbookmerge.h -- api for QofBook merge with collision handling *
3 * Copyright (C) 2004 Neil Williams <linux@codehelp.co.uk> *
4 * *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License as *
7 * published by the Free Software Foundation; either version 2 of *
8 * the License, or (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, contact: *
17 * *
18 * Free Software Foundation Voice: +1-617-542-5942 *
19 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
20 * Boston, MA 02110-1301, USA gnu@gnu.org *
21 * *
22 ********************************************************************/
23
24 #ifndef QOFBOOKMERGE_H
25 #define QOFBOOKMERGE_H
26
27 #define QOF_MOD_MERGE "qof-merge"
28
81 #include "qofutil.h"
82 #include "qofbook.h"
83 #include "qofclass.h"
84 #include "qofobject.h"
85 #include "qofinstance.h"
86 #include "qoflog.h"
87
125 typedef enum
126 {
127 MERGE_UNDEF,
128 MERGE_ABSOLUTE,
129 MERGE_NEW,
131 MERGE_REPORT,
132 MERGE_DUPLICATE,
134 MERGE_UPDATE,
136 MERGE_INVALID
138 } QofBookMergeResult;
139
164 typedef struct
165 {
166 /* internal counters and reference variables */
167 gboolean mergeAbsolute;
169 double difference;
171 gboolean updated;
173 /* rule objects set from or by external calls */
174 QofIdType mergeType;
176 const gchar *mergeLabel;
178 GSList *mergeParam;
179 GSList *linkedEntList;
188 QofBookMergeResult mergeResult;
189 QofEntity *importEnt;
190 QofEntity *targetEnt;
192 } QofBookMergeRule;
193
194
209 typedef struct
210 {
211 GSList *mergeObjectParams;
213 GList *mergeList;
215 GSList *targetList;
217 QofBook *mergeBook;
219 QofBook *targetBook;
221 gboolean abort;
222 QofBookMergeRule *currentRule;
224 GSList *orphan_list;
232 GHashTable *target_table;
235 } QofBookMergeData;
236
237
238 /* ======================================================================== */
274 QofBookMergeData *qof_book_merge_init (QofBook * importBook,
275 QofBook * targetBook);
276
277
321 typedef void (*QofBookMergeRuleForeachCB) (QofBookMergeData *,
322 QofBookMergeRule *, guint);
323
348 void qof_book_merge_rule_foreach (QofBookMergeData * mergeData,
349 QofBookMergeRuleForeachCB callback,
350 QofBookMergeResult mergeResult);
351
366 gchar *qof_book_merge_param_as_string (QofParam * qtparam, QofEntity * qtEnt);
367
447 QofBookMergeData *qof_book_merge_update_result (QofBookMergeData * mergeData,
448 QofBookMergeResult tag);
449
483 gint qof_book_merge_commit (QofBookMergeData * mergeData);
484
492 void qof_book_merge_abort (QofBookMergeData * mergeData);
493
494 #endif // QOFBOOKMERGE_H
495
QofBookMergeRule::mergeLabel
const gchar * mergeLabel
Definition: qofbookmerge.h:176
QofBookMergeData::mergeList
GList * mergeList
Definition: qofbookmerge.h:213
QofBookMergeData::mergeBook
QofBook * mergeBook
Definition: qofbookmerge.h:217
QofIdType
const gchar * QofIdType
Definition: qofid.h:81
_QofParam
Definition: qofclass.h:195
qof_book_merge_commit
gint qof_book_merge_commit(QofBookMergeData *mergeData)
Commits the import data to the target book.
Definition: qofbookmerge.c:1164
qofobject.h
the Core Object Description Interface
QofEntity_s
Definition: qofid.h:147
MERGE_INVALID
Definition: qofbookmerge.h:136
qofinstance.h
Object instance holds common fields that most QofObjects use.
qof_book_merge_param_as_string
gchar * qof_book_merge_param_as_string(QofParam *qtparam, QofEntity *qtEnt)
provides easy string access to parameter data for dialogue use
Definition: qofbookmerge.c:1010
MERGE_NEW
Definition: qofbookmerge.h:129
QofBookMergeRule::mergeType
QofIdType mergeType
Definition: qofbookmerge.h:174
QofBookMergeRule::mergeParam
GSList * mergeParam
Definition: qofbookmerge.h:178
QofBookMergeRule::importEnt
QofEntity * importEnt
Definition: qofbookmerge.h:189
qoflog.h
QOF error logging and tracing facility.
MERGE_DUPLICATE
Definition: qofbookmerge.h:132
QofBookMergeData::target_table
GHashTable * target_table
Definition: qofbookmerge.h:232
QofBookMergeRule::mergeResult
QofBookMergeResult mergeResult
Definition: qofbookmerge.h:188
QofBookMergeRule::linkedEntList
GSList * linkedEntList
Definition: qofbookmerge.h:179
qof_book_merge_rule_foreach
void qof_book_merge_rule_foreach(QofBookMergeData *mergeData, QofBookMergeRuleForeachCB callback, QofBookMergeResult mergeResult)
Dialogue Control Callback.
Definition: qofbookmerge.c:1216
MERGE_UPDATE
Definition: qofbookmerge.h:134
QofBookMergeRule
One rule per entity, built into a single GList for the entire merge.
Definition: qofbookmerge.h:164
QofBookMergeData::abort
gboolean abort
Definition: qofbookmerge.h:221
MERGE_ABSOLUTE
Definition: qofbookmerge.h:128
QofBookMergeRule::difference
double difference
Definition: qofbookmerge.h:169
MERGE_UNDEF
Definition: qofbookmerge.h:127
qof_book_merge_init
QofBookMergeData * qof_book_merge_init(QofBook *importBook, QofBook *targetBook)
Initialise the QofBookMerge process.
Definition: qofbookmerge.c:933
QofBookMergeRule::mergeAbsolute
gboolean mergeAbsolute
Definition: qofbookmerge.h:167
qofbook.h
Encapsulate all the information about a dataset.
QofBookMergeData::currentRule
QofBookMergeRule * currentRule
Definition: qofbookmerge.h:222
qofclass.h
API for registering paramters on objects.
QofBookMergeData::targetBook
QofBook * targetBook
Definition: qofbookmerge.h:219
QofBookMergeResult
QofBookMergeResult
Results of collisions and user resolution.
Definition: qofbookmerge.h:125
QofBookMergeRuleForeachCB
void(* QofBookMergeRuleForeachCB)(QofBookMergeData *, QofBookMergeRule *, guint)
Definition of the dialogue control callback routine.
Definition: qofbookmerge.h:321
qof_book_merge_abort
void qof_book_merge_abort(QofBookMergeData *mergeData)
Abort the merge and free all memory allocated by the merge.
Definition: qofbookmerge.c:970
QofBookMergeData::mergeObjectParams
GSList * mergeObjectParams
Definition: qofbookmerge.h:211
QofBookMergeRule::updated
gboolean updated
Definition: qofbookmerge.h:171
_QofBook
Definition: qofbook-p.h:48
qof_book_merge_update_result
QofBookMergeData * qof_book_merge_update_result(QofBookMergeData *mergeData, QofBookMergeResult tag)
called by dialogue callback to set the result of user intervention
Definition: qofbookmerge.c:1132
QofBookMergeData::orphan_list
GSList * orphan_list
Definition: qofbookmerge.h:224
MERGE_REPORT
Definition: qofbookmerge.h:131
QofBookMergeRule::targetEnt
QofEntity * targetEnt
Definition: qofbookmerge.h:190
qofutil.h
QOF utility functions.
QofBookMergeData::targetList
GSList * targetList
Definition: qofbookmerge.h:215
QofBookMergeData
mergeData contains the essential context data for any merge.
Definition: qofbookmerge.h:209