diff --git a/cargoentity.cpp b/cargoentity.cpp index dbedcc0..1b63d35 100644 --- a/cargoentity.cpp +++ b/cargoentity.cpp @@ -1,6 +1,7 @@ #include "cargoentity.h" -CargoEntity::CargoEntity() +CargoEntity::CargoEntity(QString c_id, DeliveryPointEntity dest) { - + this->_cargo_id = c_id; + this->_destination = dest; } diff --git a/cargoentity.h b/cargoentity.h index e5fbdf0..a682774 100644 --- a/cargoentity.h +++ b/cargoentity.h @@ -1,11 +1,18 @@ #ifndef CARGOENTITY_H #define CARGOENTITY_H +#include "deliverypointentity.h" + +#include + class CargoEntity { + QString _cargo_id; + DeliveryPointEntity _destination; + public: - CargoEntity(); + CargoEntity(QString _cargo_id, DeliveryPointEntity _destination); }; #endif // CARGOENTITY_H diff --git a/deliverypointentity.cpp b/deliverypointentity.cpp new file mode 100644 index 0000000..f541f83 --- /dev/null +++ b/deliverypointentity.cpp @@ -0,0 +1,6 @@ +#include "deliverypointentity.h" + +DeliveryPointEntity::DeliveryPointEntity(QString title) +{ + this->_title = title; +} diff --git a/deliverypointentity.h b/deliverypointentity.h new file mode 100644 index 0000000..6cb566f --- /dev/null +++ b/deliverypointentity.h @@ -0,0 +1,19 @@ +#ifndef DELIVERYPOINTENTITY_H +#define DELIVERYPOINTENTITY_H + +#include "storageentity.h" + +#include +#include + + +class DeliveryPointEntity +{ + QString _title; + std::vector _storage; + +public: + DeliveryPointEntity(QString title); +}; + +#endif // DELIVERYPOINTENTITY_H diff --git a/sea_transport.pro b/sea_transport.pro index fa7d61e..16df44b 100644 --- a/sea_transport.pro +++ b/sea_transport.pro @@ -10,18 +10,37 @@ CONFIG += c++11 SOURCES += \ authwindow.cpp \ + cargoeditdialog.cpp \ + cargoentity.cpp \ + deliverypointeditdialog.cpp \ + deliverypointentity.cpp \ main.cpp \ - mainwindow.cpp \ - vesseleditdialog.cpp + storageeditdialog.cpp \ + storageentity.cpp \ + usereditdialog.cpp \ + userentity.cpp \ + vesseleditdialog.cpp \ + vesselentity.cpp HEADERS += \ authwindow.h \ - mainwindow.h \ - vesseleditdialog.h + cargoeditdialog.h \ + cargoentity.h \ + deliverypointeditdialog.h \ + deliverypointentity.h \ + storageeditdialog.h \ + storageentity.h \ + usereditdialog.h \ + userentity.h \ + vesseleditdialog.h \ + vesselentity.h FORMS += \ authwindow.ui \ - mainwindow.ui \ + cargoeditdialog.ui \ + deliverypointeditdialog.ui \ + storageeditdialog.ui \ + usereditdialog.ui \ vesseleditdialog.ui # Default rules for deployment. diff --git a/storageentity.cpp b/storageentity.cpp new file mode 100644 index 0000000..31b70bb --- /dev/null +++ b/storageentity.cpp @@ -0,0 +1,8 @@ +#include "storageentity.h" + +StorageEntity::StorageEntity(int st_id, int mx_cap) +{ + this->_storage_id = st_id; + this->_max_capacity = mx_cap; + this->_cargo.reserve(mx_cap); +} diff --git a/storageentity.h b/storageentity.h new file mode 100644 index 0000000..5ec6d36 --- /dev/null +++ b/storageentity.h @@ -0,0 +1,19 @@ +#ifndef STORAGEENTITY_H +#define STORAGEENTITY_H + +#include "cargoentity.h" + +#include + + +class StorageEntity +{ + int _storage_id; + int _max_capacity; + std::vector _cargo; + +public: + StorageEntity(int st_id, int mx_cap); +}; + +#endif // STORAGEENTITY_H diff --git a/userentity.cpp b/userentity.cpp new file mode 100644 index 0000000..55971e9 --- /dev/null +++ b/userentity.cpp @@ -0,0 +1,14 @@ +#include "userentity.h" + +UserEntity::UserEntity(QString login, QString password, UserEntity::UserRoleEnum role) +{ + this->_login = login; + + this->_password_hash = 0; + for (auto pchar : password) { + this->_password_hash += pchar.unicode(); + } + this->_password_hash %= (1 << 16); + + this->_role = role; +} diff --git a/userentity.h b/userentity.h new file mode 100644 index 0000000..f1ec583 --- /dev/null +++ b/userentity.h @@ -0,0 +1,22 @@ +#ifndef USERENTITY_H +#define USERENTITY_H + +#include + +typedef long long pwd_type; + +class UserEntity +{ + QString _login; + pwd_type _password_hash; + enum UserRoleEnum { + ADMINISTRATOR = 0, + DISPATCHER = 1, + CAPTAIN = 2 + } _role; + +public: + UserEntity(QString login, QString password, UserEntity::UserRoleEnum role); +}; + +#endif // USERENTITY_H diff --git a/vesselentity.cpp b/vesselentity.cpp new file mode 100644 index 0000000..14cf57d --- /dev/null +++ b/vesselentity.cpp @@ -0,0 +1,9 @@ +#include "vesselentity.h" + +VesselEntity::VesselEntity(int v_id, QString hp, int mx_cap) +{ + this->_vessel_id = v_id; + this->_home_port = hp; + this->_max_capacity = mx_cap; + this->_cargo_list.reserve(mx_cap); +} diff --git a/vesselentity.h b/vesselentity.h new file mode 100644 index 0000000..abb8453 --- /dev/null +++ b/vesselentity.h @@ -0,0 +1,21 @@ +#ifndef VESSELENTITY_H +#define VESSELENTITY_H + +#include "cargoentity.h" + +#include +#include + + +class VesselEntity +{ + int _vessel_id; + QString _home_port; + int _max_capacity; + std::vector _cargo_list; + +public: + VesselEntity(int v_id, QString hp, int mx_cap); +}; + +#endif // VESSELENTITY_H