From 28a63d9819c05d2576355117e54acc3f466bf926 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Mon, 6 May 2024 00:43:06 +0500 Subject: feat: method for converting strings to event types --- src/schemas/stream.cpp | 17 +++++++++++++++++ src/schemas/stream.hpp | 5 +++++ 2 files changed, 22 insertions(+) create mode 100644 src/schemas/stream.cpp diff --git a/src/schemas/stream.cpp b/src/schemas/stream.cpp new file mode 100644 index 0000000..6ef10dc --- /dev/null +++ b/src/schemas/stream.cpp @@ -0,0 +1,17 @@ +#include "stream.hpp" + +namespace bot::schemas { + EventType string_to_event_type(const std::string &type) { + if (type == "live") { + return EventType::LIVE; + } else if (type == "offline") { + return EventType::OFFLINE; + } else if (type == "title") { + return EventType::TITLE; + } else if (type == "game") { + return EventType::GAME; + } else { + return EventType::CUSTOM; + } + } +} diff --git a/src/schemas/stream.hpp b/src/schemas/stream.hpp index bfb60b5..a636ea5 100644 --- a/src/schemas/stream.hpp +++ b/src/schemas/stream.hpp @@ -1,6 +1,11 @@ #pragma once +#include + namespace bot::schemas { enum EventType { LIVE, OFFLINE, TITLE, GAME, CUSTOM = 99 }; + EventType string_to_event_type(const std::string &type); + enum EventFlag { MASSPING }; + } -- cgit v1.2.3