All entities now have GID

This commit is contained in:
Andrew nuark G 2020-12-23 19:00:57 +07:00
parent eb097588ba
commit 2be2e9f5e3
9 changed files with 59 additions and 11 deletions

View file

@ -1,8 +1,10 @@
#include "user_entity.h"
entity_id user_entity::__global_id = 0;
user_entity::user_entity() {
this->_id += QRandomGenerator().generate64();
this->_id = ++user_entity::__global_id + QRandomGenerator().generate64();
}
user_entity::user_entity(const QString &login, const QString &password, UserRole role) : _login(login), _role(role) {
@ -47,3 +49,11 @@ void user_entity::serialize(QDataStream &output) {
void user_entity::deserialize(QDataStream &input) {
input >> this->_id >> this->_login >> this->_role >> this->_pwd_hash;
}
void user_entity::preloadGlobalId(entity_id gid) {
user_entity::__global_id = gid;
}
entity_id user_entity::GID() {
return user_entity::__global_id;
}