line endings
This commit is contained in:
+4
-1
@@ -1,4 +1,7 @@
|
||||
build
|
||||
bin
|
||||
.codelite
|
||||
*.workspace
|
||||
GPATH
|
||||
GRTAGS
|
||||
GTAGS
|
||||
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
g++ -o build/release/famt -std=gnu++20 -Ofast -flto -fipa-pta -fallow-store-data-races -fgcse-sm -fgcse-las -s -DNDEBUG *.cpp
|
||||
g++ -o bin/release/famt -std=gnu++20 -Ofast -flto -fipa-pta -fallow-store-data-races -fgcse-sm -fgcse-las -s -DNDEBUG *.cpp
|
||||
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
g++ -o build/debug/famt -std=gnu++20 -g -Og -Wall *.cpp
|
||||
g++ -o bin/debug/famt -std=gnu++20 -g -Og -Wall *.cpp -lncursesw
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <ncursesw/ncurses.h>
|
||||
#include <iostream>
|
||||
#include "tree.h"
|
||||
#include "help.h"
|
||||
@@ -36,19 +37,23 @@ int main()
|
||||
test2.saveTree();*/
|
||||
|
||||
Tree firstTree("firstTree");
|
||||
firstTree.addPerson("Адам,", {0, 1, 6}, true);
|
||||
firstTree.addPerson("Ева", {0, 1, 6}, false);
|
||||
|
||||
firstTree.addPerson("Адам,", true, Nobody, Nobody, {0, 1, 6});
|
||||
firstTree.addPerson("Ева", false, Nobody, Nobody, {0, 1, 6});
|
||||
firstTree.addRelation(0, Husband, 1);
|
||||
|
||||
firstTree.addPerson("Кайн", {}, true, 0, 1);
|
||||
firstTree.addPerson("Авел", {}, true, 0, 1);
|
||||
firstTree.addPerson("Сит", 230, true, 0, 1);
|
||||
firstTree.addPerson("Кайн", true, 0, 1);
|
||||
firstTree.addPerson("Авел", true, 0, 1);
|
||||
firstTree.addPerson("Сит", true, 0, 1, 230);
|
||||
firstTree.addRelation(2, Brother, 3);
|
||||
firstTree.addRelation(2, Brother, 4);
|
||||
|
||||
firstTree.print();
|
||||
firstTree.saveTree();
|
||||
|
||||
firstTree.printRel(3);
|
||||
firstTree.printOldestAncestors(3);
|
||||
|
||||
|
||||
Array<Tree> trees;
|
||||
|
||||
@@ -127,11 +132,11 @@ int main()
|
||||
break;
|
||||
case 4: //addPerson
|
||||
std::cin >> name >> day >> month >> year >> sex;
|
||||
trees[curTree].addPerson(name, EventTime(year, month, day) , sex);
|
||||
trees[curTree].addPerson(name, sex, Nobody, Nobody, EventTime(year, month, day));
|
||||
break;
|
||||
case 5: //addPersonWP
|
||||
std::cin >> name >> day >> month >> year >> sex >> father >> mother;
|
||||
trees[curTree].addPerson(name, EventTime(year, month, day), sex, father, mother);
|
||||
trees[curTree].addPerson(name, sex, father, mother, EventTime(year, month, day));
|
||||
break;
|
||||
case 6: //addRelation
|
||||
std::cin >> name >> input >> secondName;
|
||||
|
||||
+25
-18
@@ -18,7 +18,6 @@ EventTime::EventTime(I16 Year, U8 Month, U16 Day, I8 Hour, I8 Minute)
|
||||
|
||||
void EventTime::print() const
|
||||
{
|
||||
cout << "Birth: ";
|
||||
if (day != UNKNOWN_DATE)
|
||||
cout << (I32)day;
|
||||
else
|
||||
@@ -39,11 +38,12 @@ void EventTime::print() const
|
||||
}
|
||||
|
||||
|
||||
Person::Person(const char* Name, EventTime Birth, bool IsMale)
|
||||
: name(Name)
|
||||
, numRel(0)
|
||||
, birth(Birth)
|
||||
, isMale(IsMale)
|
||||
Person::Person(const char* name, EventTime birth, bool isMale, EventTime death)
|
||||
: name_(name)
|
||||
, numRel_(0)
|
||||
, birth_(birth)
|
||||
, isMale_(isMale)
|
||||
, death_(death)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -65,18 +65,18 @@ Person::Person(const char* Name, EventTime Birth, bool IsMale)
|
||||
|
||||
bool Person::operator==(const Person &other)const
|
||||
{
|
||||
return name == other.name && isMale == other.isMale; //TODO && day == other.day || !day || !other.day) && (month == other.month || !month || !other.month) && (year == other.year || !year || !other.year);
|
||||
return name_ == other.name_ && isMale_ == other.isMale_; //TODO && day == other.day || !day || !other.day) && (month == other.month || !month || !other.month) && (year == other.year || !year || !other.year);
|
||||
}
|
||||
|
||||
|
||||
void Person::save(std::ofstream &file)const
|
||||
{
|
||||
//
|
||||
char nameLen = name.size();
|
||||
char nameLen = name_.size();
|
||||
file.write(reinterpret_cast<char*>(&nameLen), sizeof(nameLen));
|
||||
file.write(name.data(), nameLen * sizeof(name[0]));
|
||||
file.write(reinterpret_cast<const char*>(&numRel), sizeof(numRel));
|
||||
file.write(reinterpret_cast<const char*>(&isMale), sizeof(isMale));
|
||||
file.write(name_.data(), nameLen * sizeof(name_[0]));
|
||||
file.write(reinterpret_cast<const char*>(&numRel_), sizeof(numRel_));
|
||||
file.write(reinterpret_cast<const char*>(&isMale_), sizeof(isMale_));
|
||||
//file.write(reinterpret_cast<const char*>(&day), sizeof(day)); TODO
|
||||
//file.write(reinterpret_cast<const char*>(&month), sizeof(month));
|
||||
//file.write(reinterpret_cast<const char*>(&year), sizeof(year));
|
||||
@@ -90,10 +90,10 @@ void Person::load(std::ifstream &file)
|
||||
C8 nameBuf[128];
|
||||
file.read(nameBuf, nameLen * sizeof(*nameBuf));
|
||||
nameBuf[nameLen] = '\0';
|
||||
name = nameBuf;
|
||||
name_ = nameBuf;
|
||||
|
||||
file.read(reinterpret_cast<char*>(&numRel), sizeof(numRel));
|
||||
file.read(reinterpret_cast<char*>(&isMale), sizeof(isMale));
|
||||
file.read(reinterpret_cast<char*>(&numRel_), sizeof(numRel_));
|
||||
file.read(reinterpret_cast<char*>(&isMale_), sizeof(isMale_));
|
||||
//file.read(reinterpret_cast<char*>(&day), sizeof(day)); TODO
|
||||
//file.read(reinterpret_cast<char*>(&month), sizeof(month));
|
||||
//file.read(reinterpret_cast<char*>(&year), sizeof(year));
|
||||
@@ -101,12 +101,19 @@ void Person::load(std::ifstream &file)
|
||||
|
||||
void Person::rename(const char* newName)
|
||||
{
|
||||
name = newName;
|
||||
name_ = newName;
|
||||
}
|
||||
|
||||
void Person::print()const
|
||||
{
|
||||
std::cout << name << '\n';
|
||||
birth.print();
|
||||
std::cout << (isMale ? "Male\n\n" : "Female\n\n");
|
||||
cout << name_ << '\n';
|
||||
cout << (isMale_ ? "Male\n" : "Female\n");
|
||||
|
||||
cout << "Birth: ";
|
||||
birth_.print();
|
||||
|
||||
cout << "Death: "; //TODO: only print if known
|
||||
death_.print();
|
||||
|
||||
cout << '\n';
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class Person
|
||||
|
||||
public:
|
||||
Person() = default;
|
||||
Person(const char* Name, EventTime Birth, bool Sex);
|
||||
Person(const char* name, EventTime birth, bool sex, EventTime death);
|
||||
|
||||
bool operator==(const Person &other)const;
|
||||
|
||||
@@ -36,9 +36,9 @@ public:
|
||||
friend class Tree;
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
unsigned numRel; //Number of close relatives - mother, father, brother, sister, wife/husband, child, ex-wife/husband
|
||||
EventTime birth;
|
||||
bool isMale;
|
||||
EventTime death;
|
||||
std::string name_;
|
||||
unsigned numRel_; //Number of close relatives - mother, father, brother, sister, wife/husband, child, ex-wife/husband
|
||||
EventTime birth_;
|
||||
bool isMale_;
|
||||
EventTime death_;
|
||||
};
|
||||
|
||||
@@ -55,14 +55,14 @@ Tree Tree::operator+ (const Tree& other)//
|
||||
}
|
||||
else //If he's found in both
|
||||
{
|
||||
for (unsigned j = 0; j < other.people[i].numRel; ++j) //Adds the number of relatives from the II to the number in the I
|
||||
for (unsigned j = 0; j < other.people[i].numRel_; ++j) //Adds the number of relatives from the II to the number in the I
|
||||
{
|
||||
if(newId[other.relatives[i][j]] > numPeople)
|
||||
++result.people[newId[i]].numRel;
|
||||
++result.people[newId[i]].numRel_;
|
||||
}
|
||||
|
||||
result.relatives[newId[i]].resize(result.people[newId[i]].numRel);
|
||||
result.relations[newId[i]].resize(result.people[newId[i]].numRel);
|
||||
result.relatives[newId[i]].resize(result.people[newId[i]].numRel_);
|
||||
result.relations[newId[i]].resize(result.people[newId[i]].numRel_);
|
||||
|
||||
result.relatives[newId[i]] = relatives[newId[i]];
|
||||
result.relations[newId[i]] = relations[newId[i]];
|
||||
@@ -108,23 +108,23 @@ Tree& Tree::operator+=(const Tree& other)
|
||||
if (newId[i] >= numPeople)
|
||||
{
|
||||
relatives.push(other.relatives[i]);
|
||||
for (unsigned j = 0; j < other.people[i].numRel; ++j)
|
||||
for (unsigned j = 0; j < other.people[i].numRel_; ++j)
|
||||
relatives[newId[i]][j] = newId[ relatives[newId[i]][j] ];
|
||||
relations.push(other.relations[i]);
|
||||
}
|
||||
else //If the member is present in both trees
|
||||
{
|
||||
for (unsigned j = 0; j < other.people[i].numRel; ++j) //Adds the number of relatives from the II to the number in the I
|
||||
for (unsigned j = 0; j < other.people[i].numRel_; ++j) //Adds the number of relatives from the II to the number in the I
|
||||
{
|
||||
if (newId[other.relatives[i][j]] >= numPeople)
|
||||
++people[newId[i]].numRel;
|
||||
++people[newId[i]].numRel_;
|
||||
}
|
||||
relatives[newId[i]].resize(people[newId[i]].numRel);
|
||||
relations[newId[i]].resize(people[newId[i]].numRel);
|
||||
for (unsigned j = 0; j < other.people[i].numRel; ++j)
|
||||
relatives[newId[i]].resize(people[newId[i]].numRel_);
|
||||
relations[newId[i]].resize(people[newId[i]].numRel_);
|
||||
for (unsigned j = 0; j < other.people[i].numRel_; ++j)
|
||||
{
|
||||
relatives[newId[i]][j + people[newId[i]].numRel - other.people[i].numRel] = newId[other.relatives[i][j]];
|
||||
relations[newId[i]][j + people[newId[i]].numRel - other.people[i].numRel] = other.relations[i][j];
|
||||
relatives[newId[i]][j + people[newId[i]].numRel_ - other.people[i].numRel_] = newId[other.relatives[i][j]];
|
||||
relations[newId[i]][j + people[newId[i]].numRel_ - other.people[i].numRel_] = other.relations[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ unsigned Tree::findId(const char* name, const short year, const unsigned char mo
|
||||
//Person sought(name, day, month, year,)
|
||||
for (unsigned i = 0; i < numPeople; ++i)
|
||||
{
|
||||
if (name == people[i].name) //&& (year == people[i].year || !year || !people[i].year) && (month == people[i].month || !month || !people[i].month) && (day == people[i].day || !day || people[i].day))
|
||||
if (name == people[i].name_) //&& (year == people[i].year || !year || !people[i].year) && (month == people[i].month || !month || !people[i].month) && (day == people[i].day || !day || people[i].day))
|
||||
return i;
|
||||
}
|
||||
return Nobody;
|
||||
@@ -172,9 +172,9 @@ unsigned Tree::findId(const char* name, const short year, const unsigned char mo
|
||||
|
||||
unsigned Tree::findOldestAncestor(const unsigned &id, const bool &isMale)const
|
||||
{
|
||||
for (unsigned i = 0; i < people[id].numRel; ++i)
|
||||
for (unsigned i = 0; i < people[id].numRel_; ++i)
|
||||
{
|
||||
if (relations[id][i] == Son && people[ relatives[id][i] ].isMale == isMale)
|
||||
if (relations[id][i] == Son && people[ relatives[id][i] ].isMale_ == isMale)
|
||||
return findOldestAncestor(relatives[id][i], isMale);
|
||||
}
|
||||
return id;
|
||||
@@ -192,9 +192,9 @@ unsigned Tree::findCommonAncestor(const unsigned firstId, const unsigned secondI
|
||||
U16 oldestBday = SHRT_MAX;
|
||||
for (unsigned i = 0; i < numPeople; ++i)
|
||||
{
|
||||
if (visited[i] == 2 && people[i].birth.year<oldestBday)
|
||||
if (visited[i] == 2 && people[i].birth_.year < oldestBday)
|
||||
{
|
||||
oldestBday = people[i].birth.year;
|
||||
oldestBday = people[i].birth_.year;
|
||||
oldestId = i;
|
||||
}
|
||||
}
|
||||
@@ -217,12 +217,12 @@ void Tree::saveTree() const
|
||||
relationFile.write((char*)&numPeople, sizeof(numPeople));*/
|
||||
for (unsigned i = 0; i < numPeople; ++i)
|
||||
{
|
||||
//relativeFile.write((char*)&people[i].numRel, sizeof(people[i].numRel));
|
||||
for (unsigned j = 0; j < people[i].numRel; ++j)
|
||||
//relativeFile.write((char*)&people[i].numRel_, sizeof(people[i].numRel_));
|
||||
for (unsigned j = 0; j < people[i].numRel_; ++j)
|
||||
relativeFile.write(reinterpret_cast<char*>(&relatives[i][j]), sizeof(relatives[i][j]));
|
||||
|
||||
//relationFile.write((char*)&people[i].numRel, sizeof(people[i].numRel));
|
||||
for (unsigned j = 0; j < people[i].numRel; ++j)
|
||||
//relationFile.write((char*)&people[i].numRel_, sizeof(people[i].numRel_));
|
||||
for (unsigned j = 0; j < people[i].numRel_; ++j)
|
||||
relationFile.write(reinterpret_cast<char*>(&relations[i][j]), sizeof(relations[i][j]));
|
||||
}
|
||||
relativeFile.close();
|
||||
@@ -252,15 +252,15 @@ bool Tree::loadTree()
|
||||
relations.resize(numPeople);
|
||||
for (unsigned i = 0; i < numPeople; ++i)
|
||||
{
|
||||
relatives[i].resize(people[i].numRel);
|
||||
for (unsigned j = 0; j < people[i].numRel; ++j)
|
||||
relatives[i].resize(people[i].numRel_);
|
||||
for (unsigned j = 0; j < people[i].numRel_; ++j)
|
||||
relativeFile.read(reinterpret_cast<char*>(&relatives[i][j]), sizeof(relatives[i][j]));
|
||||
relatives[i].sNum(people[i].numRel);
|
||||
relatives[i].sNum(people[i].numRel_);
|
||||
|
||||
relations[i].resize(people[i].numRel);
|
||||
for (unsigned j = 0; j < people[i].numRel; ++j)
|
||||
relations[i].resize(people[i].numRel_);
|
||||
for (unsigned j = 0; j < people[i].numRel_; ++j)
|
||||
relationFile.read(reinterpret_cast<char*>(&relations[i][j]), sizeof(relations[i][j]));
|
||||
relations[i].sNum(people[i].numRel);
|
||||
relations[i].sNum(people[i].numRel_);
|
||||
}
|
||||
relatives.sNum(numPeople);
|
||||
relations.sNum(numPeople);
|
||||
@@ -269,9 +269,9 @@ bool Tree::loadTree()
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Tree::addPerson(const char *name, EventTime birth, bool isMale, unsigned father, unsigned mother)
|
||||
void Tree::addPerson(const char* name, bool isMale, unsigned father, unsigned mother, EventTime birth, EventTime death)
|
||||
{
|
||||
Person newPerson(name, birth, isMale);
|
||||
Person newPerson(name, birth, isMale, death);
|
||||
people.push(newPerson);
|
||||
Array<unsigned> newRelative;
|
||||
relatives.push(newRelative);
|
||||
@@ -294,7 +294,7 @@ bool Tree::addRelation(const unsigned firstId, const Relation type, const unsign
|
||||
return 0;
|
||||
|
||||
unsigned i = 0;
|
||||
for (; i < people[firstId].numRel; ++i) //If they are already relatives
|
||||
for (; i < people[firstId].numRel_; ++i) //If they are already relatives
|
||||
{
|
||||
if (relatives[firstId][i] == secondId)
|
||||
{
|
||||
@@ -302,16 +302,16 @@ bool Tree::addRelation(const unsigned firstId, const Relation type, const unsign
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= people[firstId].numRel)
|
||||
if (i >= people[firstId].numRel_)
|
||||
{
|
||||
relatives[firstId].push(secondId);
|
||||
relations[firstId].push(type);
|
||||
++people[firstId].numRel;
|
||||
++people[firstId].numRel_;
|
||||
}
|
||||
|
||||
if (!opposite)
|
||||
{
|
||||
if (people[secondId].isMale)
|
||||
if (people[secondId].isMale_)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -379,10 +379,10 @@ void Tree::removeRelation(const char* firstName, const char* secondName)
|
||||
void Tree::removePerson(const unsigned id)
|
||||
{
|
||||
unsigned relId; //Íoìåð íà òåêóùèÿ ðîäíèíàòà
|
||||
for (unsigned i = 0; i < people[id].numRel; ++i) //Ïðåìàõâàò ñå âðúçêèòå íà ÷ëåíà çà ïðåìàõâàíå
|
||||
for (unsigned i = 0; i < people[id].numRel_; ++i) //Ïðåìàõâàò ñå âðúçêèòå íà ÷ëåíà çà ïðåìàõâàíå
|
||||
{
|
||||
relId = relatives[id][i];
|
||||
for (unsigned j = 0; j < people[relId].numRel; ++j)
|
||||
for (unsigned j = 0; j < people[relId].numRel_; ++j)
|
||||
{
|
||||
if (relatives[relId][j] == id)
|
||||
{
|
||||
@@ -391,12 +391,12 @@ void Tree::removePerson(const unsigned id)
|
||||
break;
|
||||
}
|
||||
}
|
||||
--people[relId].numRel;
|
||||
--people[relId].numRel_;
|
||||
}
|
||||
for (unsigned i = 0; i < people[numPeople - 2].numRel; ++i) //Ïîñëåäíèÿò ÷ëåí âçåìà íîìåðà íà ïðåìàõíàòèÿ
|
||||
for (unsigned i = 0; i < people[numPeople - 2].numRel_; ++i) //Ïîñëåäíèÿò ÷ëåí âçåìà íîìåðà íà ïðåìàõíàòèÿ
|
||||
{
|
||||
relId = relatives[numPeople - 1][i];
|
||||
for (unsigned j = 0; j < people[relId].numRel; ++j)
|
||||
for (unsigned j = 0; j < people[relId].numRel_; ++j)
|
||||
{
|
||||
if (relatives[relId][j] == numPeople - 1)
|
||||
{
|
||||
@@ -418,23 +418,23 @@ void Tree::removePerson(const char* personName, const short year, const unsigned
|
||||
|
||||
void Tree::removeRelation(const unsigned firstId, const unsigned secondId)
|
||||
{
|
||||
for (unsigned i = 0; i < people[firstId].numRel; ++i)
|
||||
for (unsigned i = 0; i < people[firstId].numRel_; ++i)
|
||||
{
|
||||
if (relatives[firstId][i] == secondId)
|
||||
{
|
||||
relatives[firstId].remove(i);
|
||||
relations[firstId].remove(i);
|
||||
--people[firstId].numRel;
|
||||
--people[firstId].numRel_;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (unsigned i = 0; i < people[secondId].numRel; ++i)
|
||||
for (unsigned i = 0; i < people[secondId].numRel_; ++i)
|
||||
{
|
||||
if (relatives[secondId][i] == firstId)
|
||||
{
|
||||
relatives[secondId].remove(i);
|
||||
relations[secondId].remove(i);
|
||||
--people[secondId].numRel;
|
||||
--people[secondId].numRel_;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -451,52 +451,53 @@ void Tree::print() const
|
||||
|
||||
void Tree::printRel(const unsigned id)const
|
||||
{
|
||||
if (people[id].numRel == 0)
|
||||
cout << people[id].name_;
|
||||
if (people[id].numRel_ == 0)
|
||||
cout << " has no known relatives";
|
||||
else
|
||||
{
|
||||
std::cout << "No relatives";
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned relId;
|
||||
std::cout <<people[id].name<< "'s relatives:\n";
|
||||
for (unsigned i = 0; i < people[id].numRel; ++i)
|
||||
{
|
||||
relId = relatives[id][i];
|
||||
std::cout << people[relId].name << " - ";
|
||||
|
||||
switch (relations[id][i])
|
||||
unsigned relId;
|
||||
cout << "'s relatives:\n";
|
||||
for (unsigned i = 0; i < people[id].numRel_; ++i)
|
||||
{
|
||||
case Father:
|
||||
case Mother:
|
||||
std::cout << (people[relId].isMale ? "son" : "daughter");
|
||||
break;
|
||||
case Son:
|
||||
case Daughter:
|
||||
std::cout << (people[relId].isMale ? "father" : "mother");
|
||||
break;
|
||||
case Brother:
|
||||
case Sister:
|
||||
std::cout << (people[relId].isMale ? "brother" : "sister");
|
||||
break;
|
||||
case HalfBrother:
|
||||
case HalfSister:
|
||||
std::cout << (people[relId].isMale ? "half brother" : "half sister");
|
||||
break;
|
||||
case Husband:
|
||||
std::cout << "wife";
|
||||
break;
|
||||
case Wife:
|
||||
std::cout << "husband";
|
||||
break;
|
||||
case ExHusband:
|
||||
std::cout << "ex-wife\n";
|
||||
break;
|
||||
case ExWife:
|
||||
std::cout << "ex-husband\n";
|
||||
break;
|
||||
relId = relatives[id][i];
|
||||
cout << people[relId].name_ << " - ";
|
||||
|
||||
switch (relations[id][i])
|
||||
{
|
||||
case Father:
|
||||
case Mother:
|
||||
cout << (people[relId].isMale_ ? "son" : "daughter");
|
||||
break;
|
||||
case Son:
|
||||
case Daughter:
|
||||
cout << (people[relId].isMale_ ? "father" : "mother");
|
||||
break;
|
||||
case Brother:
|
||||
case Sister:
|
||||
cout << (people[relId].isMale_ ? "brother" : "sister");
|
||||
break;
|
||||
case HalfBrother:
|
||||
case HalfSister:
|
||||
cout << (people[relId].isMale_ ? "half brother" : "half sister");
|
||||
break;
|
||||
case Husband:
|
||||
cout << "wife";
|
||||
break;
|
||||
case Wife:
|
||||
cout << "husband";
|
||||
break;
|
||||
case ExHusband:
|
||||
cout << "ex-wife\n";
|
||||
break;
|
||||
case ExWife:
|
||||
cout << "ex-husband\n";
|
||||
break;
|
||||
}
|
||||
cout << '\n';
|
||||
}
|
||||
cout << '\n';
|
||||
}
|
||||
std::cout << "\n\n";
|
||||
}
|
||||
|
||||
void Tree::printMember(const unsigned id)const
|
||||
@@ -521,7 +522,7 @@ unsigned Tree::gNumP()const
|
||||
|
||||
void Tree::commonAncestorRec(const unsigned &id, const Array<char> &visited)const
|
||||
{
|
||||
for (unsigned i = 0; i < people[id].numRel; ++i)
|
||||
for (unsigned i = 0; i < people[id].numRel_; ++i)
|
||||
{
|
||||
if (relations[id][i] == Son)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
void saveTree()const;//
|
||||
bool loadTree();
|
||||
|
||||
void addPerson(const char *name, EventTime birth, bool isMale, unsigned father = Nobody, unsigned mother = Nobody);
|
||||
void addPerson(const char* name, bool isMale, unsigned father=Nobody, unsigned mother=Nobody, EventTime birth={}, EventTime death={});
|
||||
bool addRelation(const char* firstName, const Relation, const char* secondName); //Adds a new relation or edits an old one. 0 - failure 1 - success
|
||||
bool addRelation(const unsigned firstId, const Relation, const unsigned secondId, bool opposite=0); //0 - failure 1 - success
|
||||
|
||||
|
||||
Reference in New Issue
Block a user