/[ghosts]/ghosts/gedcomviewer/src/BakeryGateway/ViewChildToFamilyLink.cpp
ViewVC logotype

Diff of /ghosts/gedcomviewer/src/BakeryGateway/ViewChildToFamilyLink.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by cpcp, Mon Mar 3 21:39:24 2003 UTC revision 1.10 by cpcp, Thu Mar 13 20:24:23 2003 UTC
# Line 42  void BakeryGateway::ViewChildToFamilyLin Line 42  void BakeryGateway::ViewChildToFamilyLin
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    

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26