From 9cea334407c1a12a47beb2a35cbc418ee929beec Mon Sep 17 00:00:00 2001 From: john30 Date: Sat, 6 Dec 2014 12:35:41 +0100 Subject: [PATCH] better ==, added commented code for debug, added todo --- src/lib/ebus/symbol.cpp | 2 +- src/lib/ebus/symbol.h | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/lib/ebus/symbol.cpp b/src/lib/ebus/symbol.cpp index 6e35772c..253236d4 100644 --- a/src/lib/ebus/symbol.cpp +++ b/src/lib/ebus/symbol.cpp @@ -48,7 +48,7 @@ static const unsigned char CRC_LOOKUP_TABLE[] = }; -SymbolString::SymbolString(const string& str) +SymbolString::SymbolString(const string& str) //TODO use a factory method instead : m_unescapeState(0), m_crc(0) { // parse + escape diff --git a/src/lib/ebus/symbol.h b/src/lib/ebus/symbol.h index adf5501b..b90a51d8 100644 --- a/src/lib/ebus/symbol.h +++ b/src/lib/ebus/symbol.h @@ -85,7 +85,20 @@ public: * @param other the other instance. * @return true if this instance is equal to the other instance (i.e. both escaped or both unescaped and same symbols). */ - bool operator==(SymbolString other) { return m_unescapeState==other.m_unescapeState && m_data==other.m_data; } + bool operator==(SymbolString& other) { + return m_unescapeState==other.m_unescapeState && m_data==other.m_data; + /*bool ret = m_unescapeState==other.m_unescapeState && m_data==other.m_data; + for (int i=0; i(m_data[i])<<" "; + } + cout<<"["<(m_unescapeState)<<"]"; + cout<<(ret?" == ":" != "); + for (int i=0; i(other.m_data[i])<<" "; + } + cout<<"["<(other.m_unescapeState)<<"]"<