X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gom%2Fnote_sub.c;h=8104aaeb8d19dcb09f1bbc0a6ad36d92576c08e3;hb=83b1b8c2545fb21b40e2c7cdf7eceb82d3ceda1e;hp=2d748a6017ee8be6f77339d3cbbefcbf39889aaf;hpb=763e8737b5118c5f23dca84a3290c2d805bbefe6;p=gedcom-parse.git diff --git a/gom/note_sub.c b/gom/note_sub.c index 2d748a6..8104aae 100644 --- a/gom/note_sub.c +++ b/gom/note_sub.c @@ -110,10 +110,33 @@ Gedcom_ctxt sub_note_start(_ELT_PARAMS_) return (Gedcom_ctxt)result; } +void sub_note_end(_ELT_END_PARAMS_) +{ + if (GEDCOM_IS_STRING(parsed_value)) { + Gom_ctxt ctxt = (Gom_ctxt)self; + if (! ctxt) + NO_CONTEXT; + else { + struct note_sub *obj = SAFE_CTXT_CAST(note_sub, ctxt); + if (obj) { + char *str = GEDCOM_STRING(parsed_value); + char *newvalue = strdup(str); + if (! newvalue) + MEMORY_ERROR; + else + obj->text = newvalue; + } + destroy_gom_ctxt(ctxt); + } + } +} + DEFINE_SUB_MAKEFUNC(note_sub) +DEFINE_SUB_ADDFUNC(note_sub) +DEFINE_SUB_FINDFUNC(note_sub) +DEFINE_SUB_REMOVEFUNC(note_sub) +DEFINE_SUB_MOVEFUNC(note_sub) -DEFINE_STRING_END_CB(note_sub, sub_note_end, text) - DEFINE_ADDFUNC2(note_sub, source_citation, citation) DEFINE_ADDFUNC2(note_sub, user_data, extra) @@ -122,6 +145,18 @@ void note_sub_subscribe() gedcom_subscribe_to_element(ELT_SUB_NOTE, sub_note_start, sub_note_end); } +void UNREFALLFUNC(note_sub)(struct note_sub* obj) +{ + if (obj) { + struct note_sub* runner; + for (runner = obj; runner; runner = runner->next) { + unref_xref_value(runner->reference); + UNREFALLFUNC(source_citation)(runner->citation); + UNREFALLFUNC(user_data)(runner->extra); + } + } +} + void CLEANFUNC(note_sub)(struct note_sub* note) { if (note) {