Gedcom_val
type of the xref
and
val
arguments in the record start and end callback.Record |
Meaning |
Possiblexref types |
Possible startval types | Possible endval types |
REC_HEAD |
The header of the GEDCOM file |
NULL |
NULL | NULL |
REC_FAM |
A record describing a family |
XREF_PTR(FAM) |
NULL | NULL |
REC_INDI |
A record describing an individual |
XREF_PTR(INDI) |
NULL | NULL |
REC_OBJE |
A record describing a multimedia object |
XREF_PTR(OBJE) |
NULL | NULL |
REC_NOTE |
A record describing a note |
XREF_PTR(NOTE) |
STRING | STRING |
REC_REPO |
A record describing a source repository |
XREF_PTR(REPO) |
NULL | NULL |
REC_SOUR |
A record describing a source |
XREF_PTR(SOUR) |
NULL | NULL |
REC_SUBN |
A record describing the submission |
XREF_PTR(SUBN) |
NULL | NULL |
REC_SUBM |
A record describing the submitter |
XREF_PTR(SUBM ) |
NULL | NULL |
REC_USER |
An application-specific record (the tag
in the start callback contains the actually used tag). |
NULL |
NULL | NULL |
Gedcom_val
type of the val
argument in the
element start and end callback.Element |
Possible tags |
Used within |
Possible startval types | Possible endval types |
ELT_HEAD_SOUR |
SOUR |
REC_HEAD |
STRING | NULL |
ELT_HEAD_SOUR_VERS |
VERS |
ELT_HEAD_SOUR |
STRING | NULL |
ELT_HEAD_SOUR_NAME |
NAME |
ELT_HEAD_SOUR |
STRING | NULL |
ELT_HEAD_SOUR_CORP |
CORP |
ELT_HEAD_SOUR |
STRING | NULL |
ELT_HEAD_SOUR_DATA |
DATA |
ELT_HEAD_SOUR |
STRING | NULL |
ELT_HEAD_SOUR_DATA_DATE |
DATE |
ELT_HEAD_SOUR_DATA |
DATE | NULL |
ELT_HEAD_SOUR_DATA_COPR |
COPR |
ELT_HEAD_SOUR_DATA |
STRING | NULL |
ELT_HEAD_DEST |
DEST |
REC_HEAD |
STRING | NULL |
ELT_HEAD_DATE |
DATE |
REC_HEAD |
DATE | NULL |
ELT_HEAD_DATE_TIME |
TIME |
ELT_HEAD_DATE |
STRING | NULL |
ELT_HEAD_SUBM |
SUBM |
REC_HEAD |
XREF_PTR(SUBM) | NULL |
ELT_HEAD_SUBN |
SUBN |
REC_HEAD |
XREF_PTR(SUBN) | NULL |
ELT_HEAD_FILE |
FILE |
REC_HEAD |
STRING | NULL |
ELT_HEAD_COPR |
COPR |
REC_HEAD |
STRING | NULL |
ELT_HEAD_GEDC |
GEDC |
REC_HEAD |
NULL | NULL |
ELT_HEAD_GEDC_VERS |
VERS |
ELT_HEAD_GEDC |
STRING | NULL |
ELT_HEAD_GEDC_FORM |
FORM |
ELT_HEAD_GEDC |
STRING | NULL |
ELT_HEAD_CHAR |
CHAR |
REC_HEAD |
STRING | NULL |
ELT_HEAD_CHAR_VERS |
VERS |
ELT_HEAD_CHAR |
STRING | NULL |
ELT_HEAD_LANG |
LANG |
REC_HEAD |
STRING | NULL |
ELT_HEAD_PLAC |
PLAC |
REC_HEAD |
NULL | NULL |
ELT_HEAD_PLAC_FORM |
FORM |
ELT_HEAD_PLAC |
STRING | NULL |
ELT_HEAD_NOTE |
NOTE |
REC_HEAD |
STRING | STRING |
ELT_FAM_HUSB |
HUSB |
REC_FAM |
XREF_PTR(INDI) | NULL |
ELT_FAM_WIFE |
WIFE |
REC_FAM |
XREF_PTR(INDI) | NULL |
ELT_FAM_CHIL |
CHIL |
REC_FAM |
XREF_PTR(INDI) | NULL |
ELT_FAM_NCHI |
NCHI |
REC_FAM |
STRING | NULL |
ELT_FAM_SUBM |
SUBM |
REC_FAM |
XREF_PTR(SUBM) | NULL |
ELT_INDI_RESN |
RES N |
REC_INDI |
STRING | NULL |
ELT_INDI_SEX |
SEX |
REC_INDI |
STRING | NULL |
ELT_INDI_SUBM |
SUBM |
REC_INDI |
XREF_PTR(SUBM) | NULL |
ELT_INDI_ALIA |
ALIA |
REC_INDI |
XREF_PTR(INDI) | NULL |
ELT_INDI_ANCI |
ANCI |
REC_INDI |
XREF_PTR(SUBM) | NULL |
ELT_INDI_DESI |
DESI |
REC_INDI |
XREF_PTR(SUBM) | NULL |
ELT_INDI_RFN |
RFN |
REC_INDI |
STRING | NULL |
ELT_INDI_AFN |
AFN |
REC_INDI |
STRING | NULL |
ELT_OBJE_FORM |
FORM |
REC_OBJE |
STRING | NULL |
ELT_OBJE_TITL |
TITL |
REC_OBJE |
STRING | NULL |
ELT_OBJE_BLOB |
BLOB |
REC_OBJE |
NULL | STRING |
ELT_OBJE_BLOB_CONT |
CONT |
ELT_OBJE_BLOB |
STRING | NULL |
ELT_OBJE_OBJE |
OBJE |
REC_OBJE |
XREF_PTR(OBJE) | NULL |
ELT_REPO_NAME |
NAME |
REC_REPO |
STRING | NULL |
ELT_SOUR_DATA |
DATA |
REC_SOUR |
NULL | NULL |
ELT_SOUR_DATA_EVEN |
EVEN |
ELT_SOUR_DATA |
STRING | NULL |
ELT_SOUR_DATA_EVEN_DATE |
DATE |
ELT_SOUR_DATA_EVEN |
DATE | NULL |
ELT_SOUR_DATA_EVEN_PLAC |
PLAC |
ELT_SOUR_DATA_EVEN |
STRING | NULL |
ELT_SOUR_DATA_AGNC |
AGNC |
ELT_SOUR_DATA |
STRING | NULL |
ELT_SOUR_AUTH |
AUTH |
REC_SOUR |
STRING | STRING |
ELT_SOUR_TITL |
TITL |
REC_SOUR |
STRING | STRING |
ELT_SOUR_ABBR |
ABBR |
REC_SOUR |
STRING | NULL |
ELT_SOUR_PUBL |
PUBL |
REC_SOUR |
STRING | STRING |
ELT_SOUR_TEXT |
TEXT |
REC_SOUR |
STRING | STRING |
ELT_SUBN_SUBM |
SUBM |
REC_SUBN |
XREF_PTR(SUBM) | NULL |
ELT_SUBN_FAMF |
FAMF |
REC_SUBN |
STRING | NULL |
ELT_SUBN_TEMP |
TEMP |
REC_SUBN |
STRING | NULL |
ELT_SUBN_ANCE |
ANCE |
REC_SUBN |
STRING | NULL |
ELT_SUBN_DESC |
DESC |
REC_SUBN |
STRING | NULL |
ELT_SUBN_ORDI |
ORDI |
REC_SUBN |
STRING | NULL |
ELT_SUBN_RIN |
RIN |
REC_SUBN |
STRING | NULL |
ELT_SUBM_NAME |
NAME |
REC_SUBM |
STRING | NULL |
ELT_SUBM_LANG |
LANG |
REC_SUBM |
STRING | NULL |
ELT_SUBM_RFN |
RFN |
REC_SUBM |
STRING | NULL |
ELT_SUBM_RIN |
RIN |
REC_SUBM |
STRING | NULL |
ELT_SUB_ADDR |
ADDR |
ELT_HEAD_SOUR_CORP, ELT_SUB_FAM_EVT ,ELT_SUB_FAM_EVT_EVEN, |
STRING | STRING |
ELT_SUB_ADDR_CONT |
CONT |
ELT_SUB_ADDR |
STRING | NULL |
ELT_SUB_ADDR_ADR1 |
ADR1 |
ELT_SUB_ADDR |
STRING | NULL |
ELT_SUB_ADDR_ADR2 |
ADR2 |
ELT_SUB_ADDR |
STRING | NULL |
ELT_SUB_ADDR_CITY |
CITY |
ELT_SUB_ADDR |
STRING | NULL |
ELT_SUB_ADDR_STAE |
STAE |
ELT_SUB_ADDR |
STRING | NULL |
ELT_SUB_ADDR_POST |
POST |
ELT_SUB_ADDR |
STRING | NULL |
ELT_SUB_ADDR_CTRY |
CTRY |
ELT_SUB_ADDR |
STRING | NULL |
ELT_SUB_PHON |
PHON |
ELT_HEAD_SOUR_CORP, ELT_SUB_FAM_EVT, ELT_SUB_FAM_EVT_EVEN, |
STRING | NULL |
ELT_SUB_ASSO |
ASSO |
REC_INDI |
XREF_PTR(FAM), | NULL |
ELT_SUB_ASSO_TYPE |
TYPE |
ELT_SUB_ASSO |
STRING | NULL |
ELT_SUB_ASSO_RELA |
RELA |
ELT_SUB_ASSO |
STRING | NULL |
ELT_SUB_CHAN |
CHAN |
REC_FAM, REC_INDI, |
NULL | NULL |
ELT_SUB_CHAN_DATE |
DATE |
ELT_SUB_CHAN |
DATE | NULL |
ELT_SUB_CHAN_TIME |
TIME |
ELT_SUB_CHAN_DATE |
STRING | NULL |
ELT_SUB_FAMC |
FAMC |
REC_INDI |
XREF_PTR(FAM) | NULL |
ELT_SUB_FAMC_PEDI |
PEDI |
ELT_SUB_FAMC |
STRING | NULL |
ELT_SUB_CONT |
CONT |
ELT_HEAD_NOTE, REC_NOTE, |
NULL | NULL |
ELT_SUB_CONC |
CONC |
ELT_HEAD_NOTE, REC_NOTE, |
STRING | NULL |
ELT_SUB_EVT_TYPE |
TYPE |
ELT_SUB_FAM_EVT, ELT_SUB_FAM_EVT_EVEN, |
STRING | NULL |
ELT_SUB_EVT_DATE |
DATE |
ELT_SUB_FAM_EVT ,ELT_SUB_FAM_EVT_EVEN, , |
DATE | NULL |
ELT_SUB_EVT_AGE |
AGE |
ELT_SUB_FAM_EVT, ELT_SUB_FAM_EVT_EVEN, , |
AGE | NULL |
ELT_SUB_EVT_AGNC |
AGNC |
ELT_SUB_FAM_EVT, ELT_SUB_FAM_EVT_EVEN, , |
STRING | NULL |
ELT_SUB_EVT_CAUS |
CAUS |
ELT_SUB_FAM_EVT, ELT_SUB_FAM_EVT_EVEN, , |
STRING | NULL |
ELT_SUB_FAM_EVT |
ANUL, CENS, DIV, |
REC_FAM |
NULL | NULL |
ELT_SUB_FAM_EVT_HUSB |
HUSB |
ELT_SUB_FAM_EVT ,ELT_SUB_FAM_EVT_EVEN |
NULL | NULL |
ELT_SUB_FAM_EVT_WIFE |
WIFE |
ELT_SUB_FAM_EVT ,ELT_SUB_FAM_EVT_EVEN |
NULL | NULL |
ELT_SUB_FAM_EVT_AGE |
AGE |
ELT_SUB_FAM_EVT_HUSB ,ELT_SUB_FAM_EVT_WIFE |
AGE | NULL |
ELT_SUB_FAM_EVT_EVEN |
EVEN |
REC_FAM |
NULL | NULL |
ELT_SUB_IDENT_REFN |
REFN |
REC_FAM, REC_INDI, |
STRING | NULL |
ELT_SUB_IDENT_REFN_TYPE |
TYPE |
ELT_SUB_IDENT_REFN |
STRING | NULL |
ELT_SUB_IDENT_RIN |
RIN |
REC_FAM, REC_INDI, |
STRING | NULL |
ELT_SUB_INDIV_ATTR |
CAST, DSCR, EDUC, |
REC_INDI |
STRING | NULL |
ELT_SUB_INDIV_RESI |
RESI |
REC_INDI |
NULL | NULL |
ELT_SUB_INDIV_BIRT |
BIRT, CHR |
REC_INDI |
NULL | NULL |
ELT_SUB_INDIV_BIRT_FAMC |
FAMC |
ELT_SUB_INDIV_BIRT |
XREF_PTR(FAM) | NULL |
ELT_SUB_INDIV_GEN |
DEAT, BURI, CREM, |
REC_INDI |
NULL | NULL |
ELT_SUB_INDIV_ADOP |
ADOP |
REC_INDI |
NULL | NULL |
ELT_SUB_INDIV_ADOP_FAMC |
FAMC |
ELT_SUB_INDIV_ADOP |
XREF_PTR(FAM) | NULL |
ELT_SUB_INDIV_ADOP_FAMC_ADOP |
ADOP |
ELT_SUB_INDIV_ADOP_FAMC |
STRING | NULL |
ELT_SUB_INDIV_EVEN |
EVEN |
REC_INDI |
NULL | NULL |
ELT_SUB_LIO_BAPL |
BAPL, CONL, ENDL |
REC_INDI |
NULL | NULL |
ELT_SUB_LIO_BAPL_STAT |
STAT |
ELT_SUB_LIO_BAPL, |
STRING | NULL |
ELT_SUB_LIO_BAPL_DATE |
DATE |
ELT_SUB_LIO_BAPL , |
DATE | NULL |
ELT_SUB_LIO_BAPL_TEMP |
TEMP |
ELT_SUB_LIO_BAPL , |
STRING | NULL |
ELT_SUB_LIO_BAPL_PLAC |
PLAC |
ELT_SUB_LIO_BAPL , |
STRING | NULL |
ELT_SUB_LIO_SLGC |
SLGC |
REC_INDI |
NULL | NULL |
ELT_SUB_LIO_SLGC_FAMC |
FAMC |
ELT_SUB_LIO_SLGC |
XREF_PTR(FAM) | NULL |
ELT_SUB_LSS_SLGS |
SLGS |
REC_FAM |
NULL | NULL |
ELT_SUB_LSS_SLGS_STAT |
STAT |
ELT_SUB_LSS_SLGS |
STRING | NULL |
ELT_SUB_LSS_SLGS_DATE |
DATE |
ELT_SUB_LSS_SLGS |
DATE | NULL |
ELT_SUB_LSS_SLGS_TEMP |
TEMP |
ELT_SUB_LSS_SLGS |
STRING | NULL |
ELT_SUB_LSS_SLGS_PLAC |
PLAC |
ELT_SUB_LSS_SLGS |
STRING | NULL |
ELT_SUB_MULTIM_OBJE |
OBJE |
REC_FAM, REC_INDI, ELT_SUB_FAM_EVT, , |
NULL | NULL |
ELT_SUB_MULTIM_OBJE_FORM |
FORM |
ELT_SUB_MULTIM_OBJE |
STRING | NULL |
ELT_SUB_MULTIM_OBJE_TITL |
TITL |
ELT_SUB_MULTIM_OBJE |
STRING | NULL |
ELT_SUB_MULTIM_OBJE_FILE |
FILE |
ELT_SUB_MULTIM_OBJE |
STRING | NULL |
ELT_SUB_NOTE |
NOTE |
REC_FAM, REC_INDI, ELT_SUB_FAM_EVT, , |
NULL | STRING |
ELT_SUB_PERS_NAME |
NAME |
REC_INDI |
STRING | NULL |
ELT_SUB_PERS_NAME_NPFX |
NPFX |
ELT_SUB_PERS_NAME |
STRING | NULL |
ELT_SUB_PERS_NAME_GIVN |
GIVN |
ELT_SUB_PERS_NAME |
STRING | NULL |
ELT_SUB_PERS_NAME_NICK |
NICK |
ELT_SUB_PERS_NAME |
STRING | NULL |
ELT_SUB_PERS_NAME_SPFX |
SPFX |
ELT_SUB_PERS_NAME |
STRING | NULL |
ELT_SUB_PERS_NAME_SURN |
SURN |
ELT_SUB_PERS_NAME |
STRING | NULL |
ELT_SUB_PERS_NAME_NSFX |
NSFX |
ELT_SUB_PERS_NAME |
STRING | NULL |
ELT_SUB_PLAC |
PLAC |
ELT_SUB_FAM_EVT ,ELT_SUB_FAM_EVT_EVEN, ,
|
STRING | NULL |
ELT_SUB_PLAC_FORM |
FORM |
ELT_SUB_PLAC |
STRING | NULL |
ELT_SUB_SOUR |
SOUR |
REC_FAM, REC_INDI, ELT_SUB_FAM_EVT, ELT_SUB_FAM_EVT_EVEN, , |
STRING | STRING |
ELT_SUB_SOUR_PAGE |
PAGE |
ELT_SUB_SOUR |
STRING | NULL |
ELT_SUB_SOUR_EVEN |
EVEN |
ELT_SUB_SOUR |
STRING | NULL |
ELT_SUB_SOUR_EVEN_ROLE |
ROLE |
ELT_SUB_SOUR_EVEN |
STRING | NULL |
ELT_SUB_SOUR_DATA |
DATA |
ELT_SUB_SOUR |
NULL | NULL |
ELT_SUB_SOUR_DATA_DATE |
DATE |
ELT_SUB_SOUR_DATA |
DATE | NULL |
ELT_SUB_SOUR_TEXT |
TEXT |
ELT_SUB_SOUR |
STRING | NULL |
ELT_SUB_SOUR_QUAY |
QUAY |
ELT_SUB_SOUR |
STRING | NULL |
ELT_SUB_REPO |
REPO |
REC_SOUR |
XREF_PTR(REPO) | NULL |
ELT_SUB_REPO_CALN |
CALN |
ELT_SUB_REPO |
STRING | NULL |
ELT_SUB_REPO_CALN_MEDI |
MEDI |
ELT_SUB_REPO_CALN |
STRING | NULL |
ELT_SUB_FAMS |
FAMS |
REC_INDI |
XREF_PTR(FAM) | NULL |
ELT_USER |
any tag starting |
anywhere |
NULL | NULL |
Gedcom_val
types are (with
val
of type Gedcom_val
):type checker |
cast operator |
|
null value |
GEDCOM_IS_NULL(val) |
N/A |
string |
GEDCOM_IS_STRING(val) |
char* str = GEDCOM_STRING(val); |
date |
GEDCOM_IS_DATE(val) |
struct date_value dv = GEDCOM_DATE(val); |
age |
GEDCOM_IS_AGE(val) |
struct age_value age = GEDCOM_AGE(val); |
xref pointer |
GEDCOM_IS_XREF_PTR(val) |
struct xref_value *xr = GEDCOM_XREF_PTR(val); |
GEDCOM_STRING(val)
is always the same as the
raw_value
passed to the start callback, and is thus in fact redundant.It depends on the first member, the type, which members are actually relevant:struct date_value {
Date_value_type type;
struct date date1;
struct date date2;
char phrase[MAX_PHRASE_LEN + 1];
};
Date_value_type |
Meaning |
Relevant members |
DV_NO_MODIFIER |
just a simple date |
date1 |
DV_BEFORE |
a range (BEFORE date1) |
date1 |
DV_AFTER |
a range (AFTER date1) |
date1 |
DV_BETWEEN |
a range (BETWEEN date1 AND date2) |
date1, date2 |
DV_FROM |
a period (FROM date1) |
date1 |
DV_TO |
a period (TO date1) |
date1 |
DV_FROM_TO |
a period (FROM date1 TO date2) |
date1, date2 |
DV_ABOUT |
an approximation (ABOUT date1) |
date1 |
DV_CALCULATED |
an approximation (CALCULATED date1) |
date1 |
DV_ESTIMATED |
an approximation (ESTIMATED date1) |
date1 |
DV_INTERPRETED |
INTERPRETED date1 FROM a given free form date
phrase |
date1, phrase |
DV_PHRASE |
a free form date phrase |
phrase |
date_value
struct and initializes it properly, or copies an existing date value:
struct date_value* gedcom_new_date_value (const struct date_value* copy_from);
If the parameter copy_from
is NULL
, a new value is created and given initial values. If it is non-NULL
, the value is copied into a new date value.date1
and date2
also have a strict syntax:The first four fields are the primary fields parsed from the value in the GEDCOM file. Thestruct date {
Calendar_type cal;
char day_str[MAX_DAY_LEN + 1];
char month_str[MAX_MONTH_LEN + 1];
char year_str[MAX_YEAR_LEN + 1];
int day;
int month;
int year;
Year_type year_type;
Date_type type;
long int sdn1;
long int sdn2;
};
day_str
, month_str
and year_str
are the literal parts of the date that denote
the day, month and year (the day_str
and month_str
can be empty) . The calendar type cal
is one of (see
calendar overview LINK TBD):CAL_GREGORIAN
: the Gregorian calendarCAL_JULIAN
: the Julian calendarCAL_HEBREW
: the Hebrew (Jewish) calendarCAL_FRENCH_REV
: the calendar used after the
French RevolutionCAL_UNKNOWN
: an unknown calendar typeday
is just the numeric representation of
the day_str
(starting from 1), -1 if the day_str
is emptymonth
is the month number of month_str
in the given calendar type (also starting from 1), -1 if the
month_str
is emptyyear
is the numeric representation of the
year_str
year_str
is given as e.g. "1677/78".
This is coming from a date in a so called "annunciation style", where
the year began on 25 March: "20 March 1677/78" is 20 March 1677 in "annunciation
style" and 20 March 1678 in "circumcision style" (the current style). See
calendar overview (LINK TBD).year
will contain the "circumcision style"
year (1678 in the example), and year_type
will be YEAR_DOUBLE.
Normal dates will have a year_type
equal to
YEAR_SINGLE
.These are represented by a serial day number insdn1
and aDate_type
equal toDATE_EXACT
.
These are represented by 2 serial day numbers (sdn1
andsdn2
) and aDate_type
equal toDATE_BOUNDED
.
For example, the Gregorian date "MAR 1990" is represented by the serial day numbers for "1 MAR 1990" and "31 MAR 1990", and the Gregorian date "1990" is represented by the serial day numbers for "1 JAN 1990" and "31 DEC 1990". Similarly for the other calendar types.
To ensure that an updated date value is consistent, i.e. all
its struct fields are consistent with each other, the following function
can be used:int gedcom_normalize_date (Date_input compute_from, struct date_value* value);
The compute_from
parameter determines which fields
will be taken as input to compute the other fields. The following table
gives an overview of the input and output parameters (the calendar type cal
is always an input parameter, and should not be CAL_UNKNOWN
):compute_from |
input parameters |
output parameters |
DI_FROM_STRINGS |
day_str, month_str, year_str |
day, month, year, year_type |
DI_FROM_NUMBERS |
day, month, year, year_type |
day_str, month_str, year_str |
DI_FROM_SDN |
type, sdn1, sdn2 |
day, month, year |
DV_PHRASE
, no conversions take
place, otherwise one or both of the date structs are processed according
to the table above, depending on the type. The function returns 0 in case of success, non-zero in case of an error.struct date_value* dv = gedcom_new_date_value(NULL);
;
dv->date1.cal = CAL_GREGORIAN;
dv->date1.day = 4
dv->date1.month = 2;
dv->date1.year = 1799;
dv->date1.year_type = YEAR_SINGLE;
gedcom_normalize_date(DI_FROM_NUMBERS, dv);
dv->date1.cal = CAL_FRENCH_REV;
gedcom_normalize_date(DI_FROM_SDN, dv);
/* the day, month and year are now filled in according to the French Revolution calendar */
struct age_value {
Age_type type;
Age_modifier mod;
int years;
int months;
int days;
char phrase[MAX_PHRASE_LEN + 1];
};
It depends on the first member, the type, which members are actually relevant:
Age_type |
Meaning |
Relevant members |
AGE_UNRECOGNIZED |
format not recognized, full raw value in phrase |
phrase |
AGE_CHILD |
the indication 'CHILD' |
mod |
AGE_INFANT |
the indication 'INFANT' |
mod |
AGE_STILLBORN |
the indication 'STILLBORN' |
mod |
AGE_NUMERIC |
an indication in years, months and/or days (each can be -1 if not given) |
mod, years, months, days |
AGE_NO_MODIFIER
: no modifierAGE_LESS_THAN
: the modifier '<' is addedAGE_GREATER_THAN
: the modifier '>' is addedage_value
struct and initializes it properly, or copies an existing age value:
struct age_value* gedcom_new_age_value (const struct age_value* copy_from);
If the parameter copy_from
is NULL
, a new value is created and given initial values. If it is non-NULL
, the value is copied into a new age value.Gedcom_val
contains a pointer to such a struct, not the struct
itself). It is defined as:Thestruct xref_value {
Xref_type type,
char* string,
Gedcom_ctxt object
};
Xref_type
gives the type of the cross-reference and can
be one of:XREF_NONE
(used as default value)XREF_FAM
XREF_INDI
XREF_NOTE
XREF_OBJE
XREF_REPO
XREF_SOUR
XREF_SUBM
XREF_SUBN
XREF_ANY
(if the type is not known, see below)XREF_USER
(for application-specific cross-references)
string
gives the actual cross-reference string from the
GEDCOM file, and the object
is initially NULL,
but
can be filled by the application with an object (of any type) that corresponds
with the cross-reference, and then later extracted when the cross-reference
is used or defined again in the file. This relieves the application
from the burden of maintaining the mapping between cross-references and objects.XREF_ANY
is used when the type of the object is not
immediately known: it has to come from further information. This is
the case in an association (ELT_SUB_ASSO
): the type is then given by the TYPE
subtag.struct xref_value* gedcom_get_by_xref (const char *key)
Retrieve an xref_value by its key. ReturnsNULL
if the given key isn't a valid cross-reference key (see below) or isn't used.
struct xref_value* gedcom_add_xref (Xref_type type, const char* key, Gedcom_ctxt object)
Add an xref_value of the giventype
(see list above), with the givenkey
, to the givenobject
, with a use count equal to 0. Returns the new xref_value if success. ReturnsNULL
in one of the following cases:
- the key isn't a valid cross-reference key (see below)
- there is already an xref_value with the same key
- there was a memory allocation error
int gedcom_delete_xref (const char* key)
Delete the xref_value corresponding to the given key. Returns 0 if success. Returns 1 in one of the following cases:
- the key isn't a valid cross-reference key (see below)
- there is no xref_value with the given key
- the xref_value is still in use, i.e. its use count is not 0 (see
gedcom_link_xref
andgedcom_unlink_xref
below)struct xref_value* gedcom_link_xref (Xref_type type, const char* key)
struct xref_value* gedcom_unlink_xref (Xref_type type, const char* key)
Declare the xref_value corresponding to the given key as being used/no longer used (linked to or unlinked) as the given type. The use of these functions is not mandatory, but it can aid in spotting places in the code where xref_value objects are deleted while they are still referenced.
Returns the xref_value object if success, and its use count is incremented/decremented. ReturnsNULL
in one of the following cases:
- the key isn't a valid cross-reference key (see below)
- there is no xref_value with the given key
- the xref_value was previously added as another type than the type provided here
A cross-reference key must be a string of maximum 22 characters, of the following format:
$Id: interface.html,v 1.15 2003/02/02 14:40:05 verthezp Exp $
$Name: R0_90_0 $