added option to skip last symbol to addAll()

This commit is contained in:
john30
2016-11-06 09:19:50 +01:00
parent 726b9ecfeb
commit 0a366c58b3
2 changed files with 8 additions and 3 deletions
+6 -2
View File
@@ -47,12 +47,16 @@ static const unsigned char CRC_LOOKUP_TABLE[] =
};
void SymbolString::addAll(const SymbolString& str)
void SymbolString::addAll(const SymbolString& str, bool skipLastSymbol)
{
bool addCrc = m_unescapeState == 0;
bool isEscaped = str.m_unescapeState == 0;
vector<unsigned char> data = str.m_data;
for (size_t i = 0; i < data.size(); i++) {
size_t end = data.size();
if (end>0 && skipLastSymbol) {
end--;
}
for (size_t i = 0; i < end; i++) {
push_back(data[i], isEscaped, addCrc);
}
if (addCrc)