reordered source files

This commit is contained in:
devZoGok
2026-05-21 20:28:52 +03:00
parent 4e36bfd311
commit ea9d49fe9d
182 changed files with 14678 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#include "abstractCommand.h"
#include <cmath>
#include <vector.h>
namespace battleship{
using namespace std;
void AbstractCommand::handle(){
if(cmdStr.find(" ") == -1)
return;
vector<int> spaceIds;
arguments.clear();
for(int i = 0; i < cmdStr.length(); i++)
if(cmdStr[i] == ' ')
spaceIds.push_back(i);
arguments.push_back(cmdStr.substr(0, spaceIds[0]));
for(int i = 0; i < spaceIds.size(); i++){
bool lastSpace = (i == spaceIds.size() - 1);
string argument = cmdStr.substr(spaceIds[i] + 1, lastSpace ? string::npos : spaceIds[i + 1] - spaceIds[i] - 1);
arguments.push_back(argument);
}
}
void AbstractCommand::execute(){
handle();
validate();
}
}