Add serialization and comparison to User class

This commit is contained in:
E. Kozlovskaya 2021-01-03 23:22:49 +07:00
parent 02869cdf6e
commit de2f8e01b2
2 changed files with 30 additions and 6 deletions

View file

@ -8,7 +8,7 @@
#include "profession.h"
typedef QUuid UID;
typedef QVector<Profession> ProfessionsList;
typedef QVector<PID> ProfessionsList;
class User {
private:
@ -21,9 +21,9 @@ private:
ProfessionsList mProfessions;
PID mCurrentProfession = 0;
public:
User() = default;
public:
UID uID() const;
QString getLogin() const;
bool checkPassword(const QString &password);
@ -39,6 +39,10 @@ public:
bool addProfession(const Profession &p);
bool setCurrentProfession(const Profession &p);
void removeProfession(const Profession &p);
friend bool operator==(const User &l, const User &r);
friend QDataStream& operator<<(QDataStream &stream, const User &usr);
friend QDataStream& operator>>(QDataStream &stream, User &usr);
};
#endif // USER_H