本文整理汇总了C++中SymbolString::addAll方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolString::addAll方法的具体用法?C++ SymbolString::addAll怎么用?C++ SymbolString::addAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolString
的用法示例。
在下文中一共展示了SymbolString::addAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepareMaster
result_t Message::prepareMaster(const unsigned char srcAddress, SymbolString& masterData, istringstream& input, char separator, const unsigned char dstAddress)
{
if (m_isPassive)
return RESULT_ERR_INVALID_ARG; // prepare not possible
SymbolString master(false);
result_t result = master.push_back(srcAddress, false, false);
if (result != RESULT_OK)
return result;
if (dstAddress == SYN) {
if (m_dstAddress == SYN)
return RESULT_ERR_INVALID_ADDR;
result = master.push_back(m_dstAddress, false, false);
}
else
result = master.push_back(dstAddress, false, false);
if (result != RESULT_OK)
return result;
result = master.push_back(m_id[0], false, false);
if (result != RESULT_OK)
return result;
result = master.push_back(m_id[1], false, false);
if (result != RESULT_OK)
return result;
unsigned char addData = m_data->getLength(pt_masterData);
result = master.push_back((unsigned char)(m_id.size() - 2 + addData), false, false);
if (result != RESULT_OK)
return result;
for (size_t i = 2; i < m_id.size(); i++) {
result = master.push_back(m_id[i], false, false);
if (result != RESULT_OK)
return result;
}
result = m_data->write(input, pt_masterData, master, (unsigned char)(m_id.size() - 2), separator);
if (result != RESULT_OK)
return result;
time(&m_lastUpdateTime);
switch (master.compareMaster(m_lastMasterData)) {
case 1: // completely different
m_lastChangeTime = m_lastUpdateTime;
m_lastMasterData = master;
break;
case 2: // only master address is different
m_lastMasterData = master;
break;
}
masterData.addAll(master);
return result;
}
示例2: prepareSlave
result_t Message::prepareSlave(SymbolString& slaveData)
{
if (!m_isPassive || m_isWrite)
return RESULT_ERR_INVALID_ARG; // prepare not possible
SymbolString slave(false);
unsigned char addData = m_data->getLength(pt_slaveData);
result_t result = slave.push_back(addData, false, false);
if (result != RESULT_OK)
return result;
istringstream input; // TODO create input from database of internal variables
result = m_data->write(input, pt_slaveData, slave, 0);
if (result != RESULT_OK)
return result;
time(&m_lastUpdateTime);
if (slave != m_lastSlaveData) {
m_lastChangeTime = m_lastUpdateTime;
m_lastSlaveData = slave;
}
slaveData.addAll(slave);
return result;
}