From 8a62d2899b7028b3bd9788f79e080984a1144f5c Mon Sep 17 00:00:00 2001 From: Ruakij Date: Mon, 22 Nov 2021 11:24:10 +0100 Subject: [PATCH] Moved split to own helper-file --- handler/textPacketHandler.hpp | 15 ++------------- helper/split.hpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 helper/split.hpp diff --git a/handler/textPacketHandler.hpp b/handler/textPacketHandler.hpp index ad6a999..dff2884 100644 --- a/handler/textPacketHandler.hpp +++ b/handler/textPacketHandler.hpp @@ -7,18 +7,7 @@ #include #include #include - -std::vector split(const std::string& s, char delimiter) -{ - std::vector tokens; - std::string token; - std::istringstream tokenStream(s); - while (std::getline(tokenStream, token, delimiter)) - { - tokens.push_back(token); - } - return tokens; -} +#include "../helper/split.hpp" uint64_t convertStringToTimestampMicros(std::string textTimestamp){ uint64_t timestamp; @@ -63,7 +52,7 @@ void textPacketHandler(std::vector textPacket){ std::string textTimestamp = headerData[0]; uint64_t timestamp = convertStringToTimestampMicros(textTimestamp); - + } #endif /* EE781A91_6D07_47AC_B3C4_F99E29F3731F */ diff --git a/helper/split.hpp b/helper/split.hpp new file mode 100644 index 0000000..e39d718 --- /dev/null +++ b/helper/split.hpp @@ -0,0 +1,16 @@ +#ifndef F7CFE6A7_34BF_4E04_94CF_DB8374980631 +#define F7CFE6A7_34BF_4E04_94CF_DB8374980631 + +std::vector split(const std::string& s, char delimiter) +{ + std::vector tokens; + std::string token; + std::istringstream tokenStream(s); + while (std::getline(tokenStream, token, delimiter)) + { + tokens.push_back(token); + } + return tokens; +} + +#endif /* F7CFE6A7_34BF_4E04_94CF_DB8374980631 */