66 |
std::cout << message << count << std::endl; |
std::cout << message << count << std::endl; |
67 |
} |
} |
68 |
|
|
69 |
|
void displayrecords(GEDCOMParser::IndividualRecords_t const &individus, GEDCOMParser::Predicates::PredicateIndividualRecords const * const predicate) |
70 |
|
{ |
71 |
|
GEDCOMParser::Predicates::PredicateIndividualRecordsAdapter adapter(predicate); |
72 |
|
GEDCOMParser::IndividualRecords_t::const_iterator individu_iter = find_if(individus.begin(), individus.end(), adapter); |
73 |
|
do |
74 |
|
{ |
75 |
|
if (individu_iter != individus.end()) |
76 |
|
{ |
77 |
|
std::cout << individu_iter->second->getPersonalNames()[0]->getSurn() << " " << individu_iter->second->getPersonalNames()[0]->getGivn() << std::endl; |
78 |
|
individu_iter = find_if(++individu_iter, individus.end(), adapter); |
79 |
|
} |
80 |
|
} |
81 |
|
while (individu_iter != individus.end()); |
82 |
|
|
83 |
|
} |
84 |
|
|
85 |
int main(int argc, char **argv) |
int main(int argc, char **argv) |
86 |
{ |
{ |
87 |
setlocale (LC_ALL, ""); |
setlocale (LC_ALL, ""); |
182 |
predicate = GEDCOMParser::Predicates::getGenericPredicateIndividualRecords(std::compose1(std::logical_not<bool>(), std::bind1st(GEDCOMParser::Predicates::HasSpouse(), lineage))); |
predicate = GEDCOMParser::Predicates::getGenericPredicateIndividualRecords(std::compose1(std::logical_not<bool>(), std::bind1st(GEDCOMParser::Predicates::HasSpouse(), lineage))); |
183 |
countrecords(individus, _("Individuals records bachelor : "), predicate); |
countrecords(individus, _("Individuals records bachelor : "), predicate); |
184 |
delete predicate; predicate = 0; |
delete predicate; predicate = 0; |
185 |
|
|
186 |
|
// count of individus with |
187 |
|
// -name = 'PICARD' |
188 |
|
std::string const name = "PICARD"; |
189 |
|
predicate = |
190 |
|
GEDCOMParser::Predicates::getGenericPredicateIndividualRecords(std::bind1st(GEDCOMParser::Predicates::NameEqualsTo(), name)); |
191 |
|
countrecords(individus, _("Individuals records named PICARD : "), predicate); |
192 |
|
displayrecords(individus, predicate); |
193 |
|
delete predicate; predicate = 0; |
194 |
|
|
195 |
|
// count of individus with |
196 |
|
// - sex = Female |
197 |
|
// - do not have child |
198 |
|
|
199 |
|
predicate = |
200 |
|
GEDCOMParser::Predicates::getGenericPredicateIndividualRecords( |
201 |
|
std::compose2(std::logical_and<bool>(), |
202 |
|
std::compose1( |
203 |
|
std::logical_not<bool>(), |
204 |
|
std::bind1st(GEDCOMParser::Predicates::HasChild(),lineage)), |
205 |
|
std::compose1(std::logical_not<bool>(), |
206 |
|
GEDCOMParser::Predicates::IsMale()) |
207 |
|
) |
208 |
|
); |
209 |
|
countrecords(individus, _("Individuals records sex Female, without child : "), predicate); |
210 |
|
displayrecords(individus, predicate); |
211 |
|
|
212 |
|
delete predicate; predicate = 0; |
213 |
|
|
214 |
|
// count of individus with |
215 |
|
// - name = 'PICARD' |
216 |
|
// - sex = Male |
217 |
|
// - do not have child |
218 |
|
|
219 |
|
predicate = |
220 |
|
GEDCOMParser::Predicates::getGenericPredicateIndividualRecords( |
221 |
|
std::compose2(std::logical_and<bool>(), |
222 |
|
std::compose1( |
223 |
|
std::logical_not<bool>(), |
224 |
|
std::bind1st(GEDCOMParser::Predicates::HasChild(),lineage)), |
225 |
|
std::compose2(std::logical_and<bool>(), |
226 |
|
GEDCOMParser::Predicates::IsMale(), |
227 |
|
std::bind1st(GEDCOMParser::Predicates::NameEqualsTo(), name) |
228 |
|
|
229 |
|
) |
230 |
|
) |
231 |
|
); |
232 |
|
countrecords(individus, _("Individuals records named PICARD, sex Male, without child : "), predicate); |
233 |
|
displayrecords(individus, predicate); |
234 |
|
|
235 |
|
delete predicate; predicate = 0; |
236 |
|
|
237 |
GEDCOMParser::FamilyRecords_t families = lineage->getFamilyRecords(); |
GEDCOMParser::FamilyRecords_t families = lineage->getFamilyRecords(); |
238 |
std::cout << _("Family records : ") << families.size() << std::endl; |
std::cout << _("Family records : ") << families.size() << std::endl; |