initial CommandParser implementation

This commit is contained in:
black
2025-07-04 21:42:56 +02:00
parent cbdb4aa97d
commit 762b806fe7
2 changed files with 43 additions and 1 deletions

View File

@@ -3,3 +3,23 @@
//
#include "CommandParser.h"
CommandParser & CommandParser::getInstance() {
static CommandParser instance;
return instance;
}
std::vector<std::string> CommandParser::parseLine(const std::string &input) {
std::vector<std::string> output{};
/// Konvertiere den Input String in einen IStringStream, damit dieser bei Leerzeichen gesplittet werden kann
std::istringstream<char> iss(input);
std::string out;
do {
/// Trenne den IStringStream bei jedem Leerzeichen und füge die Befehl(e)/-sargumente dem Output hinzu
std::getline(iss, out, ' ');
if (out.at(0) != '#') {
output.push_back(out);
}
} while (!out.empty());
return output;
}