MCPcopy Create free account
hub / github.com/collin80/SavvyCAN / parseOperandString

Method parseOperandString

framesenderwindow.cpp:737–766  ·  view source on GitHub ↗

Turn a set of tokens into an operand

Source from the content-addressed store, hash-verified

735
736//Turn a set of tokens into an operand
737void FrameSenderWindow::parseOperandString(QStringList tokens, ModifierOperand &operand)
738{
739 qDebug() << "parseOperandString";
740 //example string -> bus:0:id:200:d3
741
742 operand.bus = -1;
743 operand.ID = -2;
744 operand.databyte = 0;
745
746 for (int i = 0; i < tokens.length(); i++)
747 {
748 if (tokens[i] == "BUS")
749 {
750 operand.bus = Utility::ParseStringToNum(tokens[++i]);
751 }
752 else if (tokens[i] == "ID")
753 {
754 operand.ID = Utility::ParseStringToNum(tokens[++i]);
755 }
756 else if (tokens[i].length() == 2 && tokens[i].startsWith("D"))
757 {
758 operand.databyte = Utility::ParseStringToNum(tokens[i].right(tokens[i].length() - 1));
759 }
760 else
761 {
762 operand.databyte = Utility::ParseStringToNum(tokens[i]);
763 operand.ID = 0; //special ID to show this is a number not a look up.
764 }
765 }
766}
767
768ModifierOperationType FrameSenderWindow::parseOperation(QString op)
769{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected