Added links to the definitions in the Gedcom standard.
[gedcom-parse.git] / include / gom.h
1 /* External header for the Gedcom parser library.
2    Copyright (C) 2002 The Genes Development Team
3    This file is part of the Gedcom parser library.
4    Contributed by Peter Verthez <Peter.Verthez@advalvas.be>, 2002.
5
6    The Gedcom parser library is free software; you can redistribute it
7    and/or modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    The Gedcom parser library is distributed in the hope that it will be
12    useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public
17    License along with the Gedcom parser library; if not, write to the
18    Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19    02111-1307 USA.  */
20
21 /* $Id$ */
22 /* $Name$ */
23
24 #ifndef __GEDCOM_GOM_H
25 #define __GEDCOM_GOM_H
26
27 #include "gedcom.h"
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 /* Sub-structures */
34
35 struct user_data {
36   int level;
37   char *tag;
38   char *str_value;
39   struct xref_value *xref_value;
40   struct user_data *next;
41   struct user_data *previous;
42 };
43
44 struct address {                      /* ADDRESS_STRUCTURE */
45   char *full_label;                   /* ADDRESS_LINE */
46   char *line1;                        /* ADDRESS_LINE1 */
47   char *line2;                        /* ADDRESS_LINE2 */
48   char *city;                         /* ADDRESS_CITY */
49   char *state;                        /* ADDRESS_STATE */
50   char *postal;                       /* ADDRESS_POSTAL_CODE */
51   char *country;                      /* ADDRESS_COUNTRY */
52   struct user_data *extra;
53 };
54
55 struct text {
56   char *text;                         /* TEXT_FROM_SOURCE */
57   struct user_data *extra;
58   struct text *next;
59   struct text *previous;
60 };
61
62 struct source_citation {              /* SOURCE_CITATION */
63   char *description;                  /* SOURCE_DESCRIPTION */
64   struct xref_value *reference;
65   char *page;                         /* WHERE_WITHIN_SOURCE */
66   char *event;                        /* EVENT_TYPE_CITED_FROM */
67   char *role;                         /* ROLE_IN_EVENT */
68   struct date_value *date;            /* ENTRY_RECORDING_DATE */
69   struct text *text;
70   char *quality;                      /* CERTAINTY_ASSESSMENT */
71   struct multimedia_link *mm_link;
72   struct note_sub *note;
73   struct user_data *extra;
74   struct source_citation *next;
75   struct source_citation *previous;
76 };
77
78 struct note_sub {                     /* NOTE_STRUCTURE */
79   char *text;                         /* SUBMITTER_TEXT */
80   struct xref_value *reference;
81   struct source_citation *citation;
82   struct user_data *extra;
83   struct note_sub *next;
84   struct note_sub *previous;
85 };
86
87 struct place {                        /* PLACE_STRUCTURE */
88   char *value;                        /* PLACE_VALUE */
89   char *place_hierarchy;              /* PLACE_HIERARCHY */
90   struct user_data *extra;
91   struct source_citation *citation;
92   struct note_sub *note;
93 };
94
95 struct multimedia_link {              /* MULTIMEDIA_LINK */
96   struct xref_value *reference;
97   char *form;                         /* MULTIMEDIA_FORMAT */
98   char *title;                        /* DESCRIPTIVE_TITLE */
99   char *file;                         /* MULTIMEDIA_FILE_REFERENCE */
100   struct note_sub *note;
101   struct user_data *extra;
102   struct multimedia_link *next;
103   struct multimedia_link *previous;
104 };
105
106 struct lds_event {                    /* LDS_INDIVIDUAL_ORDINANCE */
107   char *date_status;                  /* LDS_BAPTISM_DATE_STATUS */
108   struct date_value *date;            /* DATE_LDS_ORD */
109   char *temple_code;                  /* TEMPLE_CODE */
110   char *place_living_ordinance;       /* PLACE_LIVING_ORDINANCE */
111   struct xref_value *family;
112   struct source_citation *citation;
113   struct note_sub *note;
114   struct user_data *extra;
115   struct lds_event *next;
116   struct lds_event *previous;
117 };
118
119 struct user_ref_number {
120   char *value;                        /* USER_REFERENCE_NUMBER */
121   char *type;                         /* USER_REFERENCE_TYPE */
122   struct user_data *extra;
123   struct user_ref_number *next;
124   struct user_ref_number *previous;
125 };
126
127 struct change_date {                  /* CHANGE_DATE_STRUCTURE */
128   struct date_value *date;            /* CHANGE_DATE */
129   char *time;                         /* TIME_VALUE */
130   struct note_sub *note;
131   struct user_data *extra;
132 };
133
134 struct event {                        /* FAMILY_EVENT_STRUCTURE */
135   int event;
136   char *event_name;
137   char *val;
138   char *type;                         /* EVENT_DESCRIPTOR */
139   struct date_value *date;            /* DATE_VALUE */
140   struct place *place;
141   struct address *address;
142   char *phone[3];                     /* PHONE_NUMBER */
143   struct age_value *age;              /* AGE_AT_EVENT */
144   char *agency;                       /* RESPONSIBLE_AGENCY */
145   char *cause;                        /* CAUSE_OF_EVENT */
146   struct source_citation *citation;
147   struct multimedia_link *mm_link;
148   struct note_sub *note;
149   struct age_value *husband_age;
150   struct age_value *wife_age;
151   struct xref_value *family;
152   char *adoption_parent;              /* ADOPTED_BY_WHICH_PARENT */
153   struct user_data *extra;
154   struct event *next;
155   struct event *previous;
156 };
157
158 struct xref_list {
159   struct xref_value *xref;
160   struct user_data *extra;
161   struct xref_list *next;
162   struct xref_list *previous;
163 };
164
165 struct personal_name {                /* PERSONAL_NAME_STRUCTURE */
166   char *name;                         /* NAME_PERSONAL */
167   char *prefix;                       /* NAME_PIECE_PREFIX */
168   char *given;                        /* NAME_PIECE_GIVEN */
169   char *nickname;                     /* NAME_PIECE_NICKNAME */
170   char *surname_prefix;               /* NAME_PIECE_SURNAME_PREFIX */
171   char *surname;                      /* NAME_PIECE_SURNAME */
172   char *suffix;                       /* NAME_PIECE_SUFFIX */
173   struct source_citation *citation;
174   struct note_sub *note;
175   struct user_data *extra;
176   struct personal_name *next;
177   struct personal_name *previous;
178 };
179
180 struct pedigree {
181   char *pedigree;                     /* PEDIGREE_LINKAGE_TYPE */
182   struct user_data *extra;
183   struct pedigree *next;
184   struct pedigree *previous;
185 };
186
187 struct family_link {                  /* CHILD_TO_FAMILY_LINK */
188   struct xref_value *family;
189   struct pedigree *pedigree;
190   struct note_sub *note;
191   struct user_data *extra;
192   struct family_link *next;
193   struct family_link *previous;
194 };
195
196 struct association {                  /* ASSOCIATION_STRUCTURE */
197   struct xref_value *to;
198   char *type;                         /* RECORD_TYPE */
199   char *relation;                     /* RELATION_IS_DESCRIPTOR */
200   struct source_citation *citation;
201   struct note_sub *note;
202   struct user_data *extra;
203   struct association *next;
204   struct association *previous;
205 };
206
207 struct source_event {
208   char *recorded_events;              /* EVENTS_RECORDED */
209   struct date_value *date_period;     /* DATE_PERIOD */
210   char *jurisdiction;                 /* SOURCE_JURISDICTION_PLACE */
211   struct user_data *extra;
212   struct source_event *next;
213   struct source_event *previous;
214 };
215
216 struct source_description {
217   char *call_number;                  /* SOURCE_CALL_NUMBER */
218   char *media;                        /* SOURCE_MEDIA_TYPE */
219   struct user_data *extra;
220   struct source_description *next;
221   struct source_description *previous;
222 };
223
224 /* Main structures */
225
226 struct header {                       /* HEADER */
227   struct header_source {
228     char *id;                         /* APPROVED_SYSTEM_ID */
229     char *name;                       /* NAME_OF_PRODUCT */
230     char *version;                    /* VERSION_NUMBER */
231     struct header_corporation {
232       char *name;                     /* NAME_OF_BUSINESS */
233       struct address *address;
234       char *phone[3];                 /* PHONE_NUMBER */
235     } corporation;
236     struct header_data {
237       char *name;                     /* NAME_OF_SOURCE_DATA */
238       struct date_value *date;        /* PUBLICATION_DATE */
239       char *copyright;                /* COPYRIGHT_SOURCE_DATA */
240     } data;
241   } source;
242   char *destination;                  /* RECEIVING_SYSTEM_NAME */
243   struct date_value *date;            /* TRANSMISSION_DATE */
244   char *time;                         /* TIME_VALUE */
245   struct xref_value *submitter;
246   struct xref_value *submission;
247   char *filename;                     /* FILE_NAME */
248   char *copyright;                    /* COPYRIGHT_GEDCOM_FILE */
249   struct header_gedcom {
250     char *version;                    /* VERSION_NUMBER */
251     char *form;                       /* GEDCOM_FORM */
252   } gedcom;
253   struct header_charset {
254     char *name;                       /* CHARACTER_SET */
255     char *version;                    /* VERSION_NUMBER */
256   } charset;
257   char *language;                     /* LANGUAGE_OF_TEXT */
258   char *place_hierarchy;              /* PLACE_HIERARCHY */
259   char *note;                         /* GEDCOM_CONTENT_DESCRIPTION */
260   struct user_data *extra;
261 };
262
263 struct submission {                   /* SUBMISSION_RECORD */
264   char *xrefstr;
265   struct xref_value *submitter;
266   char *family_file;                  /* NAME_OF_FAMILY_FILE */
267   char *temple_code;                  /* TEMPLE_CODE */
268   char *nr_of_ancestor_gens;          /* GENERATIONS_OF_ANCESTORS */
269   char *nr_of_descendant_gens;        /* GENERATIONS_OF_DESCENDANTS */
270   char *ordinance_process_flag;       /* ORDINANCE_PROCESS_FLAG */
271   char *record_id;                    /* AUTOMATED_RECORD_ID */
272   struct user_data *extra;
273 };
274
275 struct family {                       /* FAM_RECORD */
276   char *xrefstr;
277   struct event *event;
278   struct xref_value *husband;
279   struct xref_value *wife;
280   struct xref_list *children;
281   char *nr_of_children;               /* COUNT_OF_CHILDREN */
282   struct xref_list *submitters;
283   struct lds_event *lds_spouse_sealing;
284   struct source_citation *citation;
285   struct multimedia_link *mm_link;
286   struct note_sub *note;
287   struct user_ref_number *ref;
288   char *record_id;                    /* AUTOMATED_RECORD_ID */
289   struct change_date *change_date;
290   struct user_data *extra;
291   struct family *next;
292   struct family *previous;
293 };
294
295 struct individual {                   /* INDIVIDUAL_RECORD */
296   char *xrefstr;
297   char *restriction_notice;           /* RESTRICTION_NOTICE */
298   struct personal_name *name;
299   char *sex;                          /* SEX_VALUE */
300   struct event *event;
301   struct event *attribute;
302   struct lds_event *lds_individual_ordinance;
303   struct family_link *child_to_family;
304   struct family_link *spouse_to_family;
305   struct xref_list *submitters;
306   struct association *association;
307   struct xref_list *alias;
308   struct xref_list *ancestor_interest;
309   struct xref_list *descendant_interest;
310   struct source_citation *citation;
311   struct multimedia_link *mm_link;
312   struct note_sub *note;
313   char *record_file_nr;               /* PERMANENT_RECORD_FILE_NUMBER */
314   char *ancestral_file_nr;            /* ANCESTRAL_FILE_NUMBER */
315   struct user_ref_number *ref;
316   char *record_id;                    /* AUTOMATED_RECORD_ID */
317   struct change_date *change_date;
318   struct user_data *extra;
319   struct individual *next;
320   struct individual *previous;
321 };
322
323 struct multimedia {                   /* MULTIMEDIA_RECORD */
324   char *xrefstr;
325   char *form;                         /* MULTIMEDIA_FORMAT */
326   char *title;                        /* DESCRIPTIVE_TITLE */
327   struct note_sub *note;
328   char *data;                         /* ENCODED_MULTIMEDIA_LINE */
329   struct xref_value *continued;
330   struct user_ref_number *ref;
331   char *record_id;                    /* AUTOMATED_RECORD_ID */
332   struct change_date *change_date;
333   struct user_data *extra;
334   struct multimedia *next;
335   struct multimedia *previous;
336 };
337
338 struct note {                         /* NOTE_RECORD */
339   char *xrefstr;
340   char *text;                         /* SUBMITTER_TEXT */
341   struct source_citation *citation;
342   struct user_ref_number *ref;
343   char *record_id;                    /* AUTOMATED_RECORD_ID */
344   struct change_date *change_date;
345   struct user_data *extra;
346   struct note *next;
347   struct note *previous;
348 };
349
350 struct repository {                   /* REPOSITORY_RECORD */
351   char *xrefstr;
352   char *name;                         /* NAME_OF_REPOSITORY */
353   struct address *address;
354   char *phone[3];                     /* PHONE_NUMBER */
355   struct note_sub *note;
356   struct user_ref_number *ref;
357   char *record_id;                    /* AUTOMATED_RECORD_ID */
358   struct change_date *change_date;
359   struct user_data *extra;
360   struct repository *next;
361   struct repository *previous;
362 };
363
364 struct source {                       /* SOURCE_RECORD */
365   char *xrefstr;
366   struct source_data {
367     struct source_event *event;
368     char *agency;                     /* RESPONSIBLE_AGENCY */
369     struct note_sub *note;
370   } data;
371   char *author;                       /* SOURCE_ORIGINATOR */
372   char *title;                        /* SOURCE_DESCRIPTIVE_TITLE */
373   char *abbreviation;                 /* SOURCE_FILED_BY_ENTRY */
374   char *publication;                  /* SOURCE_PUBLICATION_FACTS */
375   char *text;                         /* TEXT_FROM_SOURCE */
376   struct repo_link {
377     struct xref_value *link;
378     struct note_sub *note;
379     struct source_description *description;
380   } repository;
381   struct multimedia_link *mm_link;
382   struct note_sub *note;
383   struct user_ref_number *ref;
384   char *record_id;                    /* AUTOMATED_RECORD_ID */
385   struct change_date *change_date;
386   struct user_data *extra;
387   struct source *next;
388   struct source *previous;
389 };
390
391 struct submitter {                    /* SUBMITTER_RECORD */
392   char *xrefstr;
393   char *name;                         /* SUBMITTER_NAME */
394   struct address *address;
395   char *phone[3];                     /* PHONE_NUMBER */
396   struct multimedia_link *mm_link;
397   char *language[3];                  /* LANGUAGE_PREFERENCE */
398   char *record_file_nr;               /* SUBMITTER_REGISTERED_RFN */
399   char *record_id;                    /* AUTOMATED_RECORD_ID */
400   struct change_date *change_date;
401   struct user_data *extra;
402   struct submitter *next;
403   struct submitter *previous;
404 };
405
406 struct user_rec {
407   char *xrefstr;
408   char *tag;
409   char *str_value;
410   struct xref_value *xref_value;
411   struct user_data *extra;
412   struct user_rec *next;
413   struct user_rec *previous;
414 };
415
416 /* Functions */
417
418 int  gom_parse_file(const char *file_name);
419 int  gom_new_model();
420
421 struct header*     gom_get_header();
422 struct submission* gom_get_submission();
423
424 struct family*     gom_get_first_family();
425 struct family*     gom_get_family_by_xref(const char *xref);
426
427 struct individual* gom_get_first_individual();
428 struct individual* gom_get_individual_by_xref(const char *xref);
429
430 struct multimedia* gom_get_first_multimedia();
431 struct multimedia* gom_get_multimedia_by_xref(const char *xref);
432
433 struct note*       gom_get_first_note();
434 struct note*       gom_get_note_by_xref(const char *xref);
435
436 struct repository* gom_get_first_repository();
437 struct repository* gom_get_repository_by_xref(const char *xref);
438
439 struct source*     gom_get_first_source();
440 struct source*     gom_get_source_by_xref(const char *xref);
441
442 struct submitter*  gom_get_first_submitter();
443 struct submitter*  gom_get_submitter_by_xref(const char *xref);
444
445 struct user_rec*   gom_get_first_user_rec();
446 struct user_rec*   gom_get_user_rec_by_xref(const char *xref);
447
448 char* gom_get_string(char* data);
449 char* gom_set_string(char** data, const char* utf8_value);
450
451 char* gom_get_string_locale(char* data, int* conversion_failures);
452 char* gom_set_string_locale(char** data, const char* locale_value);
453 void  gom_set_unknown(const char* unknown);
454
455 #ifdef __cplusplus
456 }
457 #endif
458
459 #endif /* __GEDCOM_GOM_H */