summaryrefslogtreecommitdiff
path: root/src/helpers.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/helpers.hpp')
-rw-r--r--src/helpers.hpp15
1 files changed, 15 insertions, 0 deletions
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 <cstdint>
+
+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 */