Skip to content

Commit

Permalink
add = operators
Browse files Browse the repository at this point in the history
  • Loading branch information
john30 committed Apr 5, 2021
1 parent 4d11cf6 commit 058c7d6
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion src/lib/ebus/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class SymbolString {
void clear() { m_data.clear(); }


private:
protected:
/**
* Hidden copy constructor.
* @param str the @a SymbolString to copy from.
Expand All @@ -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) {}
};


Expand All @@ -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) {}
};


Expand Down

0 comments on commit 058c7d6

Please sign in to comment.