21 |
*/ |
*/ |
22 |
|
|
23 |
#include "GEDCOMHelper/IndividualRecordHelper.hh" |
#include "GEDCOMHelper/IndividualRecordHelper.hh" |
|
#include <iostream> |
|
24 |
|
|
25 |
GEDCOMParser::PersonalName * GEDCOMHelper::IndividualRecordHelper::setPersonalName(std::string const &first_name, std::string const& last_name) |
GEDCOMParser::PersonalName * GEDCOMHelper::IndividualRecordHelper::setPersonalName(std::string const &first_name, std::string const& last_name) |
26 |
{ |
{ |
39 |
return personal_name; |
return personal_name; |
40 |
} |
} |
41 |
|
|
42 |
|
GEDCOMParser::IndividualEvent * const GEDCOMHelper::IndividualRecordHelper::getBirth(void) const |
43 |
|
{ |
44 |
|
GEDCOMParser::IndividualEvent * const res = getEvent(GEDCOMParser::IndividualEvent::e_Birt); |
45 |
|
return res; |
46 |
|
} |
47 |
|
|
48 |
|
GEDCOMParser::IndividualEvent * const GEDCOMHelper::IndividualRecordHelper::getDeath(void) const |
49 |
|
{ |
50 |
|
GEDCOMParser::IndividualEvent * const res = getEvent(GEDCOMParser::IndividualEvent::e_Deat); |
51 |
|
return res; |
52 |
|
} |
53 |
|
|
54 |
|
GEDCOMParser::IndividualEvent * const GEDCOMHelper::IndividualRecordHelper::getEvent(GEDCOMParser::IndividualEvent::enumIndividualEvents const &event) const |
55 |
|
{ |
56 |
|
GEDCOMParser::IndividualEvent * res = 0; |
57 |
|
GEDCOMParser::IndividualEvents_t const &events = _individual_record->getIndividualEvents(); |
58 |
|
GEDCOMParser::IndividualEvents_t::const_iterator iter = |
59 |
|
std::find(events.begin(), |
60 |
|
events.end(), |
61 |
|
event); |
62 |
|
if (iter != events.end()) |
63 |
|
{ |
64 |
|
res = (*iter).getPtr(); |
65 |
|
} |
66 |
|
return res; |
67 |
|
} |
68 |
|
|
69 |
GEDCOMParser::IndividualEvent * GEDCOMHelper::IndividualRecordHelper::setEvent(GEDCOMParser::IndividualEvent::enumIndividualEvents const &event_type, std::string const &date, std::string const &location) |
GEDCOMParser::IndividualEvent * GEDCOMHelper::IndividualRecordHelper::setEvent(GEDCOMParser::IndividualEvent::enumIndividualEvents const &event_type, std::string const &date, std::string const &location) |
70 |
{ |
{ |
71 |
GEDCOMParser::IndividualEvent * event = _individual_record->getEvent(event_type); |
GEDCOMParser::IndividualEvent * event = getEvent(event_type); |
72 |
if (event == 0) |
if (event == 0) |
73 |
{ |
{ |
74 |
event = _individual_record->addIndividualEvent(); |
event = _individual_record->addIndividualEvent(); |
170 |
res = _lineage->addFamilyRecord(); |
res = _lineage->addFamilyRecord(); |
171 |
} |
} |
172 |
link->setFamsXref(res->getId()); |
link->setFamsXref(res->getId()); |
173 |
res->setSpouse(*_individual_record); |
if (_individual_record->getSex() == GEDCOMParser::IndividualRecord::MALE) |
174 |
|
{ |
175 |
|
res->setHusb(_individual_record->getId()); |
176 |
|
} |
177 |
|
else |
178 |
|
{ |
179 |
|
res->setWife(_individual_record->getId()); |
180 |
|
} |
181 |
} |
} |
182 |
return res; |
return res; |
183 |
} |
} |
226 |
GEDCOMParser::IndividualRecords_t const &individus = _lineage->getIndividualRecords(); |
GEDCOMParser::IndividualRecords_t const &individus = _lineage->getIndividualRecords(); |
227 |
GEDCOMParser::FamilyRecords_t::const_iterator fam_iter; |
GEDCOMParser::FamilyRecords_t::const_iterator fam_iter; |
228 |
GEDCOMParser::IndividualRecords_t::const_iterator parent_iter; |
GEDCOMParser::IndividualRecords_t::const_iterator parent_iter; |
229 |
GEDCOMParser::IndividualRecords_elem_t res; |
GEDCOMParser::IndividualRecords_elem_t tmp_res; |
230 |
|
GEDCOMParser::IndividualRecord * res = 0; |
231 |
|
|
232 |
if (_individual_record->getChildToFamilyLinks().size() == 1) |
if (_individual_record->getChildToFamilyLinks().size() == 1) |
233 |
{ |
{ |
246 |
parent_iter = individus.find(parent_id); |
parent_iter = individus.find(parent_id); |
247 |
if (parent_iter != individus.end()) |
if (parent_iter != individus.end()) |
248 |
{ |
{ |
249 |
res = *parent_iter; |
tmp_res = *parent_iter; |
250 |
|
res = tmp_res.second.getPtr(); |
251 |
} |
} |
252 |
} |
} |
253 |
} |
} |
254 |
return res.second.getPtr(); |
return res; |
255 |
} |
} |
256 |
|
|
257 |
void GEDCOMHelper::IndividualRecordHelper::RemoveChildFromFamily(GEDCOMParser::FamilyRecord * const family) |
void GEDCOMHelper::IndividualRecordHelper::RemoveChildFromFamily(GEDCOMParser::FamilyRecord * const family) |