/[ghosts]/ghosts/gedcomparser/src/GEDCOMParser/LineageLinkageGedcom.cpp
ViewVC logotype

Diff of /ghosts/gedcomparser/src/GEDCOMParser/LineageLinkageGedcom.cpp

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

revision 1.6 by cpcp, Tue Feb 18 21:43:31 2003 UTC revision 1.7 by cpcp, Wed Feb 19 21:13:05 2003 UTC
# Line 25  Line 25 
25  #include "GEDCOMParser/GEDCOMFactory.hh"  #include "GEDCOMParser/GEDCOMFactory.hh"
26  #include "GEDCOMParser/GEDCOMFactoryAccessor.hh"  #include "GEDCOMParser/GEDCOMFactoryAccessor.hh"
27    
 #define GET_LAST_ID "XYZ"  
   
28  void GEDCOMParser::LineageLinkageGedcom::setHeader(Header * const header)  void GEDCOMParser::LineageLinkageGedcom::setHeader(Header * const header)
29  {  {
30    _header = SmartPtr< Header >(header);    _header = SmartPtr< Header >(header);
# Line 46  GEDCOMParser::IndividualRecord * GEDCOMP Line 44  GEDCOMParser::IndividualRecord * GEDCOMP
44  {  {
45    std::string id;    std::string id;
46    IndividualRecord * tmp_indi;    IndividualRecord * tmp_indi;
47      if (_id_generator == 0)
48        {
49          _id_generator = new GEDCOMParser::IdGenerator();
50        }
51    
52    if (individual_record == 0)    if (individual_record == 0)
53      {      {
54        GEDCOMParser::GEDCOMFactory * factory = GEDCOMParser::GEDCOMFactoryAccessor::getFactory();        GEDCOMParser::GEDCOMFactory * factory = GEDCOMParser::GEDCOMFactoryAccessor::getFactory();
55        tmp_indi = factory->createIndividualRecord(true);        tmp_indi = factory->createIndividualRecord(_id_generator->getId());
56      }      }
57    else    else
58      {      {
# Line 57  GEDCOMParser::IndividualRecord * GEDCOMP Line 60  GEDCOMParser::IndividualRecord * GEDCOMP
60      }      }
61    id = tmp_indi->getId();    id = tmp_indi->getId();
62    _individual_records[id] = SmartPtr< IndividualRecord >(tmp_indi);    _individual_records[id] = SmartPtr< IndividualRecord >(tmp_indi);
63      _id_generator->addUsedId(id);
64    return _individual_records[id].getPtr();    return _individual_records[id].getPtr();
65  }  }
66    
# Line 108  GEDCOMParser::IndividualRecords_t const Line 112  GEDCOMParser::IndividualRecords_t const
112    return _individual_records;    return _individual_records;
113  }  }
114    
 GEDCOMParser::IndividualRecord * GEDCOMParser::LineageLinkageGedcom::getLastInsertedIndividualRecord(void)  
 {  
   GEDCOMParser::IndividualRecord * res;  
   GEDCOMParser::IndividualRecords_t::const_iterator iter = _individual_records.find(GET_LAST_ID);  
   if (iter != _individual_records.end())  
     {  
       res = (*iter).second.getPtr();  
     }  
   else  
     {  
       res = addIndividualRecord();  
     }  
   return res;  
 }  
   
115  GEDCOMParser::MultimediaRecords_t const & GEDCOMParser::LineageLinkageGedcom::getMultimediaRecords(void) const  GEDCOMParser::MultimediaRecords_t const & GEDCOMParser::LineageLinkageGedcom::getMultimediaRecords(void) const
116  {  {
117    return _multimedia_records;    return _multimedia_records;
# Line 226  GEDCOMParser::IndividualRecords_t GEDCOM Line 215  GEDCOMParser::IndividualRecords_t GEDCOM
215    
216  GEDCOMParser::LineageLinkageGedcom::~LineageLinkageGedcom(void)  GEDCOMParser::LineageLinkageGedcom::~LineageLinkageGedcom(void)
217  {  {
218      delete _id_generator;
219      _id_generator = 0;
220  }  }
221    
222  void GEDCOMParser::LineageLinkageGedcom::Accept(GEDCOMParser::GEDCOMVisitor * v)  void GEDCOMParser::LineageLinkageGedcom::Accept(GEDCOMParser::GEDCOMVisitor * v)

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

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