MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / ParseCommandClassOption

Method ParseCommandClassOption

cpp/src/command_classes/CommandClasses.cpp:286–324  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Parse a comma delimited list of included/excluded command classes -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

284// Parse a comma delimited list of included/excluded command classes
285//-----------------------------------------------------------------------------
286void CommandClasses::ParseCommandClassOption
287(
288 string const& _optionStr,
289 bool const _include
290)
291{
292 size_t pos = 0;
293 size_t start = 0;
294 bool parsing = true;
295 while( parsing )
296 {
297 string ccStr;
298
299 pos = _optionStr.find_first_of( ",", start );
300 if( string::npos == pos )
301 {
302 ccStr = _optionStr.substr( start );
303 parsing = false;
304 }
305 else
306 {
307 ccStr = _optionStr.substr( start, pos-start );
308 start = pos + 1;
309 }
310
311 if( ccStr != "" )
312 {
313 uint8 ccIdx = GetCommandClassId( ccStr );
314 if( _include )
315 {
316 m_supportedCommandClasses[ccIdx>>5] |= (1u<<(ccIdx&0x1f));
317 }
318 else
319 {
320 m_supportedCommandClasses[ccIdx>>5] &= ~(1u<<(ccIdx&0x1f));
321 }
322 }
323 }
324}
325
326//-----------------------------------------------------------------------------
327// <CommandClasses::GetCommandClassId>

Callers 1

Calls 1

GetCommandClassIdFunction · 0.85

Tested by

no test coverage detected