|
6 | 6 |
|
7 | 7 | \*******************************************************************/ |
8 | 8 |
|
9 | | - |
10 | 9 | #ifndef CPROVER_UTIL_STRING2INT_H |
11 | 10 | #define CPROVER_UTIL_STRING2INT_H |
12 | 11 |
|
| 12 | +#include "mp_arith.h" |
| 13 | + |
13 | 14 | #include <string> |
14 | 15 |
|
15 | 16 | // These check that the string is indeed a valid number, |
16 | 17 | // and fail an assertion otherwise. |
17 | 18 | // We use those for data types that C++11's std::stoi etc. do not |
18 | 19 | // cover. |
19 | | -unsigned safe_string2unsigned(const std::string &str, int base=10); |
20 | | -std::size_t safe_string2size_t(const std::string &str, int base=10); |
| 20 | +unsigned |
| 21 | +safe_string2unsigned(const std::string &str, int base = DECIMAL_SYSTEM); |
| 22 | +std::size_t |
| 23 | +safe_string2size_t(const std::string &str, int base = DECIMAL_SYSTEM); |
21 | 24 |
|
22 | 25 | // The below mimic C's atoi/atol: any errors are silently ignored. |
23 | 26 | // They are meant to replace atoi/atol. |
24 | | -int unsafe_string2int(const std::string &str, int base=10); |
25 | | -unsigned unsafe_string2unsigned(const std::string &str, int base=10); |
26 | | -std::size_t unsafe_string2size_t(const std::string &str, int base=10); |
| 27 | +int unsafe_string2int(const std::string &str, int base = DECIMAL_SYSTEM); |
| 28 | +unsigned |
| 29 | +unsafe_string2unsigned(const std::string &str, int base = DECIMAL_SYSTEM); |
| 30 | +std::size_t |
| 31 | +unsafe_string2size_t(const std::string &str, int base = DECIMAL_SYSTEM); |
27 | 32 |
|
28 | 33 | // Same for atoll |
29 | | -long long int unsafe_string2signedlonglong(const std::string &str, int base=10); |
| 34 | +long long int |
| 35 | +unsafe_string2signedlonglong(const std::string &str, int base = DECIMAL_SYSTEM); |
30 | 36 | long long unsigned int unsafe_string2unsignedlonglong( |
31 | | - const std::string &str, int base=10); |
| 37 | + const std::string &str, |
| 38 | + int base = DECIMAL_SYSTEM); |
32 | 39 |
|
33 | 40 | #endif // CPROVER_UTIL_STRING2INT_H |
0 commit comments