Improved dpoint entity interactions
This commit is contained in:
parent
96a8e7c586
commit
44ccc07360
2 changed files with 15 additions and 6 deletions
|
|
@ -16,14 +16,22 @@ QString dpoint_entity::title() {
|
|||
return this->_title;
|
||||
}
|
||||
|
||||
const QVector<entity_id> dpoint_entity::storages_ids() {
|
||||
return this->_storages_ids;
|
||||
const QVector<storage_entity> dpoint_entity::storages() {
|
||||
return this->_storages;
|
||||
}
|
||||
|
||||
void dpoint_entity::serialize(QDataStream &output) {
|
||||
output << this->_id << this->_title << this->_storages_ids;
|
||||
output << this->_id << this->_title << this->_storages.size();
|
||||
for (auto &item : this->_storages) {
|
||||
item.serialize(output);
|
||||
}
|
||||
}
|
||||
|
||||
void dpoint_entity::deserialize(QDataStream &input) {
|
||||
input >> this->_id >> this->_title >> this->_storages_ids;
|
||||
int icnt;
|
||||
input >> this->_id >> this->_title >> icnt;
|
||||
this->_storages.resize(icnt);
|
||||
for (int i = 0; i < icnt; i++) {
|
||||
this->_storages[i].deserialize(input);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#define DPOINT_ENTITY_H
|
||||
|
||||
#include "IEntity.h"
|
||||
#include "storage_entity.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
|
@ -12,7 +13,7 @@ class dpoint_entity : public IEntity {
|
|||
private:
|
||||
entity_id _id;
|
||||
QString _title;
|
||||
QVector<entity_id> _storages_ids;
|
||||
QVector<storage_entity> _storages;
|
||||
|
||||
public:
|
||||
dpoint_entity() = default;
|
||||
|
|
@ -20,7 +21,7 @@ public:
|
|||
|
||||
entity_id id();
|
||||
QString title();
|
||||
const QVector<entity_id> storages_ids();
|
||||
const QVector<storage_entity> storages();
|
||||
|
||||
void serialize(QDataStream &output);
|
||||
void deserialize(QDataStream &input);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue