MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / SetProtocolFormat

Method SetProtocolFormat

DSView/pv/config/appconfig.cpp:373–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373void AppConfig::SetProtocolFormat(const std::string &protocolName, const std::string &value)
374{
375 bool bChange = false;
376 for (StringPair &o : appOptions.m_protocolFormats){
377 if (o.m_key == protocolName){
378 o.m_value = value;
379 bChange = true;
380 break;
381 }
382 }
383
384 if (!bChange)
385 {
386 if (appOptions.m_protocolFormats.size() > MAX_PROTOCOL_FORMAT_LIST)
387 {
388 while (appOptions.m_protocolFormats.size() < MAX_PROTOCOL_FORMAT_LIST)
389 {
390 appOptions.m_protocolFormats.erase(appOptions.m_protocolFormats.begin());
391 }
392 }
393 appOptions.m_protocolFormats.push_back(StringPair(protocolName, value));
394 bChange = true;
395 }
396
397 if (bChange){
398 SaveApp();
399 }
400}
401
402std::string AppConfig::GetProtocolFormat(const std::string &protocolName)
403{

Callers

nothing calls this directly

Calls 2

StringPairClass · 0.85
sizeMethod · 0.80

Tested by

no test coverage detected