From fb3ff5decd5177ca0c9248100975927bf1f16ee9 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 4 Jul 2022 20:46:33 -0400 Subject: [PATCH] remove old string parse stuff since we don't use it any more (the "parse the rest" method) --- include/common/settings.hh | 55 ++------------------------------------ 1 file changed, 2 insertions(+), 53 deletions(-) diff --git a/include/common/settings.hh b/include/common/settings.hh index eee55715..fcfb78b7 100644 --- a/include/common/settings.hh +++ b/include/common/settings.hh @@ -100,57 +100,6 @@ protected: return false; } - // convenience function for parsing a whole string - inline std::optional parseString(parser_base_t &parser) - { - // peek the first token, if it was - // a quoted string we can exit now - if (!parser.parse_token(PARSE_PEEK)) { - return std::nullopt; - } - - if (parser.was_quoted) { - parser.parse_token(); - return parser.token; - } - - std::string value; - - // not a quoted string, so everything will be literal. - // go until we reach a -. - while (true) { - if (parser.token[0] == '-') { - break; - } - - if (!value.empty()) { - value += ' '; - } - - value += parser.token; - - parser.parse_token(); - - if (!parser.parse_token(PARSE_PEEK)) { - break; - } - } - - // skip end of named arguments - if (parser.token == "-" || parser.token == "--") { - parser.parse_token(); - } - - while (std::isspace(value.back())) { - value.pop_back(); - } - while (std::isspace(value.front())) { - value.erase(value.begin()); - } - - return std::move(value); - } - public: ~setting_base() = default; @@ -555,8 +504,8 @@ public: bool parse(const std::string &settingName, parser_base_t &parser, bool locked = false) override { - if (auto value = parseString(parser)) { - setValueFromParse(*value, locked); + if (parser.parse_token()) { + setValueFromParse(parser.token, locked); return true; }