Files
tft/person.h
T
2022-09-17 20:44:44 +03:00

45 lines
1.1 KiB
C++

#pragma once
#include <string>
#include <fstream>
#include "common/basicTypes.h"
struct EventTime
{
//enum { UNKNOWN_DATE=0, UNKNOWN_TIME=1};
static const I16 UNKNOWN_DATE = 0;
static const I8 UNKNOWN_TIME = -1;
/*explicit*/ EventTime(I16 Year=UNKNOWN_DATE, U8 Month=UNKNOWN_DATE, U16 Day=UNKNOWN_DATE, I8 Hour=UNKNOWN_TIME, I8 Minute=UNKNOWN_TIME);
void print() const;
I16 year; //The year in relation to Chritst's birth - 1 (AD) is the year He was born, -1 (BC) is the previous year. There is no year 0
U8 month;
U16 day;
I8 hour; //0-23
I8 minute; //0-59
};
class Person
{
public:
Person() = default;
Person(const char* Name, EventTime Birth, bool Sex);
bool operator==(const Person &other)const;
void save(std::ofstream &file)const;//
void load(std::ifstream &file);
void rename(const char* newName);
void print()const;
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;
};