Add entities w/out logic
This commit is contained in:
parent
1bda2c4047
commit
415ede2b91
11 changed files with 153 additions and 8 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
#include "cargoentity.h"
|
#include "cargoentity.h"
|
||||||
|
|
||||||
CargoEntity::CargoEntity()
|
CargoEntity::CargoEntity(QString c_id, DeliveryPointEntity dest)
|
||||||
{
|
{
|
||||||
|
this->_cargo_id = c_id;
|
||||||
|
this->_destination = dest;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,18 @@
|
||||||
#ifndef CARGOENTITY_H
|
#ifndef CARGOENTITY_H
|
||||||
#define CARGOENTITY_H
|
#define CARGOENTITY_H
|
||||||
|
|
||||||
|
#include "deliverypointentity.h"
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
class CargoEntity
|
class CargoEntity
|
||||||
{
|
{
|
||||||
|
QString _cargo_id;
|
||||||
|
DeliveryPointEntity _destination;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CargoEntity();
|
CargoEntity(QString _cargo_id, DeliveryPointEntity _destination);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CARGOENTITY_H
|
#endif // CARGOENTITY_H
|
||||||
|
|
|
||||||
6
deliverypointentity.cpp
Normal file
6
deliverypointentity.cpp
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#include "deliverypointentity.h"
|
||||||
|
|
||||||
|
DeliveryPointEntity::DeliveryPointEntity(QString title)
|
||||||
|
{
|
||||||
|
this->_title = title;
|
||||||
|
}
|
||||||
19
deliverypointentity.h
Normal file
19
deliverypointentity.h
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
#ifndef DELIVERYPOINTENTITY_H
|
||||||
|
#define DELIVERYPOINTENTITY_H
|
||||||
|
|
||||||
|
#include "storageentity.h"
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
class DeliveryPointEntity
|
||||||
|
{
|
||||||
|
QString _title;
|
||||||
|
std::vector<StorageEntity> _storage;
|
||||||
|
|
||||||
|
public:
|
||||||
|
DeliveryPointEntity(QString title);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DELIVERYPOINTENTITY_H
|
||||||
|
|
@ -10,18 +10,37 @@ CONFIG += c++11
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
authwindow.cpp \
|
authwindow.cpp \
|
||||||
|
cargoeditdialog.cpp \
|
||||||
|
cargoentity.cpp \
|
||||||
|
deliverypointeditdialog.cpp \
|
||||||
|
deliverypointentity.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
mainwindow.cpp \
|
storageeditdialog.cpp \
|
||||||
vesseleditdialog.cpp
|
storageentity.cpp \
|
||||||
|
usereditdialog.cpp \
|
||||||
|
userentity.cpp \
|
||||||
|
vesseleditdialog.cpp \
|
||||||
|
vesselentity.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
authwindow.h \
|
authwindow.h \
|
||||||
mainwindow.h \
|
cargoeditdialog.h \
|
||||||
vesseleditdialog.h
|
cargoentity.h \
|
||||||
|
deliverypointeditdialog.h \
|
||||||
|
deliverypointentity.h \
|
||||||
|
storageeditdialog.h \
|
||||||
|
storageentity.h \
|
||||||
|
usereditdialog.h \
|
||||||
|
userentity.h \
|
||||||
|
vesseleditdialog.h \
|
||||||
|
vesselentity.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
authwindow.ui \
|
authwindow.ui \
|
||||||
mainwindow.ui \
|
cargoeditdialog.ui \
|
||||||
|
deliverypointeditdialog.ui \
|
||||||
|
storageeditdialog.ui \
|
||||||
|
usereditdialog.ui \
|
||||||
vesseleditdialog.ui
|
vesseleditdialog.ui
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
|
|
|
||||||
8
storageentity.cpp
Normal file
8
storageentity.cpp
Normal file
|
|
@ -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);
|
||||||
|
}
|
||||||
19
storageentity.h
Normal file
19
storageentity.h
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
#ifndef STORAGEENTITY_H
|
||||||
|
#define STORAGEENTITY_H
|
||||||
|
|
||||||
|
#include "cargoentity.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
class StorageEntity
|
||||||
|
{
|
||||||
|
int _storage_id;
|
||||||
|
int _max_capacity;
|
||||||
|
std::vector<CargoEntity> _cargo;
|
||||||
|
|
||||||
|
public:
|
||||||
|
StorageEntity(int st_id, int mx_cap);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // STORAGEENTITY_H
|
||||||
14
userentity.cpp
Normal file
14
userentity.cpp
Normal file
|
|
@ -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;
|
||||||
|
}
|
||||||
22
userentity.h
Normal file
22
userentity.h
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef USERENTITY_H
|
||||||
|
#define USERENTITY_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
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
|
||||||
9
vesselentity.cpp
Normal file
9
vesselentity.cpp
Normal file
|
|
@ -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);
|
||||||
|
}
|
||||||
21
vesselentity.h
Normal file
21
vesselentity.h
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef VESSELENTITY_H
|
||||||
|
#define VESSELENTITY_H
|
||||||
|
|
||||||
|
#include "cargoentity.h"
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
class VesselEntity
|
||||||
|
{
|
||||||
|
int _vessel_id;
|
||||||
|
QString _home_port;
|
||||||
|
int _max_capacity;
|
||||||
|
std::vector<CargoEntity> _cargo_list;
|
||||||
|
|
||||||
|
public:
|
||||||
|
VesselEntity(int v_id, QString hp, int mx_cap);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VESSELENTITY_H
|
||||||
Loading…
Add table
Add a link
Reference in a new issue