From b1333c74a58424094415520152a4af23dd4ed788 Mon Sep 17 00:00:00 2001 From: Andrew nuark G Date: Tue, 15 Dec 2020 16:40:45 +0700 Subject: [PATCH] Add delivery point entity --- entities/dpoint_entity.cpp | 21 +++++++++++++++++++++ entities/dpoint_entity.h | 25 +++++++++++++++++++++++++ sea_transport.pro | 2 ++ 3 files changed, 48 insertions(+) create mode 100644 entities/dpoint_entity.cpp create mode 100644 entities/dpoint_entity.h diff --git a/entities/dpoint_entity.cpp b/entities/dpoint_entity.cpp new file mode 100644 index 0000000..60e17e8 --- /dev/null +++ b/entities/dpoint_entity.cpp @@ -0,0 +1,21 @@ +#include "dpoint_entity.h" + +dpoint_entity::dpoint_entity(const QString &title) : _title(title) { + this->_id = 0; + auto hash = QCryptographicHash::hash(title.toLocal8Bit(), QCryptographicHash::Md5); + for (auto bit : hash) { + this->_id += bit; + } +} + +unsigned long long dpoint_entity::id() { + return this->_id; +} + +QString dpoint_entity::title() { + return this->_title; +} + +const QVector dpoint_entity::storages_ids() { + return this->_storages_ids; +} diff --git a/entities/dpoint_entity.h b/entities/dpoint_entity.h new file mode 100644 index 0000000..c36154f --- /dev/null +++ b/entities/dpoint_entity.h @@ -0,0 +1,25 @@ +#ifndef DPOINT_ENTITY_H +#define DPOINT_ENTITY_H + +#include +#include +#include + + +class dpoint_entity +{ +private: + unsigned long long _id; + QString _title; + QVector _storages_ids; + +public: + dpoint_entity() = default; + dpoint_entity(const QString &title); + + unsigned long long id(); + QString title(); + const QVector storages_ids(); +}; + +#endif // DPOINT_ENTITY_H diff --git a/sea_transport.pro b/sea_transport.pro index 5f08e97..3c98b9f 100644 --- a/sea_transport.pro +++ b/sea_transport.pro @@ -13,6 +13,7 @@ SOURCES += \ cargoeditdialog.cpp \ deliverypointeditdialog.cpp \ entities/cargo_entity.cpp \ + entities/dpoint_entity.cpp \ main.cpp \ storageeditdialog.cpp \ usereditdialog.cpp \ @@ -23,6 +24,7 @@ HEADERS += \ cargoeditdialog.h \ deliverypointeditdialog.h \ entities/cargo_entity.h \ + entities/dpoint_entity.h \ storageeditdialog.h \ usereditdialog.h \ vesseleditdialog.h