From 2d8e52e59af27fc68f4ff5b63d1b53e8d6d4c043 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 2 Jun 2022 20:11:29 +0200 Subject: refactor: remove conversion & ctre dependency --- src/conversion.cpp | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 src/conversion.cpp (limited to 'src/conversion.cpp') diff --git a/src/conversion.cpp b/src/conversion.cpp deleted file mode 100644 index 078d66b..0000000 --- a/src/conversion.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "conversion.hpp" - -#include -#include - -auto str_to_uint(const std::string_view &str) noexcept -> ConversionResult -{ - if (!ctre::match(str)) - { - return ConversionResult(false, 0U, "Not a number"); - } - - if (!ctre::match(str)) - { - return ConversionResult(false, 0U, "Out of range"); - } - - std::size_t waste_pos = 0; - - auto num = std::stoul(str.data(), &waste_pos, NUMBER_BASE); - - if (waste_pos != str.length()) - { - return ConversionResult(false, 0U, "Not a number"); - } - - if (num > UINT_MAX) - { - return ConversionResult(false, 0U, "Out of range"); - } - - return ConversionResult(true, static_cast(num)); -} -- cgit v1.2.3-18-g5258