From 058c7d64c4bc370c3270e482595b296205fedc3d Mon Sep 17 00:00:00 2001 From: John Date: Mon, 5 Apr 2021 09:53:42 +0200 Subject: [PATCH] add = operators --- src/lib/ebus/symbol.h | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/lib/ebus/symbol.h b/src/lib/ebus/symbol.h index 15a2fee3f..c8f5d8ca8 100755 --- a/src/lib/ebus/symbol.h +++ b/src/lib/ebus/symbol.h @@ -334,7 +334,7 @@ class SymbolString { void clear() { m_data.clear(); } - private: + protected: /** * Hidden copy constructor. * @param str the @a SymbolString to copy from. @@ -359,6 +359,25 @@ class MasterSymbolString : public SymbolString { * Creates a new empty instance. */ MasterSymbolString() : SymbolString(true) {} + + MasterSymbolString& operator=(const MasterSymbolString& other) { + this->m_data = other.m_data; + this->m_isMaster = other.m_isMaster; + return *this; + } + + MasterSymbolString& operator=(const MasterSymbolString* other) { + this->m_data = other->m_data; + this->m_isMaster = other->m_isMaster; + return *this; + } + + private: + /** + * Copy constructor. + * @param str the @a MasterSymbolString to copy from. + */ + MasterSymbolString(const MasterSymbolString& str) : SymbolString(str) {} }; @@ -371,6 +390,25 @@ class SlaveSymbolString : public SymbolString { * Creates a new empty instance. */ SlaveSymbolString() : SymbolString(false) {} + + SlaveSymbolString& operator=(const SlaveSymbolString& other) { + this->m_data = other.m_data; + this->m_isMaster = other.m_isMaster; + return *this; + } + + SlaveSymbolString& operator=(const SlaveSymbolString* other) { + this->m_data = other->m_data; + this->m_isMaster = other->m_isMaster; + return *this; + } + + private: + /** + * Copy constructor. + * @param str the @a SlaveSymbolString to copy from. + */ + SlaveSymbolString(const SlaveSymbolString& str) : SymbolString(str) {} };