diff options
author | HampusM <hampus@hampusmat.com> | 2022-06-02 20:11:29 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:57:00 +0200 |
commit | 2d8e52e59af27fc68f4ff5b63d1b53e8d6d4c043 (patch) | |
tree | e00b263afb9f3ef7356ec755b60ce03062110628 /src/conversion.hpp | |
parent | cf3bfd60ad03f2feb2ccc62a12fc2922bdc2fb71 (diff) |
refactor: remove conversion & ctre dependency
Diffstat (limited to 'src/conversion.hpp')
-rw-r--r-- | src/conversion.hpp | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/conversion.hpp b/src/conversion.hpp deleted file mode 100644 index b1f2438..0000000 --- a/src/conversion.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include <ctre.hpp> -#include <string_view> - -constexpr uint32_t NUMBER_BASE = 10U; - -template <typename ResultType> -class ConversionResult -{ -public: - explicit ConversionResult( - const bool &success_, - const ResultType &result_, - const std::string_view &fail_reason_ = "") noexcept - : success(success_), result(result_), fail_reason(fail_reason_) - { - } - - const bool &success; - const ResultType &result; - const std::string_view &fail_reason; -}; - -static constexpr auto IS_VALID_UINT = ctll::fixed_string("^[0-9]+$"); -static constexpr auto IS_UINT_IN_RANGE = ctll::fixed_string("^[0-9]{1,19}$"); - -/** - * Converts a string to a unsigned integer. - * - * @param str A string that possibly is a unsigned integer - * @returns A conversion result - */ -auto str_to_uint(const std::string_view &str) noexcept -> ConversionResult<uint32_t>; |