-
Notifications
You must be signed in to change notification settings - Fork 0
/
Person.cpp
executable file
·131 lines (106 loc) · 2.54 KB
/
Person.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
This is a class containing the most important information about someone
in FamilySearch. Created by Jacob McCoy on 28 November 2023
*/
#include "Person.h"
#include <sstream>
// default constructor
Person::Person(id personal_id, gedcom_id personal_gedcom_id, fs_id personal_fs_id, std::string name)
{
this->personal_id = personal_id;
this->personal_gedcom_id = personal_gedcom_id;
this->personal_fs_id = personal_fs_id;
this->name = name;
}
// empty constructor
Person::Person(){}
fs_id Person::GetFSID() const
{
return this->personal_fs_id;
}
gedcom_id Person::GetGEDCOMID() const
{
return this->personal_gedcom_id;
}
id Person::GetID() const
{
return this->personal_id;
}
std::string Person::GetName() const
{
return this->name;
}
void Person::AddFather(id father_id)
{
this->father_ids.push_back(father_id);
return;
}
void Person::AddMother(id mother_id)
{
this->mother_ids.push_back(mother_id);
return;
}
void Person::AddSpouse(id spouse_id)
{
this->spouse_ids.push_back(spouse_id);
}
void Person::AddChild(id child_id)
{
this->child_ids.push_back(child_id);
return;
}
void Person::AddFamilySpouse(gedcom_id id)
{
this->family_spouse_ids.push_back(id);
return;
}
void Person::AddFamilyChild(gedcom_id id)
{
this->family_child_ids.push_back(id);
return;
}
std::vector<id> Person::GetFathers() const
{
return this->father_ids;
}
std::vector<id> Person::GetMothers() const
{
return this->mother_ids;
}
std::vector<id> Person::GetSpouses() const
{
return this->spouse_ids;
}
std::vector<id> Person::GetChildren() const
{
return this->child_ids;
}
std::string Person::ToString() const
{
std::stringstream to_return;
to_return << "Name: " << this->name << '\n' <<
"FS ID: " << this->personal_fs_id << '\n' <<
"GEDCOM ID: " << this->personal_gedcom_id << '\n';
to_return << "Spouse IDs:";
for (int i = 0; i < this->spouse_ids.size(); i++)
{
to_return << "\n " << this->spouse_ids.at(i);
}
to_return << "\nChild IDs:";
for (int i = 0; i < this->child_ids.size(); i++)
{
to_return << "\n " << this->child_ids.at(i);
}
to_return << "\nFather IDs:";
for (int i = 0; i < this->father_ids.size(); i++)
{
to_return << "\n " << this->father_ids.at(i);
}
to_return << "\nMother IDs:";
for (int i = 0; i < this->mother_ids.size(); i++)
{
to_return << "\n " << this->mother_ids.at(i);
}
to_return << '\n';
return to_return.str();
}