| 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); |
| 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 |
{ |
{ |
| 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 |
|
|
| 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; |
| 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) |