/[ghosts]/ghosts/gedcomparser/src/GEDCOMParser/Predicates/HasSpouse.hh
ViewVC logotype

Diff of /ghosts/gedcomparser/src/GEDCOMParser/Predicates/HasSpouse.hh

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

revision 1.2 by cpcp, Sun Jul 27 19:35:22 2003 UTC revision 1.3 by cpcp, Thu Oct 30 20:05:44 2003 UTC
# Line 10  namespace GEDCOMParser { Line 10  namespace GEDCOMParser {
10      class HasSpouse  : public std::binary_function<GEDCOMParser::LineageLinkageGedcom const * const, GEDCOMParser::IndividualRecords_elem_t, bool> {      class HasSpouse  : public std::binary_function<GEDCOMParser::LineageLinkageGedcom const * const, GEDCOMParser::IndividualRecords_elem_t, bool> {
11      public:      public:
12        bool operator()(GEDCOMParser::LineageLinkageGedcom const * const lineage,        bool operator()(GEDCOMParser::LineageLinkageGedcom const * const lineage,
13                        GEDCOMParser::IndividualRecords_elem_t individu) const                        GEDCOMParser::IndividualRecords_elem_t individu_elem) const
14        {        {
15          bool res = lineage->hasSpouse(individu.second.getPtr());          GEDCOMParser::IndividualRecord const * const individu = individu_elem.second.getPtr();
16            bool res = false;
17            std::string fam_id;
18            std::string spouse_id;
19            FamilyRecords_t::const_iterator fam_iter;
20            IndividualRecords_t::const_iterator spouse_iter;
21            if (individu != 0)
22              {
23                SpouseToFamilyLinks_t const &spouse_to_family_links = individu->getSpouseToFamilyLinks();
24                SpouseToFamilyLinks_t::const_iterator spouse_to_family_links_iter = spouse_to_family_links.begin();
25                GEDCOMParser::FamilyRecords_t const &families = lineage->getFamilyRecords();
26                while ((!res) && (spouse_to_family_links_iter != spouse_to_family_links.end()))
27                  {
28                    fam_id = (*spouse_to_family_links_iter)->getFamsXref();
29                    fam_iter = families.find(fam_id);
30                    if (fam_iter != families.end())
31                      {
32                        if (individu->getSex() == GEDCOMParser::IndividualRecord::MALE)
33                          {
34                            spouse_id = (*fam_iter).second->getWife();
35                          }
36                        else
37                          {
38                            spouse_id = (*fam_iter).second->getHusb();
39                          }
40                        if (spouse_id != "")
41                          {
42                            res = true;
43                          }
44                      }
45                    spouse_to_family_links_iter++;
46                  }
47              }
48          return res;          return res;
49        };        };
50      };      };

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

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