| @@ -1,5 +1,7 @@ | |||||
| #pragma once | #pragma once | ||||
| #include <cppcore/conversion/convert_cast.h> | |||||
| #include "context.h" | #include "context.h" | ||||
| namespace cppargs | namespace cppargs | ||||
| @@ -39,7 +41,7 @@ namespace cppargs | |||||
| { | { | ||||
| value = tmp + 1; | value = tmp + 1; | ||||
| if (key) | if (key) | ||||
| *key = std::string(arg, static_cast<size_t>(tmp - arg)); | |||||
| *key = std::string(arg, cppcore::convert_cast<size_t>(tmp - arg)); | |||||
| } | } | ||||
| else if (key) | else if (key) | ||||
| { | { | ||||
| @@ -2,7 +2,9 @@ | |||||
| #include <list> | #include <list> | ||||
| #include <vector> | #include <vector> | ||||
| #include <cppcore/conversion/string.h> | #include <cppcore/conversion/string.h> | ||||
| #include <cppcore/conversion/convert_cast.h> | |||||
| #include <cppargs/misc/option_parser.h> | #include <cppargs/misc/option_parser.h> | ||||
| namespace cppargs | namespace cppargs | ||||
| @@ -138,7 +140,7 @@ namespace cppargs | |||||
| || *e == '\0')) | || *e == '\0')) | ||||
| { | { | ||||
| value_type tmp; | value_type tmp; | ||||
| std::string str(s, static_cast<size_t>(e - s)); | |||||
| std::string str(s, cppcore::convert_cast<size_t>(e - s)); | |||||
| s = e + 1; | s = e + 1; | ||||
| if (!cppcore::try_from_string(str, tmp)) | if (!cppcore::try_from_string(str, tmp)) | ||||
| throw std::runtime_error(std::string("unable to parse option argument (option=") + arg + "; value=" + s + ")"); | throw std::runtime_error(std::string("unable to parse option argument (option=") + arg + "; value=" + s + ")"); | ||||
| @@ -45,7 +45,7 @@ ForEach ( FILE IN LISTS CPPARGS_TEST_SOURCE_FILES ) | |||||
| # test | # test | ||||
| If ( HAS_CMAKE_TESTS ) | If ( HAS_CMAKE_TESTS ) | ||||
| Add_CMake_Test ( NAME ${TEST_NAME} TARGET ${TEST_NAME} ) | |||||
| Add_CMake_Test ( NAME ${TEST_NAME} TARGET ${TEST_NAME} GROUP cppargs ) | |||||
| Else ( ) | Else ( ) | ||||
| Add_Test ( NAME ${TEST_NAME} COMMAND ${TEST_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) | Add_Test ( NAME ${TEST_NAME} COMMAND ${TEST_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) | ||||
| EndIf ( ) | EndIf ( ) | ||||