From 31dc984812e538f3db37d7d8816db0fa649f4f27 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Fri, 22 Sep 2023 09:20:58 -0400 Subject: prase int string helpers - untested --- src/helpers.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/helpers.hpp (limited to 'src/helpers.hpp') diff --git a/src/helpers.hpp b/src/helpers.hpp new file mode 100644 index 0000000..a429416 --- /dev/null +++ b/src/helpers.hpp @@ -0,0 +1,15 @@ +#ifndef PKE_HELPERS_HPP +#define PKE_HELPERS_HPP + +#include + +enum STR2NUM_ERROR { SUCCESS, OVERFLOW, UNDERFLOW, INCONVERTIBLE }; + +STR2NUM_ERROR str2num(int64_t &i, char const *s, int base = 0); +STR2NUM_ERROR str2num(uint64_t &i, char const *s, int base = 0); +STR2NUM_ERROR str2num(int32_t &i, char const *s, int base = 0); +STR2NUM_ERROR str2num(uint32_t &i, char const *s, int base = 0); +STR2NUM_ERROR str2num(int16_t &i, char const *s, int base = 0); +STR2NUM_ERROR str2num(uint16_t &i, char const *s, int base = 0); + +#endif /* PKE_HELPERS_HPP */ -- cgit v1.2.3