Fixed referencing and dereferencing errors in apparatus
This commit is contained in:
parent
d69b18f083
commit
f99974d8ae
12 changed files with 148 additions and 112 deletions
|
|
@ -1,4 +1,6 @@
|
|||
#include "apparatus.h"
|
||||
#include "auth_system.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
const user_entity* auth_system::get_user(const QString &login, bool &success) {
|
||||
|
|
@ -32,29 +34,35 @@ bool auth_system::register_user(const QString &login, const QString &password, U
|
|||
bool exists = false;
|
||||
this->get_user(login, exists);
|
||||
if (!exists) {
|
||||
std::cout << apparatus::instance()->get_auth_subsystem()->users().length() << std::endl;
|
||||
this->_users.push_back(user_entity(login, password, role));
|
||||
std::cout << apparatus::instance()->get_auth_subsystem()->users().length() << std::endl;
|
||||
apparatus::instance()->save();
|
||||
std::cout << apparatus::instance()->get_auth_subsystem()->users().length() << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const QVector<user_entity> auth_system::users() const {
|
||||
const QVector<user_entity>& auth_system::users() const {
|
||||
return this->_users;
|
||||
}
|
||||
|
||||
void auth_system::deserialize_data(QDataStream &stream) {
|
||||
void auth_system::deserialize_data(QDataStream *stream) {
|
||||
int icnt;
|
||||
stream >> icnt;
|
||||
this->_users.resize(icnt);
|
||||
for (int i = 0; i < icnt; i++) {
|
||||
this->_users[i].deserialize(stream);
|
||||
*stream >> icnt;
|
||||
if (icnt > 0) {
|
||||
this->_users.resize(icnt);
|
||||
for (int i = 0; i < icnt; i++) {
|
||||
this->_users[i].deserialize(*stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void auth_system::serialize_data(QDataStream &stream) {
|
||||
stream << this->_users.size();
|
||||
void auth_system::serialize_data(QDataStream *stream) {
|
||||
*stream << this->_users.size();
|
||||
for (auto &item : this->_users) {
|
||||
item.serialize(stream);
|
||||
item.serialize(*stream);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue