From b93bacf87d6a7e3596fd7993a7cd55d3065d098d Mon Sep 17 00:00:00 2001 From: Frank Kopp Date: Fri, 14 Jun 2024 20:03:28 +0200 Subject: [PATCH] Rebase fix --- .../cpp-msfs-framework/lib/string_utils.hpp | 93 ------------------- 1 file changed, 93 deletions(-) diff --git a/fbw-common/src/wasm/cpp-msfs-framework/lib/string_utils.hpp b/fbw-common/src/wasm/cpp-msfs-framework/lib/string_utils.hpp index f6e7c58bb6d1..53cd0f2e80ca 100644 --- a/fbw-common/src/wasm/cpp-msfs-framework/lib/string_utils.hpp +++ b/fbw-common/src/wasm/cpp-msfs-framework/lib/string_utils.hpp @@ -179,99 +179,6 @@ class StringUtils { std::transform(str.begin(), str.end(), str.begin(), [](unsigned char c) { return char(std::toupper(c)); }); } - // splits a string or string view into a vector of parts at each delimiter - /** - * @brief splits a string or string view into a vector of parts at each delimiter - * @tparam StringType - * @param str the string to split - * @param container the container to store the split parts - * @param delims the delimiters to split the string at (default is " ") - */ - template - static inline void splitFast(const StringType& str, std::vector& container, const std::string& delims = " ") { - for (auto first = str.data(), second = str.data(), end = first + str.size(); second != end && first != end; first = second + 1) { - second = std::find_first_of(first, end, std::cbegin(delims), std::cend(delims)); - if (first != second) { - container.emplace_back(first, second - first); - } - } - } - - /** - * @brief Removes whitespace characters from beginning and end of string s
- * Whitespaces are defined as: ' ', '\\t', '\\n', '\\v', '\\f', '\\r' - * @tparam StringType std::string or std::string_view - * @param s the string to trim - * @return StringType the trimmed string - */ - template - static inline StringType trimFast(const StringType& s) { - const int l = static_cast(s.length()); - int a = 0, b = l - 1; - char c; - while (a < l && ((c = s[a]) == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r')) { - a++; - } - while (b > a && ((c = s[b]) == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r')) { - b--; - } - return s.substr(a, 1 + b - a); - } - - /** - * @brief removes trailing parts of a string after a given commentMarker - * @tparam StringType std::string or std::string_view - * @param s the string to remove trailing comments from - * @param commentMarker the comment marker to search for - * @return StringType the string with trailing comments removed - */ - template - static inline StringType removeTrailingComments(const StringType& s, const std::string& commentMarker) { - const auto pos = s.find(commentMarker); - if (pos != StringType::npos) { - return s.substr(0, pos); - } - return s; - } - - /** - * @brief transforms the given string to lower case - * @param s the string to transform - * @return std::string the transformed string - */ - static inline std::string toLowerCase(const std::string& s) { - std::string str(s); - std::transform(str.begin(), str.end(), str.begin(), [](unsigned char c) { return char(std::tolower(c)); }); - return str; - } - - /** - * @brief transforms the given string to lower case in place - * @param str the string to transform in place - */ - static inline void toLowerCase(std::string& str) { - std::transform(str.begin(), str.end(), str.begin(), [](unsigned char c) { return char(std::tolower(c)); }); - } - - /** - * @brief transforms the given string to upper case - * @param s the string to transform - * @return std::string the transformed string - */ - static inline std::string toUpperCase(const std::string& s) { - std::string str(s); - std::transform(str.begin(), str.end(), str.begin(), [](unsigned char c) { return char(std::toupper(c)); }); - return str; - } - - /** - * @brief transforms the given string to upper case in place - * @param str the string to transform in place - */ - static inline void toUpperCase(std::string& str) { - std::transform(str.begin(), str.end(), str.begin(), [](unsigned char c) { return char(std::toupper(c)); }); - } - /** * @brief Helper function to convert a bit integer to a string showing all bits grouped in bytes *