diff options
author | HampusM <hampus@hampusmat.com> | 2022-02-15 20:27:51 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-02-15 20:27:51 +0100 |
commit | 5dae8f8d10d506abc3c75a1f66c1dfe620c84fc1 (patch) | |
tree | 2bfb6efef0535a35bab1da811a5f69cb5203dff9 /src/utils.cpp | |
parent | 9147551cd21d565f9503e3ebbcd2121e284d88d5 (diff) |
refactor: improve project design
Diffstat (limited to 'src/utils.cpp')
-rw-r--r-- | src/utils.cpp | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/utils.cpp b/src/utils.cpp deleted file mode 100644 index 480c31f..0000000 --- a/src/utils.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "utils.hpp" -#include <climits> -#include <stdexcept> - -unsigned int str_to_uint(std::string str) -{ - if (str.at(0) == '-') - throw "Less than 0"; - - std::size_t waste_pos; - - unsigned long num; - - try - { - num = std::stoul(str, &waste_pos, 10); - } - catch (const std::invalid_argument &exc) - { - throw "Not a number"; - } - catch (const std::out_of_range &exc) - { - throw "Out of range"; - } - - if (waste_pos != str.length()) - throw "Not a number"; - - if (num > UINT_MAX) - throw "Out of range"; - - return static_cast<unsigned int>(num); -} |