fix save and load

This commit is contained in:
vrd
2023-01-21 19:10:32 +02:00
parent 9434edbe36
commit 5457b171e8
6 changed files with 85 additions and 226 deletions
+13 -12
View File
@@ -20,13 +20,19 @@ struct EventTime
I8 minute; //0-59
};
enum: U8 {
enum Genders: U8
{
FEMALE = 0,
MALE
};
enum BoxColors: U8 {
COLOR_MALE = 1,
COLOR_FEMALE,
COLOR_SELECTED
};
enum: U8 {
enum DisplayDimensons: U8 {
BOX_HEIGHT = 5,
LINK_HEIGHT = 3
};
@@ -35,20 +41,21 @@ class Person
{
public:
Person() = default;
Person(const char* name, EventTime birth, bool sex, EventTime death);
Person(const char* name, EventTime birth={}, bool sex=true, EventTime death={});
/* Person(Person&&) = default; */
/* Person& operator=(Person&&) = default; */
/* Person& operator=(const Person&) = default; */
bool operator==(const Person &other)const;
bool operator==(const Person &other) const;
void save(std::ofstream &file)const;//
void load(std::ifstream &file);
void write(std::ofstream &file) const;//
void read(std::ifstream &file);
void rename(const char* newName);
void displayInfo() const;
bool isMale() const;
const EventTime& birth() const { return birth_; };
U16 boxWidth() const;
/* Draw a Person's box on the terminal
@@ -56,14 +63,8 @@ public:
returns the width of the box*/
void draw(I16 drawY, I16 drawX, bool selected, bool hasSpouse, bool isSpouse, bool hasChildren=false) const;
/* WINDOW* createPad()const; */
/* staitc constexpr U8 BOX_HEIGHT = 5; */
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_;