X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gom%2Fassociation.c;h=2a5bf39c1a403b3ab22052844bceff805616b389;hb=1568cb8ab16ecc1984d0d00b8ae8189c32508b08;hp=fdd833baa97dd94f8a3819bba35462ee7df60c55;hpb=bdf47fdee469d5a1d7ddfd06a0e4b26f3b40b0f4;p=gedcom-parse.git diff --git a/gom/association.c b/gom/association.c index fdd833b..2a5bf39 100644 --- a/gom/association.c +++ b/gom/association.c @@ -126,3 +126,31 @@ void association_cleanup(struct association* assoc) DESTROY_CHAIN_ELTS(user_data, assoc->extra, user_data_cleanup); } } + +int write_associations(Gedcom_write_hndl hndl, int parent, + struct association *assoc) +{ + int result = 0; + struct association* obj; + + if (!assoc) return 1; + + for (obj = assoc; obj; obj = obj->next) { + result |= gedcom_write_element_xref(hndl, ELT_SUB_ASSO, 0, parent, + obj->to); + if (obj->type) + result |= gedcom_write_element_str(hndl, ELT_SUB_ASSO_TYPE, 0, parent, + obj->type); + if (obj->relation) + result |= gedcom_write_element_str(hndl, ELT_SUB_ASSO_RELA, 0, parent, + obj->relation); + if (obj->citation) + result |= write_citations(hndl, ELT_SUB_ASSO, obj->citation); + if (obj->note) + result |= write_note_subs(hndl, ELT_SUB_ASSO, obj->note); + if (obj->extra) + result |= write_user_data(hndl, obj->extra); + } + + return result; +}