diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2023-09-22 09:20:58 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2023-09-25 06:53:34 -0400 |
| commit | 31dc984812e538f3db37d7d8816db0fa649f4f27 (patch) | |
| tree | 5060e7e510610cc4977144d81d253a8f0dc55810 /src/helpers.hpp | |
| parent | f04604a9784be6c32a7f8f42b9633872a03ce897 (diff) | |
prase int string helpers - untested
Diffstat (limited to 'src/helpers.hpp')
| -rw-r--r-- | src/helpers.hpp | 15 |
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 */ |
