added Symbol::compareMaster to avoid updating last message change time when only the querying master was modified

This commit is contained in:
john30
2015-05-14 09:50:28 +02:00
parent fae340f0be
commit d573fff746
2 changed files with 34 additions and 4 deletions
+15
View File
@@ -93,6 +93,21 @@ public:
*/
bool operator!=(SymbolString& other) { return m_unescapeState!=other.m_unescapeState || m_data!=other.m_data; }
/**
* Compares this instance to the other instance while treating both as master data (i.e. starting with the master address and ending with the CRC).
* @param other the other instance.
* @return 0 if this instance is equal to the other instance (i.e. both escaped or both unescaped and same symbols),
* 1 if this instance is completely different to the other instance,
* 2 if this instance only differs from the other instance in the first byte (the master address).
*/
int compareMaster(SymbolString& other) {
if (m_unescapeState!=other.m_unescapeState || m_data.size()!=other.m_data.size()) return 1;
if (m_data==other.m_data) return 0;
if (m_data.size()==1) return 2;
if (equal(m_data.begin()+1, m_data.end()-1, other.m_data.begin()+1)) return 2;
return 1;
}
/**
* Appends a the symbol to the end of the symbol string and escapes/unescapes it if necessary.
* @param value the symbol to append.