42 |
{ |
{ |
43 |
if ((! _during_load) && (_parent_entity != 0)) |
if ((! _during_load) && (_parent_entity != 0)) |
44 |
{ |
{ |
45 |
GEDCOMParser::ChildToFamilyLink * new_family_link = _parent_entity->addChildToFamilyLink(); |
get_document()->AddParents(_parent_entity); |
|
if (new_family_link != 0) |
|
|
{ |
|
|
GEDCOMParser::FamilyRecord * new_family = get_document()->addFamilyRecord(); |
|
|
new_family->addChilXref(_parent_entity->getId()); |
|
|
std::string new_family_id = new_family->getId(); |
|
|
new_family_link->setFamcXref(new_family_id); |
|
|
} |
|
46 |
} |
} |
47 |
|
save_to_document(); |
48 |
return; |
return; |
49 |
} |
} |
50 |
|
|
51 |
void BakeryGateway::ViewChildToFamilyLink::family_deleted(int family_index) |
void BakeryGateway::ViewChildToFamilyLink::family_deleted(int family_index) |
52 |
{ |
{ |
53 |
GEDCOMParser::ChildToFamilyLinks_t * family_links = &_parent_entity->getChildToFamilyLinks(); |
GEDCOMParser::ChildToFamilyLinks_t family_links = _parent_entity->getChildToFamilyLinks(); |
54 |
SmartPtr < GEDCOMParser::ChildToFamilyLink > family_link_to_delete = (*family_links)[family_index]; |
SmartPtr < GEDCOMParser::ChildToFamilyLink > family_link_to_delete = family_links[family_index]; |
55 |
GEDCOMParser::ChildToFamilyLinks_t::iterator family_link_iter = find(family_links->begin(), family_links->end(), family_link_to_delete); |
get_document()->RemoveChildToFamilyLink(_parent_entity, family_link_to_delete.getPtr()); |
56 |
if (family_link_iter != family_links->end()) |
save_to_document(); |
|
{ |
|
|
GEDCOMParser::FamilyRecords_t family_records = get_document()->getFamilyRecords(); |
|
|
SmartPtr < GEDCOMParser::FamilyRecord > family = family_records[(*family_link_iter)->getFamcXref()]; |
|
|
GEDCOMParser::ChildXrefs_t child_xrefs = family->getChilXrefs(); |
|
|
GEDCOMParser::ChildXrefs_t::iterator child_xref_iter = find(child_xrefs.begin(), child_xrefs.end(), _parent_entity->getId()); |
|
|
if (child_xref_iter != child_xrefs.end()) |
|
|
{ |
|
|
child_xrefs.erase(child_xref_iter); |
|
|
} |
|
|
family_links->erase(family_link_iter); |
|
|
} |
|
57 |
return; |
return; |
58 |
} |
} |
59 |
|
|