mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-12-22 10:24:26 +01:00
Improved Clientmessage
This commit is contained in:
parent
cba6e337ee
commit
38a8ccadea
@ -17,6 +17,27 @@ Clientmessage::Clientmessage(std::string token,
|
||||
{
|
||||
}
|
||||
|
||||
Clientmessage::Clientmessage() :
|
||||
_token(),
|
||||
_isOpen(false),
|
||||
_doormessage()
|
||||
{
|
||||
}
|
||||
|
||||
Clientmessage &Clientmessage::operator=(const Clientmessage &rhs)
|
||||
{
|
||||
// Protect against self assignement
|
||||
if (this == &rhs) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
this->_token = rhs._token;
|
||||
this->_isOpen = rhs._isOpen;
|
||||
this->_doormessage = rhs._doormessage;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string Clientmessage::toJson() const
|
||||
{
|
||||
Json::StyledWriter writer;
|
||||
|
@ -13,6 +13,9 @@ public:
|
||||
Clientmessage(std::string token,
|
||||
bool isOpen,
|
||||
Doormessage doormessage);
|
||||
Clientmessage();
|
||||
|
||||
Clientmessage &operator=(const Clientmessage& rhs);
|
||||
|
||||
static Clientmessage fromJson(const Json::Value &root);
|
||||
static Clientmessage fromString(const std::string &json);
|
||||
@ -24,11 +27,11 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
const std::string _token;
|
||||
const bool _isOpen;
|
||||
const Doormessage _doormessage;
|
||||
std::string _token;
|
||||
bool _isOpen;
|
||||
Doormessage _doormessage;
|
||||
|
||||
static const std::string _tokenKey;
|
||||
const static std::string _tokenKey;
|
||||
const static std::string _unlockButtonKey;
|
||||
const static std::string _lockButtonKey;
|
||||
const static std::string _emergencyUnlockKey;
|
||||
|
Loading…
Reference in New Issue
Block a user