From a824c09cee5a6c796a94c6b304a0c23fec8a6851 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Sun, 21 Apr 2024 10:41:03 +0200 Subject: [PATCH] add initial broken implementations of list macros --- src/osuparser.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/osuparser.cpp b/src/osuparser.cpp index 564523a..9882a4d 100644 --- a/src/osuparser.cpp +++ b/src/osuparser.cpp @@ -245,17 +245,37 @@ inline void toLower(std::string &str) { #define VAR_LIST(section, name, type) \ VAR_GENERIC(section, name,\ - std::string val = checkAndRemove(line, _prefix);\ std::vector value;\ + std::stringstream ss(line);\ + type val;\ + while (ss >> val) {\ + std::getline(configFile, line);\ + }\ ) #define VAR_LIST_SEP(section, name, type, sep) \ VAR_GENERIC(section, name,\ - std::string val = checkAndRemove(line, _prefix);\ std::vector value;\ + std::stringstream ss(line);\ + std::string val;\ + type type_val;\ + while (std::stringstream(val) >> type_val) {\ + std::getline(ss, val, ',');\ + }\ + ) +#define VAR_LIST_SEP_P(section, name, type, sep, prefix) \ + VAR_GENERIC_P(section, name,\ + _prefix = prefix;\ + line = checkAndRemove(line, _prefix);\ + std::vector value;\ + std::stringstream ss(line);\ + std::string val;\ + type type_val;\ + while (std::stringstream(val) >> type_val) {\ + std::getline(ss, val, ',');\ + }\ ) #define VAR_LIST_NUMBERED(section, name, type) \ VAR_GENERIC(section, name,\ - std::string val = checkAndRemove(line, _prefix);\ std::vector value;\ )