Compare commits

...

2 Commits

Author SHA1 Message Date
nasiCurious 7225534a28 pointer 2 years ago
nasiCurious 80ec20d68a pointer 2 years ago
  1. 2
      CommandDetector.pro.user
  2. 5
      logic/include/CommandDecoder.h
  3. 15
      logic/src/CommandDecoder.cpp

2
CommandDetector.pro.user

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.0, 2022-10-29T16:44:05. -->
<!-- Written by QtCreator 4.10.0, 2022-11-19T14:21:34. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

5
logic/include/CommandDecoder.h

@ -7,9 +7,8 @@
class CommandDecoder
{
private:
QList<CommandsType> decodedList;
bool isNextItemValue = true;
int j = 0;
QList<CommandsType> _decodedList;
bool _isNextItemValue = true;
int _argc;
bool isCommand(char* argv);

15
logic/src/CommandDecoder.cpp

@ -19,13 +19,14 @@ void CommandDecoder::checkIfEnoughArgsAreProvided(int argc)
{
if(argc < 2)
{
throw"the usage should lookLike this Sin <parameter>";
throw"the usage should lookLike this Cin <parameter>";
}
}
//****************************************************************
QList<CommandsType> CommandDecoder::CommandValueDecoder(char* argv[])
{
int j = 0;
while(j < _argc)
{
CommandsType sample;
@ -41,18 +42,18 @@ QList<CommandsType> CommandDecoder::CommandValueDecoder(char* argv[])
j++;
}
return decodedList;
return _decodedList;
}
//****************************************************************
void CommandDecoder::checkIfNextItemShallBeValue(char* argv)
{
if(!isNextItemValue)
if(!_isNextItemValue)
{
throw"duplicated Value and its wrong";
}
decodedList.last().value = argv;
isNextItemValue = false;
_decodedList.last().value = argv;
_isNextItemValue = false;
}
//****************************************************************
@ -60,8 +61,8 @@ void CommandDecoder::initCommandStrcut(char* argv, CommandsType& sample)
{
sample.command = argv;
sample.value = Q_NULLPTR;
isNextItemValue = true;
decodedList.append(sample);
_isNextItemValue = true;
_decodedList.append(sample);
}
//****************************************************************

Loading…
Cancel
Save