Commit ffe5b29e1f187d3acfe2b02bc3bebc43408dac66
Committed by
Henry Schreiner
1 parent
828e09e5
Add cstdint and std::prefix to its symbols (#409)
* Add cstdint and std::prefix to its symbols * Use int64_t in std::
Showing
9 changed files
with
49 additions
and
42 deletions
README.md
| @@ -217,7 +217,7 @@ app.add_flag(option_name, | @@ -217,7 +217,7 @@ app.add_flag(option_name, | ||
| 217 | help_string="") | 217 | help_string="") |
| 218 | 218 | ||
| 219 | app.add_flag_function(option_name, | 219 | app.add_flag_function(option_name, |
| 220 | - function <void(int64_t count)>, | 220 | + function <void(std::int64_t count)>, |
| 221 | help_string="") | 221 | help_string="") |
| 222 | 222 | ||
| 223 | app.add_flag_callback(option_name,function<void(void)>,help_string="") | 223 | app.add_flag_callback(option_name,function<void(void)>,help_string="") |
include/CLI/App.hpp
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | // file LICENSE or https://github.com/CLIUtils/CLI11 for details. | 4 | // file LICENSE or https://github.com/CLIUtils/CLI11 for details. |
| 5 | 5 | ||
| 6 | #include <algorithm> | 6 | #include <algorithm> |
| 7 | +#include <cstdint> | ||
| 7 | #include <functional> | 8 | #include <functional> |
| 8 | #include <iostream> | 9 | #include <iostream> |
| 9 | #include <iterator> | 10 | #include <iterator> |
| @@ -759,8 +760,9 @@ class App { | @@ -759,8 +760,9 @@ class App { | ||
| 759 | } | 760 | } |
| 760 | 761 | ||
| 761 | /// Vector version to capture multiple flags. | 762 | /// Vector version to capture multiple flags. |
| 762 | - template <typename T, | ||
| 763 | - enable_if_t<!std::is_assignable<std::function<void(int64_t)>, T>::value, detail::enabler> = detail::dummy> | 763 | + template < |
| 764 | + typename T, | ||
| 765 | + enable_if_t<!std::is_assignable<std::function<void(std::int64_t)>, T>::value, detail::enabler> = detail::dummy> | ||
| 764 | Option *add_flag(std::string flag_name, | 766 | Option *add_flag(std::string flag_name, |
| 765 | std::vector<T> &flag_results, ///< A vector of values with the flag results | 767 | std::vector<T> &flag_results, ///< A vector of values with the flag results |
| 766 | std::string flag_description = "") { | 768 | std::string flag_description = "") { |
| @@ -795,11 +797,11 @@ class App { | @@ -795,11 +797,11 @@ class App { | ||
| 795 | 797 | ||
| 796 | /// Add option for callback with an integer value | 798 | /// Add option for callback with an integer value |
| 797 | Option *add_flag_function(std::string flag_name, | 799 | Option *add_flag_function(std::string flag_name, |
| 798 | - std::function<void(int64_t)> function, ///< A function to call, void(int) | 800 | + std::function<void(std::int64_t)> function, ///< A function to call, void(int) |
| 799 | std::string flag_description = "") { | 801 | std::string flag_description = "") { |
| 800 | 802 | ||
| 801 | CLI::callback_t fun = [function](const CLI::results_t &res) { | 803 | CLI::callback_t fun = [function](const CLI::results_t &res) { |
| 802 | - int64_t flag_count = 0; | 804 | + std::int64_t flag_count = 0; |
| 803 | detail::sum_flag_vector(res, flag_count); | 805 | detail::sum_flag_vector(res, flag_count); |
| 804 | function(flag_count); | 806 | function(flag_count); |
| 805 | return true; | 807 | return true; |
| @@ -811,7 +813,7 @@ class App { | @@ -811,7 +813,7 @@ class App { | ||
| 811 | #ifdef CLI11_CPP14 | 813 | #ifdef CLI11_CPP14 |
| 812 | /// Add option for callback (C++14 or better only) | 814 | /// Add option for callback (C++14 or better only) |
| 813 | Option *add_flag(std::string flag_name, | 815 | Option *add_flag(std::string flag_name, |
| 814 | - std::function<void(int64_t)> function, ///< A function to call, void(int64_t) | 816 | + std::function<void(std::int64_t)> function, ///< A function to call, void(std::int64_t) |
| 815 | std::string flag_description = "") { | 817 | std::string flag_description = "") { |
| 816 | return add_flag_function(std::move(flag_name), std::move(function), std::move(flag_description)); | 818 | return add_flag_function(std::move(flag_name), std::move(function), std::move(flag_description)); |
| 817 | } | 819 | } |
include/CLI/TypeTools.hpp
| @@ -548,7 +548,7 @@ inline std::string type_name() { | @@ -548,7 +548,7 @@ inline std::string type_name() { | ||
| 548 | // Lexical cast | 548 | // Lexical cast |
| 549 | 549 | ||
| 550 | /// Convert a flag into an integer value typically binary flags | 550 | /// Convert a flag into an integer value typically binary flags |
| 551 | -inline int64_t to_flag_value(std::string val) { | 551 | +inline std::int64_t to_flag_value(std::string val) { |
| 552 | static const std::string trueString("true"); | 552 | static const std::string trueString("true"); |
| 553 | static const std::string falseString("false"); | 553 | static const std::string falseString("false"); |
| 554 | if(val == trueString) { | 554 | if(val == trueString) { |
| @@ -558,10 +558,10 @@ inline int64_t to_flag_value(std::string val) { | @@ -558,10 +558,10 @@ inline int64_t to_flag_value(std::string val) { | ||
| 558 | return -1; | 558 | return -1; |
| 559 | } | 559 | } |
| 560 | val = detail::to_lower(val); | 560 | val = detail::to_lower(val); |
| 561 | - int64_t ret; | 561 | + std::int64_t ret; |
| 562 | if(val.size() == 1) { | 562 | if(val.size() == 1) { |
| 563 | if(val[0] >= '1' && val[0] <= '9') { | 563 | if(val[0] >= '1' && val[0] <= '9') { |
| 564 | - return (static_cast<int64_t>(val[0]) - '0'); | 564 | + return (static_cast<std::int64_t>(val[0]) - '0'); |
| 565 | } | 565 | } |
| 566 | switch(val[0]) { | 566 | switch(val[0]) { |
| 567 | case '0': | 567 | case '0': |
| @@ -972,7 +972,7 @@ bool lexical_conversion(const std::vector<std ::string> &strings, T &output) { | @@ -972,7 +972,7 @@ bool lexical_conversion(const std::vector<std ::string> &strings, T &output) { | ||
| 972 | template <typename T, | 972 | template <typename T, |
| 973 | enable_if_t<std::is_integral<T>::value && std::is_unsigned<T>::value, detail::enabler> = detail::dummy> | 973 | enable_if_t<std::is_integral<T>::value && std::is_unsigned<T>::value, detail::enabler> = detail::dummy> |
| 974 | void sum_flag_vector(const std::vector<std::string> &flags, T &output) { | 974 | void sum_flag_vector(const std::vector<std::string> &flags, T &output) { |
| 975 | - int64_t count{0}; | 975 | + std::int64_t count{0}; |
| 976 | for(auto &flag : flags) { | 976 | for(auto &flag : flags) { |
| 977 | count += detail::to_flag_value(flag); | 977 | count += detail::to_flag_value(flag); |
| 978 | } | 978 | } |
| @@ -987,7 +987,7 @@ void sum_flag_vector(const std::vector<std::string> &flags, T &output) { | @@ -987,7 +987,7 @@ void sum_flag_vector(const std::vector<std::string> &flags, T &output) { | ||
| 987 | template <typename T, | 987 | template <typename T, |
| 988 | enable_if_t<std::is_integral<T>::value && std::is_signed<T>::value, detail::enabler> = detail::dummy> | 988 | enable_if_t<std::is_integral<T>::value && std::is_signed<T>::value, detail::enabler> = detail::dummy> |
| 989 | void sum_flag_vector(const std::vector<std::string> &flags, T &output) { | 989 | void sum_flag_vector(const std::vector<std::string> &flags, T &output) { |
| 990 | - int64_t count{0}; | 990 | + std::int64_t count{0}; |
| 991 | for(auto &flag : flags) { | 991 | for(auto &flag : flags) { |
| 992 | count += detail::to_flag_value(flag); | 992 | count += detail::to_flag_value(flag); |
| 993 | } | 993 | } |
include/CLI/Validators.hpp
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | #include "CLI/TypeTools.hpp" | 8 | #include "CLI/TypeTools.hpp" |
| 9 | 9 | ||
| 10 | #include <cmath> | 10 | #include <cmath> |
| 11 | +#include <cstdint> | ||
| 11 | #include <functional> | 12 | #include <functional> |
| 12 | #include <iostream> | 13 | #include <iostream> |
| 13 | #include <limits> | 14 | #include <limits> |
| @@ -1043,7 +1044,7 @@ class AsNumberWithUnit : public Validator { | @@ -1043,7 +1044,7 @@ class AsNumberWithUnit : public Validator { | ||
| 1043 | /// "2 EiB" => 2^61 // Units up to exibyte are supported | 1044 | /// "2 EiB" => 2^61 // Units up to exibyte are supported |
| 1044 | class AsSizeValue : public AsNumberWithUnit { | 1045 | class AsSizeValue : public AsNumberWithUnit { |
| 1045 | public: | 1046 | public: |
| 1046 | - using result_t = uint64_t; | 1047 | + using result_t = std::uint64_t; |
| 1047 | 1048 | ||
| 1048 | /// If kb_is_1000 is true, | 1049 | /// If kb_is_1000 is true, |
| 1049 | /// interpret 'kb', 'k' as 1000 and 'kib', 'ki' as 1024 | 1050 | /// interpret 'kb', 'k' as 1000 and 'kib', 'ki' as 1024 |
tests/AppTest.cpp
| 1 | #include "app_helper.hpp" | 1 | #include "app_helper.hpp" |
| 2 | #include <complex> | 2 | #include <complex> |
| 3 | +#include <cstdint> | ||
| 3 | #include <cstdlib> | 4 | #include <cstdlib> |
| 4 | 5 | ||
| 5 | #include "gmock/gmock.h" | 6 | #include "gmock/gmock.h" |
| @@ -1431,9 +1432,9 @@ TEST_F(TApp, RequiredFlags) { | @@ -1431,9 +1432,9 @@ TEST_F(TApp, RequiredFlags) { | ||
| 1431 | 1432 | ||
| 1432 | TEST_F(TApp, CallbackFlags) { | 1433 | TEST_F(TApp, CallbackFlags) { |
| 1433 | 1434 | ||
| 1434 | - int64_t value = 0; | 1435 | + std::int64_t value = 0; |
| 1435 | 1436 | ||
| 1436 | - auto func = [&value](int64_t x) { value = x; }; | 1437 | + auto func = [&value](std::int64_t x) { value = x; }; |
| 1437 | 1438 | ||
| 1438 | app.add_flag_function("-v", func); | 1439 | app.add_flag_function("-v", func); |
| 1439 | 1440 | ||
| @@ -1473,9 +1474,9 @@ TEST_F(TApp, CallbackBoolFlags) { | @@ -1473,9 +1474,9 @@ TEST_F(TApp, CallbackBoolFlags) { | ||
| 1473 | } | 1474 | } |
| 1474 | 1475 | ||
| 1475 | TEST_F(TApp, CallbackFlagsFalse) { | 1476 | TEST_F(TApp, CallbackFlagsFalse) { |
| 1476 | - int64_t value = 0; | 1477 | + std::int64_t value = 0; |
| 1477 | 1478 | ||
| 1478 | - auto func = [&value](int64_t x) { value = x; }; | 1479 | + auto func = [&value](std::int64_t x) { value = x; }; |
| 1479 | 1480 | ||
| 1480 | app.add_flag_function("-v,-f{false},--val,--fval{false}", func); | 1481 | app.add_flag_function("-v,-f{false},--val,--fval{false}", func); |
| 1481 | 1482 | ||
| @@ -1502,9 +1503,9 @@ TEST_F(TApp, CallbackFlagsFalse) { | @@ -1502,9 +1503,9 @@ TEST_F(TApp, CallbackFlagsFalse) { | ||
| 1502 | } | 1503 | } |
| 1503 | 1504 | ||
| 1504 | TEST_F(TApp, CallbackFlagsFalseShortcut) { | 1505 | TEST_F(TApp, CallbackFlagsFalseShortcut) { |
| 1505 | - int64_t value = 0; | 1506 | + std::int64_t value = 0; |
| 1506 | 1507 | ||
| 1507 | - auto func = [&value](int64_t x) { value = x; }; | 1508 | + auto func = [&value](std::int64_t x) { value = x; }; |
| 1508 | 1509 | ||
| 1509 | app.add_flag_function("-v,!-f,--val,!--fval", func); | 1510 | app.add_flag_function("-v,!-f,--val,!--fval", func); |
| 1510 | 1511 | ||
| @@ -1533,9 +1534,9 @@ TEST_F(TApp, CallbackFlagsFalseShortcut) { | @@ -1533,9 +1534,9 @@ TEST_F(TApp, CallbackFlagsFalseShortcut) { | ||
| 1533 | #if __cplusplus >= 201402L || _MSC_VER >= 1900 | 1534 | #if __cplusplus >= 201402L || _MSC_VER >= 1900 |
| 1534 | TEST_F(TApp, CallbackFlagsAuto) { | 1535 | TEST_F(TApp, CallbackFlagsAuto) { |
| 1535 | 1536 | ||
| 1536 | - int64_t value = 0; | 1537 | + std::int64_t value = 0; |
| 1537 | 1538 | ||
| 1538 | - auto func = [&value](int64_t x) { value = x; }; | 1539 | + auto func = [&value](std::int64_t x) { value = x; }; |
| 1539 | 1540 | ||
| 1540 | app.add_flag("-v", func); | 1541 | app.add_flag("-v", func); |
| 1541 | 1542 | ||
| @@ -2562,8 +2563,8 @@ TEST_F(TApp, EmptyOptionFail) { | @@ -2562,8 +2563,8 @@ TEST_F(TApp, EmptyOptionFail) { | ||
| 2562 | } | 2563 | } |
| 2563 | 2564 | ||
| 2564 | TEST_F(TApp, BeforeRequirements) { | 2565 | TEST_F(TApp, BeforeRequirements) { |
| 2565 | - app.add_flag_function("-a", [](int64_t) { throw CLI::Success(); }); | ||
| 2566 | - app.add_flag_function("-b", [](int64_t) { throw CLI::CallForHelp(); }); | 2566 | + app.add_flag_function("-a", [](std::int64_t) { throw CLI::Success(); }); |
| 2567 | + app.add_flag_function("-b", [](std::int64_t) { throw CLI::CallForHelp(); }); | ||
| 2567 | 2568 | ||
| 2568 | args = {"extra"}; | 2569 | args = {"extra"}; |
| 2569 | EXPECT_THROW(run(), CLI::ExtrasError); | 2570 | EXPECT_THROW(run(), CLI::ExtrasError); |
tests/HelpersTest.cpp
| @@ -1013,7 +1013,7 @@ TEST(Types, LexicalCastEnum) { | @@ -1013,7 +1013,7 @@ TEST(Types, LexicalCastEnum) { | ||
| 1013 | EXPECT_EQ(output, v5); | 1013 | EXPECT_EQ(output, v5); |
| 1014 | 1014 | ||
| 1015 | EXPECT_FALSE(CLI::detail::lexical_cast("invalid", output)); | 1015 | EXPECT_FALSE(CLI::detail::lexical_cast("invalid", output)); |
| 1016 | - enum class t2 : uint64_t { enum1 = 65, enum2 = 45667, enum3 = 9999999999999 }; | 1016 | + enum class t2 : std::uint64_t { enum1 = 65, enum2 = 45667, enum3 = 9999999999999 }; |
| 1017 | t2 output2; | 1017 | t2 output2; |
| 1018 | EXPECT_TRUE(CLI::detail::lexical_cast("65", output2)); | 1018 | EXPECT_TRUE(CLI::detail::lexical_cast("65", output2)); |
| 1019 | EXPECT_EQ(output2, t2::enum1); | 1019 | EXPECT_EQ(output2, t2::enum1); |
tests/NewParseTest.cpp
| 1 | #include "app_helper.hpp" | 1 | #include "app_helper.hpp" |
| 2 | #include "gmock/gmock.h" | 2 | #include "gmock/gmock.h" |
| 3 | #include <complex> | 3 | #include <complex> |
| 4 | +#include <cstdint> | ||
| 4 | 5 | ||
| 5 | using ::testing::HasSubstr; | 6 | using ::testing::HasSubstr; |
| 6 | 7 | ||
| @@ -499,12 +500,12 @@ template <class X> class AobjWrapper { | @@ -499,12 +500,12 @@ template <class X> class AobjWrapper { | ||
| 499 | X val_{}; | 500 | X val_{}; |
| 500 | }; | 501 | }; |
| 501 | 502 | ||
| 502 | -static_assert(std::is_assignable<AobjWrapper<uint16_t> &, uint16_t>::value, | 503 | +static_assert(std::is_assignable<AobjWrapper<std::uint16_t> &, std::uint16_t>::value, |
| 503 | "AobjWrapper not assignable like it should be "); | 504 | "AobjWrapper not assignable like it should be "); |
| 504 | 505 | ||
| 505 | TEST_F(TApp, uint16Wrapper) { | 506 | TEST_F(TApp, uint16Wrapper) { |
| 506 | - AobjWrapper<uint16_t> sWrapper; | ||
| 507 | - app.add_option<AobjWrapper<uint16_t>, uint16_t>("-v", sWrapper); | 507 | + AobjWrapper<std::uint16_t> sWrapper; |
| 508 | + app.add_option<AobjWrapper<std::uint16_t>, std::uint16_t>("-v", sWrapper); | ||
| 508 | args = {"-v", "9"}; | 509 | args = {"-v", "9"}; |
| 509 | 510 | ||
| 510 | run(); | 511 | run(); |
tests/OptionalTest.cpp
| 1 | +#include <cstdint> | ||
| 1 | #include <cstdlib> | 2 | #include <cstdlib> |
| 2 | #include <iostream> | 3 | #include <iostream> |
| 3 | 4 | ||
| @@ -132,7 +133,7 @@ TEST_F(TApp, BoostOptionalTestZarg) { | @@ -132,7 +133,7 @@ TEST_F(TApp, BoostOptionalTestZarg) { | ||
| 132 | } | 133 | } |
| 133 | 134 | ||
| 134 | TEST_F(TApp, BoostOptionalint64Test) { | 135 | TEST_F(TApp, BoostOptionalint64Test) { |
| 135 | - boost::optional<int64_t> opt; | 136 | + boost::optional<std::int64_t> opt; |
| 136 | app.add_option("-c,--count", opt); | 137 | app.add_option("-c,--count", opt); |
| 137 | run(); | 138 | run(); |
| 138 | EXPECT_FALSE(opt); | 139 | EXPECT_FALSE(opt); |
tests/TransformTest.cpp
| 1 | #include "app_helper.hpp" | 1 | #include "app_helper.hpp" |
| 2 | 2 | ||
| 3 | #include <array> | 3 | #include <array> |
| 4 | +#include <cstdint> | ||
| 4 | #include <unordered_map> | 5 | #include <unordered_map> |
| 5 | 6 | ||
| 6 | #if defined(CLI11_CPP17) | 7 | #if defined(CLI11_CPP17) |
| @@ -43,7 +44,7 @@ TEST_F(TApp, SimpleNumericalTransform) { | @@ -43,7 +44,7 @@ TEST_F(TApp, SimpleNumericalTransform) { | ||
| 43 | } | 44 | } |
| 44 | 45 | ||
| 45 | TEST_F(TApp, EnumTransform) { | 46 | TEST_F(TApp, EnumTransform) { |
| 46 | - enum class test : int16_t { val1 = 3, val2 = 4, val3 = 17 }; | 47 | + enum class test : std::int16_t { val1 = 3, val2 = 4, val3 = 17 }; |
| 47 | test value; | 48 | test value; |
| 48 | auto opt = app.add_option("-s", value) | 49 | auto opt = app.add_option("-s", value) |
| 49 | ->transform(CLI::Transformer( | 50 | ->transform(CLI::Transformer( |
| @@ -68,11 +69,11 @@ TEST_F(TApp, EnumTransform) { | @@ -68,11 +69,11 @@ TEST_F(TApp, EnumTransform) { | ||
| 68 | // transformer doesn't do any checking so this still works | 69 | // transformer doesn't do any checking so this still works |
| 69 | args = {"-s", "5"}; | 70 | args = {"-s", "5"}; |
| 70 | run(); | 71 | run(); |
| 71 | - EXPECT_EQ(static_cast<int16_t>(value), int16_t(5)); | 72 | + EXPECT_EQ(static_cast<std::int16_t>(value), std::int16_t(5)); |
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | TEST_F(TApp, EnumCheckedTransform) { | 75 | TEST_F(TApp, EnumCheckedTransform) { |
| 75 | - enum class test : int16_t { val1 = 3, val2 = 4, val3 = 17 }; | 76 | + enum class test : std::int16_t { val1 = 3, val2 = 4, val3 = 17 }; |
| 76 | test value; | 77 | test value; |
| 77 | auto opt = app.add_option("-s", value) | 78 | auto opt = app.add_option("-s", value) |
| 78 | ->transform(CLI::CheckedTransformer( | 79 | ->transform(CLI::CheckedTransformer( |
| @@ -104,7 +105,7 @@ TEST_F(TApp, EnumCheckedTransform) { | @@ -104,7 +105,7 @@ TEST_F(TApp, EnumCheckedTransform) { | ||
| 104 | 105 | ||
| 105 | // from jzakrzewski Issue #330 | 106 | // from jzakrzewski Issue #330 |
| 106 | TEST_F(TApp, EnumCheckedDefualtTransform) { | 107 | TEST_F(TApp, EnumCheckedDefualtTransform) { |
| 107 | - enum class existing : int16_t { abort, overwrite, remove }; | 108 | + enum class existing : std::int16_t { abort, overwrite, remove }; |
| 108 | app.add_option("--existing", "What to do if file already exists in the destination") | 109 | app.add_option("--existing", "What to do if file already exists in the destination") |
| 109 | ->transform( | 110 | ->transform( |
| 110 | CLI::CheckedTransformer(std::unordered_map<std::string, existing>{{"abort", existing::abort}, | 111 | CLI::CheckedTransformer(std::unordered_map<std::string, existing>{{"abort", existing::abort}, |
| @@ -122,7 +123,7 @@ TEST_F(TApp, EnumCheckedDefualtTransform) { | @@ -122,7 +123,7 @@ TEST_F(TApp, EnumCheckedDefualtTransform) { | ||
| 122 | 123 | ||
| 123 | // test from https://github.com/CLIUtils/CLI11/issues/369 [Jakub Zakrzewski](https://github.com/jzakrzewski) | 124 | // test from https://github.com/CLIUtils/CLI11/issues/369 [Jakub Zakrzewski](https://github.com/jzakrzewski) |
| 124 | TEST_F(TApp, EnumCheckedDefaultTransformCallback) { | 125 | TEST_F(TApp, EnumCheckedDefaultTransformCallback) { |
| 125 | - enum class existing : int16_t { abort, overwrite, remove }; | 126 | + enum class existing : std::int16_t { abort, overwrite, remove }; |
| 126 | auto cmd = std::make_shared<CLI::App>("deploys the repository somewhere", "deploy"); | 127 | auto cmd = std::make_shared<CLI::App>("deploys the repository somewhere", "deploy"); |
| 127 | cmd->add_option("--existing", "What to do if file already exists in the destination") | 128 | cmd->add_option("--existing", "What to do if file already exists in the destination") |
| 128 | ->transform( | 129 | ->transform( |
| @@ -223,7 +224,7 @@ TEST_F(TApp, SimpleNumericalTransformFnconstexprArray) { | @@ -223,7 +224,7 @@ TEST_F(TApp, SimpleNumericalTransformFnconstexprArray) { | ||
| 223 | #endif | 224 | #endif |
| 224 | 225 | ||
| 225 | TEST_F(TApp, EnumTransformFn) { | 226 | TEST_F(TApp, EnumTransformFn) { |
| 226 | - enum class test : int16_t { val1 = 3, val2 = 4, val3 = 17 }; | 227 | + enum class test : std::int16_t { val1 = 3, val2 = 4, val3 = 17 }; |
| 227 | test value; | 228 | test value; |
| 228 | auto opt = app.add_option("-s", value) | 229 | auto opt = app.add_option("-s", value) |
| 229 | ->transform(CLI::Transformer( | 230 | ->transform(CLI::Transformer( |
| @@ -249,7 +250,7 @@ TEST_F(TApp, EnumTransformFn) { | @@ -249,7 +250,7 @@ TEST_F(TApp, EnumTransformFn) { | ||
| 249 | } | 250 | } |
| 250 | 251 | ||
| 251 | TEST_F(TApp, EnumTransformFnMap) { | 252 | TEST_F(TApp, EnumTransformFnMap) { |
| 252 | - enum class test : int16_t { val1 = 3, val2 = 4, val3 = 17 }; | 253 | + enum class test : std::int16_t { val1 = 3, val2 = 4, val3 = 17 }; |
| 253 | std::map<std::string, test> map{{"val1", test::val1}, {"val2", test::val2}, {"val3", test::val3}}; | 254 | std::map<std::string, test> map{{"val1", test::val1}, {"val2", test::val2}, {"val3", test::val3}}; |
| 254 | test value; | 255 | test value; |
| 255 | auto opt = app.add_option("-s", value)->transform(CLI::Transformer(map, CLI::ignore_case, CLI::ignore_underscore)); | 256 | auto opt = app.add_option("-s", value)->transform(CLI::Transformer(map, CLI::ignore_case, CLI::ignore_underscore)); |
| @@ -272,7 +273,7 @@ TEST_F(TApp, EnumTransformFnMap) { | @@ -272,7 +273,7 @@ TEST_F(TApp, EnumTransformFnMap) { | ||
| 272 | } | 273 | } |
| 273 | 274 | ||
| 274 | TEST_F(TApp, EnumTransformFnPtrMap) { | 275 | TEST_F(TApp, EnumTransformFnPtrMap) { |
| 275 | - enum class test : int16_t { val1 = 3, val2 = 4, val3 = 17, val4 = 37 }; | 276 | + enum class test : std::int16_t { val1 = 3, val2 = 4, val3 = 17, val4 = 37 }; |
| 276 | std::map<std::string, test> map{{"val1", test::val1}, {"val2", test::val2}, {"val3", test::val3}}; | 277 | std::map<std::string, test> map{{"val1", test::val1}, {"val2", test::val2}, {"val3", test::val3}}; |
| 277 | test value; | 278 | test value; |
| 278 | auto opt = app.add_option("-s", value)->transform(CLI::Transformer(&map, CLI::ignore_case, CLI::ignore_underscore)); | 279 | auto opt = app.add_option("-s", value)->transform(CLI::Transformer(&map, CLI::ignore_case, CLI::ignore_underscore)); |
| @@ -299,7 +300,7 @@ TEST_F(TApp, EnumTransformFnPtrMap) { | @@ -299,7 +300,7 @@ TEST_F(TApp, EnumTransformFnPtrMap) { | ||
| 299 | } | 300 | } |
| 300 | 301 | ||
| 301 | TEST_F(TApp, EnumTransformFnSharedPtrMap) { | 302 | TEST_F(TApp, EnumTransformFnSharedPtrMap) { |
| 302 | - enum class test : int16_t { val1 = 3, val2 = 4, val3 = 17, val4 = 37 }; | 303 | + enum class test : std::int16_t { val1 = 3, val2 = 4, val3 = 17, val4 = 37 }; |
| 303 | auto map = std::make_shared<std::unordered_map<std::string, test>>(); | 304 | auto map = std::make_shared<std::unordered_map<std::string, test>>(); |
| 304 | auto &mp = *map; | 305 | auto &mp = *map; |
| 305 | mp["val1"] = test::val1; | 306 | mp["val1"] = test::val1; |
| @@ -698,7 +699,7 @@ TEST_F(TApp, NumberWithUnitBadInput) { | @@ -698,7 +699,7 @@ TEST_F(TApp, NumberWithUnitBadInput) { | ||
| 698 | TEST_F(TApp, NumberWithUnitIntOverflow) { | 699 | TEST_F(TApp, NumberWithUnitIntOverflow) { |
| 699 | std::map<std::string, int> mapping{{"a", 1000000}, {"b", 100}, {"c", 101}}; | 700 | std::map<std::string, int> mapping{{"a", 1000000}, {"b", 100}, {"c", 101}}; |
| 700 | 701 | ||
| 701 | - int32_t value; | 702 | + std::int32_t value; |
| 702 | app.add_option("-n", value)->transform(CLI::AsNumberWithUnit(mapping)); | 703 | app.add_option("-n", value)->transform(CLI::AsNumberWithUnit(mapping)); |
| 703 | 704 | ||
| 704 | args = {"-n", "1000 a"}; | 705 | args = {"-n", "1000 a"}; |
| @@ -738,7 +739,7 @@ TEST_F(TApp, NumberWithUnitFloatOverflow) { | @@ -738,7 +739,7 @@ TEST_F(TApp, NumberWithUnitFloatOverflow) { | ||
| 738 | } | 739 | } |
| 739 | 740 | ||
| 740 | TEST_F(TApp, AsSizeValue1000_1024) { | 741 | TEST_F(TApp, AsSizeValue1000_1024) { |
| 741 | - uint64_t value; | 742 | + std::uint64_t value; |
| 742 | app.add_option("-s", value)->transform(CLI::AsSizeValue(true)); | 743 | app.add_option("-s", value)->transform(CLI::AsSizeValue(true)); |
| 743 | 744 | ||
| 744 | args = {"-s", "10240"}; | 745 | args = {"-s", "10240"}; |
| @@ -749,8 +750,8 @@ TEST_F(TApp, AsSizeValue1000_1024) { | @@ -749,8 +750,8 @@ TEST_F(TApp, AsSizeValue1000_1024) { | ||
| 749 | run(); | 750 | run(); |
| 750 | EXPECT_EQ(value, 1u); | 751 | EXPECT_EQ(value, 1u); |
| 751 | 752 | ||
| 752 | - uint64_t k_value = 1000u; | ||
| 753 | - uint64_t ki_value = 1024u; | 753 | + std::uint64_t k_value = 1000u; |
| 754 | + std::uint64_t ki_value = 1024u; | ||
| 754 | args = {"-s", "1k"}; | 755 | args = {"-s", "1k"}; |
| 755 | run(); | 756 | run(); |
| 756 | EXPECT_EQ(value, k_value); | 757 | EXPECT_EQ(value, k_value); |
| @@ -844,7 +845,7 @@ TEST_F(TApp, AsSizeValue1000_1024) { | @@ -844,7 +845,7 @@ TEST_F(TApp, AsSizeValue1000_1024) { | ||
| 844 | } | 845 | } |
| 845 | 846 | ||
| 846 | TEST_F(TApp, AsSizeValue1024) { | 847 | TEST_F(TApp, AsSizeValue1024) { |
| 847 | - uint64_t value; | 848 | + std::uint64_t value; |
| 848 | app.add_option("-s", value)->transform(CLI::AsSizeValue(false)); | 849 | app.add_option("-s", value)->transform(CLI::AsSizeValue(false)); |
| 849 | 850 | ||
| 850 | args = {"-s", "10240"}; | 851 | args = {"-s", "10240"}; |
| @@ -855,7 +856,7 @@ TEST_F(TApp, AsSizeValue1024) { | @@ -855,7 +856,7 @@ TEST_F(TApp, AsSizeValue1024) { | ||
| 855 | run(); | 856 | run(); |
| 856 | EXPECT_EQ(value, 1u); | 857 | EXPECT_EQ(value, 1u); |
| 857 | 858 | ||
| 858 | - uint64_t ki_value = 1024u; | 859 | + std::uint64_t ki_value = 1024u; |
| 859 | args = {"-s", "1k"}; | 860 | args = {"-s", "1k"}; |
| 860 | run(); | 861 | run(); |
| 861 | EXPECT_EQ(value, ki_value); | 862 | EXPECT_EQ(value, ki_value); |