From 794e853bfd5c21c97457c4070cfc1633e233b003 Mon Sep 17 00:00:00 2001 From: FormerLurker Date: Sun, 10 Jan 2021 16:51:16 -0600 Subject: Remove cctype header --- GcodeProcessorLib/utilities.cpp | 90 ----------------------------------------- 1 file changed, 90 deletions(-) diff --git a/GcodeProcessorLib/utilities.cpp b/GcodeProcessorLib/utilities.cpp index 7c36515..66a1f24 100644 --- a/GcodeProcessorLib/utilities.cpp +++ b/GcodeProcessorLib/utilities.cpp @@ -25,7 +25,6 @@ #include #include #include "fpconv.h" -#include const std::string utilities::WHITESPACE_ = " \n\r\t\f\v"; const char utilities::GUID_RANGE[] = "0123456789abcdef"; @@ -312,93 +311,4 @@ std::string utilities::dtos(double x, unsigned char precision) } */ return buffer; -} - -bool utilities::is_equal_caseless(const std::string& lhs, const std::string& rhs) -{ - unsigned int sz = lhs.size(); - if (rhs.size() != sz) - { - // Sizes aren't the same, - return false; - } - for (unsigned int i = 0; i < sz; ++i) - { - if (std::tolower(lhs[i]) != std::tolower(rhs[i])) - { - return false; - } - } - return true; -} - -bool utilities::is_equal_caseless_trim(const std::string& lhs, const std::string& rhs) -{ - - unsigned int lhend = lhs.find_last_not_of(WHITESPACE_); - unsigned int lhstart = lhs.find_first_not_of(WHITESPACE_); - - unsigned int rhend = rhs.find_last_not_of(WHITESPACE_); - unsigned int rhstart = rhs.find_first_not_of(WHITESPACE_); - - unsigned int size = lhend - lhstart + 1; - // If the sizes minus the whitespace doesn't match, the strings can't match - if (size != rhend - rhstart + 1) - { - return false; - } - - // The sizes match, loop through and compare - for (unsigned int i = 0; i < size; ++i) - { - if (std::tolower(lhs[i + lhstart]) != std::tolower(rhs[i + rhstart])) - { - // Something didn't match, return false - return false; - } - } - // If we are here, it worked! - return true; -} - -/// -/// Checks to see if the lhs is in the rhs. -/// -/// The string to search for in the array. Case will be ignored, as will beginning and ending whitespace -/// A null terminated LOWERCASE array of const char * that is already trimmed. -/// -bool utilities::is_in_caseless_trim(const std::string& lhs, const char** rhs) -{ - unsigned int lhend = lhs.find_last_not_of(WHITESPACE_); - unsigned int lhstart = lhs.find_first_not_of(WHITESPACE_); - unsigned int size = lhend - lhstart + 1; - int index = 0; - - while (rhs[index] != NULL) - { - const char* rhString = rhs[index++]; - if (rhString == NULL) - { - break; - } - // If the sizes minus the whitespace doesn't match, the strings can't match - if (size != strlen(rhString)) - { - continue; - } - - // The sizes match, loop through and compare - for (unsigned int i = 0; i < size; ++i) - { - if (std::tolower(lhs[i + lhstart]) != rhString[i]) - { - // Something didn't match, return false - continue; - } - } - return true; - } - - // If we are here, this string does not appear - return false; } \ No newline at end of file -- cgit v1.2.3