Code style refactoring done
This commit is contained in:
parent
02766bd5d2
commit
c5f1572efa
36 changed files with 202 additions and 130 deletions
|
|
@ -7,7 +7,8 @@ cargo_entity::cargo_entity() {
|
|||
this->_id = ++cargo_entity::__global_id + QRandomGenerator().generate64();
|
||||
}
|
||||
|
||||
cargo_entity::cargo_entity(const QString &title, unsigned int volume) : _title(title), _volume(volume) {
|
||||
cargo_entity::cargo_entity(const QString &title, unsigned int volume)
|
||||
: _title(title), _volume(volume) {
|
||||
this->_id = volume;
|
||||
auto hash = QCryptographicHash::hash(title.toLocal8Bit(), QCryptographicHash::Md5);
|
||||
for (auto bit : hash) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ dpoint_entity::dpoint_entity() {
|
|||
this->_id = ++dpoint_entity::__global_id + QRandomGenerator().generate64();
|
||||
}
|
||||
|
||||
dpoint_entity::dpoint_entity(entity_id dispatcher_id, const QString &title) : _dispatcher_id(dispatcher_id), _title(title) {
|
||||
dpoint_entity::dpoint_entity(entity_id dispatcher_id, const QString &title)
|
||||
: _dispatcher_id(dispatcher_id), _title(title) {
|
||||
this->_id = dispatcher_id;
|
||||
auto hash = QCryptographicHash::hash(title.toLocal8Bit(), QCryptographicHash::Md5);
|
||||
for (auto bit : hash) {
|
||||
|
|
|
|||
|
|
@ -7,12 +7,15 @@ user_entity::user_entity() {
|
|||
this->_id = ++user_entity::__global_id + QRandomGenerator().generate64();
|
||||
}
|
||||
|
||||
user_entity::user_entity(const QString &login, const QString &password, UserRole role) : _login(login), _role(role) {
|
||||
this->_pwd_hash = QCryptographicHash::hash(password.toLocal8Bit(), QCryptographicHash::Sha3_256);
|
||||
user_entity::user_entity(const QString &login, const QString &password, UserRole role)
|
||||
: _login(login), _role(role) {
|
||||
this->_pwd_hash = QCryptographicHash::hash(password.toLocal8Bit(),
|
||||
QCryptographicHash::Sha3_256);
|
||||
foreach (auto bit, this->_pwd_hash) {
|
||||
this->_id += bit;
|
||||
}
|
||||
foreach (auto bit, QCryptographicHash::hash(login.toLocal8Bit(), QCryptographicHash::Sha3_256)) {
|
||||
foreach (auto bit,
|
||||
QCryptographicHash::hash(login.toLocal8Bit(), QCryptographicHash::Sha3_256)) {
|
||||
this->_id += bit;
|
||||
}
|
||||
this->_id += QRandomGenerator().generate64();
|
||||
|
|
@ -31,11 +34,13 @@ UserRole user_entity::role() const {
|
|||
}
|
||||
|
||||
bool user_entity::verify_password(const QString &password) const {
|
||||
return (this->_pwd_hash == QCryptographicHash::hash(password.toLocal8Bit(), QCryptographicHash::Sha3_256));
|
||||
return (this->_pwd_hash == QCryptographicHash::hash(password.toLocal8Bit(),
|
||||
QCryptographicHash::Sha3_256));
|
||||
}
|
||||
|
||||
void user_entity::set_password(const QString &new_password) {
|
||||
this->_pwd_hash = QCryptographicHash::hash(new_password.toLocal8Bit(), QCryptographicHash::Sha3_256);
|
||||
this->_pwd_hash = QCryptographicHash::hash(new_password.toLocal8Bit(),
|
||||
QCryptographicHash::Sha3_256);
|
||||
}
|
||||
|
||||
void user_entity::set_role(UserRole new_role) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ enum class UserRole {
|
|||
ADMINISTRATOR, DISPATCHER, SKIPPER
|
||||
};
|
||||
|
||||
|
||||
class user_entity : public IEntity {
|
||||
private:
|
||||
static entity_id __global_id;
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@ vessel_entity::vessel_entity() {
|
|||
this->_id = ++vessel_entity::__global_id + QRandomGenerator().generate64();
|
||||
}
|
||||
|
||||
vessel_entity::vessel_entity(QString skipper, entity_id harbor_id, unsigned int capacity) : _skipper(skipper), _harbor_id(harbor_id), _capacity(capacity) {
|
||||
this->_id = ++vessel_entity::__global_id + harbor_id + capacity + QRandomGenerator().generate64();
|
||||
vessel_entity::vessel_entity(QString skipper, entity_id harbor_id, unsigned int capacity)
|
||||
: _skipper(skipper), _harbor_id(harbor_id), _capacity(capacity) {
|
||||
this->_id = ++vessel_entity::__global_id + harbor_id + capacity
|
||||
+ QRandomGenerator().generate64();
|
||||
}
|
||||
|
||||
entity_id vessel_entity::id() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue