Const qualifiers for entities, there needed
This commit is contained in:
parent
cff62f91be
commit
ee4b01713f
11 changed files with 27 additions and 27 deletions
|
|
@ -8,7 +8,7 @@ typedef unsigned long long entity_id;
|
||||||
|
|
||||||
class IEntity : public ISerializable {
|
class IEntity : public ISerializable {
|
||||||
public:
|
public:
|
||||||
virtual entity_id id() = 0;
|
virtual entity_id id() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // IENTITY_H
|
#endif // IENTITY_H
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,15 @@ cargo_entity::cargo_entity(const QString &title, unsigned int volume) : _title(t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entity_id cargo_entity::id() {
|
entity_id cargo_entity::id() const {
|
||||||
return this->_id;
|
return this->_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString cargo_entity::title() {
|
QString cargo_entity::title() const {
|
||||||
return this->_title;
|
return this->_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int cargo_entity::volume() {
|
unsigned int cargo_entity::volume() const {
|
||||||
return this->_volume;
|
return this->_volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@ public:
|
||||||
cargo_entity() = default;
|
cargo_entity() = default;
|
||||||
cargo_entity(const QString &title, unsigned int volume);
|
cargo_entity(const QString &title, unsigned int volume);
|
||||||
|
|
||||||
entity_id id();
|
entity_id id() const;
|
||||||
QString title();
|
QString title() const;
|
||||||
unsigned int volume();
|
unsigned int volume() const;
|
||||||
|
|
||||||
void serialize(QDataStream &output);
|
void serialize(QDataStream &output);
|
||||||
void deserialize(QDataStream &input);
|
void deserialize(QDataStream &input);
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@ dpoint_entity::dpoint_entity(const QString &title) : _title(title) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entity_id dpoint_entity::id() {
|
entity_id dpoint_entity::id() const {
|
||||||
return this->_id;
|
return this->_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString dpoint_entity::title() {
|
QString dpoint_entity::title() const {
|
||||||
return this->_title;
|
return this->_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ public:
|
||||||
dpoint_entity() = default;
|
dpoint_entity() = default;
|
||||||
dpoint_entity(const QString &title);
|
dpoint_entity(const QString &title);
|
||||||
|
|
||||||
entity_id id();
|
entity_id id() const;
|
||||||
QString title();
|
QString title() const;
|
||||||
const QVector<storage_entity> storages();
|
const QVector<storage_entity> storages();
|
||||||
|
|
||||||
void serialize(QDataStream &output);
|
void serialize(QDataStream &output);
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@ storage_entity::storage_entity(unsigned int capacity) : _capacity(capacity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
entity_id storage_entity::id() {
|
entity_id storage_entity::id() const {
|
||||||
return this->_id;
|
return this->_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int storage_entity::capacity() {
|
unsigned int storage_entity::capacity() const {
|
||||||
return this->_capacity;
|
return this->_capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ public:
|
||||||
storage_entity() = default;
|
storage_entity() = default;
|
||||||
storage_entity(unsigned int capacity);
|
storage_entity(unsigned int capacity);
|
||||||
|
|
||||||
entity_id id();
|
entity_id id() const;
|
||||||
unsigned int capacity();
|
unsigned int capacity() const;
|
||||||
const QVector<cargo_entity> cargo();
|
const QVector<cargo_entity> cargo();
|
||||||
|
|
||||||
void add_cargo(cargo_entity object, bool &success);
|
void add_cargo(cargo_entity object, bool &success);
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@ user_entity::user_entity(const QString &login, const QString &password, UserRole
|
||||||
this->_pwd_hash = QCryptographicHash::hash(password.toLocal8Bit(), QCryptographicHash::Sha3_256);
|
this->_pwd_hash = QCryptographicHash::hash(password.toLocal8Bit(), QCryptographicHash::Sha3_256);
|
||||||
}
|
}
|
||||||
|
|
||||||
entity_id user_entity::id() {
|
entity_id user_entity::id() const {
|
||||||
return this->_id;
|
return this->_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString user_entity::login() {
|
const QString user_entity::login() const {
|
||||||
return this->_login;
|
return this->_login;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserRole user_entity::role() {
|
UserRole user_entity::role() const {
|
||||||
return this->_role;
|
return this->_role;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ public:
|
||||||
user_entity() = default;
|
user_entity() = default;
|
||||||
user_entity(const QString &login, const QString &password, UserRole role);
|
user_entity(const QString &login, const QString &password, UserRole role);
|
||||||
|
|
||||||
entity_id id();
|
entity_id id() const;
|
||||||
const QString login();
|
const QString login() const;
|
||||||
UserRole role();
|
UserRole role() const;
|
||||||
bool verify_password(const QString &password) const;
|
bool verify_password(const QString &password) const;
|
||||||
|
|
||||||
void serialize(QDataStream &output);
|
void serialize(QDataStream &output);
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,15 @@ vessel_entity::vessel_entity(const dpoint_entity &harbor, unsigned int capacity)
|
||||||
this->_id = ++vessel_entity::__global_id;
|
this->_id = ++vessel_entity::__global_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity_id vessel_entity::id() {
|
entity_id vessel_entity::id() const {
|
||||||
return this->_id;
|
return this->_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dpoint_entity vessel_entity::harbor() {
|
const dpoint_entity vessel_entity::harbor() const {
|
||||||
return this->_harbor;
|
return this->_harbor;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int vessel_entity::capacity() {
|
unsigned int vessel_entity::capacity() const {
|
||||||
return this->_capacity;
|
return this->_capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@ public:
|
||||||
vessel_entity() = default;
|
vessel_entity() = default;
|
||||||
vessel_entity(const dpoint_entity &harbor, unsigned int capacity);
|
vessel_entity(const dpoint_entity &harbor, unsigned int capacity);
|
||||||
|
|
||||||
entity_id id();
|
entity_id id() const;
|
||||||
const dpoint_entity harbor();
|
const dpoint_entity harbor() const;
|
||||||
unsigned int capacity();
|
unsigned int capacity() const;
|
||||||
const QVector<cargo_entity> cargo();
|
const QVector<cargo_entity> cargo();
|
||||||
|
|
||||||
void serialize(QDataStream &output);
|
void serialize(QDataStream &output);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue