From 50ebd4af91ece2e7b5e75b600f83a2a74b315068 Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Thu, 19 Jan 2023 19:03:17 -0800 Subject: Implement alternative to on boost::split boost::split has a documented false-positive in clang-tidy. While normally we'd handle this with NOLINTNEXTLINE, this doesn't appear to work in all cases. Unclear why, but seems to be due to some of our lambda callback complexity. Each of these uses is a case where we should be using a more specific check, rather than split, but for the moment, this is the best we have. Tested: clang-tidy passes. [1] https://github.com/llvm/llvm-project/issues/40486 Signed-off-by: Ed Tanous Change-Id: I144c6610cb740287b7225e2be03b4142a64f9563 --- include/str_utility.hpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 include/str_utility.hpp (limited to 'include/str_utility.hpp') diff --git a/include/str_utility.hpp b/include/str_utility.hpp new file mode 100644 index 0000000000..39e1c82351 --- /dev/null +++ b/include/str_utility.hpp @@ -0,0 +1,23 @@ +#pragma once + +#include +#include +#include + +namespace bmcweb +{ +// This is a naive replacement for boost::split until +// https://github.com/llvm/llvm-project/issues/40486 +// is resolved +inline void split(std::vector& strings, std::string_view str, + char delim) +{ + size_t start = 0; + size_t end = 0; + while ((start = str.find_first_not_of(delim, end)) != std::string::npos) + { + end = str.find(delim, start); + strings.emplace_back(str.substr(start, end - start)); + } +} +} // namespace bmcweb -- cgit v1.2.3