Loading src/core/utils/text.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,13 @@ std::string allpix::from_string_impl(std::string str, type_tag<std::string>) { return from_string_helper(str); } /** * First parse as normal string and then constrcut path from it. */ std::filesystem::path allpix::from_string_impl(std::string str, type_tag<std::filesystem::path>) { return std::filesystem::path(from_string<std::string>(str)); } /** * Both numerical (0, 1) and textual representations ("false", "true") are supported for booleans. No enclosing quotation * marks should be used. Loading src/core/utils/text.h +9 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #define ALLPIX_TEXT_H #include <cctype> #include <filesystem> #include <sstream> #include <string> #include <type_traits> Loading Loading @@ -71,6 +72,14 @@ namespace allpix { * @throws std::invalid_argument If string without enclosing quotation marks, but more data after whitespace is found */ std::string from_string_impl(std::string str, type_tag<std::string>); /** * @ingroup StringConversions * @brief Conversion handler for filesystem paths * @throws std::invalid_argument If no closing quotation mark as last character after an opening quotation mark * @throws std::invalid_argument If string without enclosing quotation marks, but more data after whitespace is found */ std::filesystem::path from_string_impl(std::string str, type_tag<std::filesystem::path>); /** * @ingroup StringConversions * @brief Conversion handler for booleans Loading Loading
src/core/utils/text.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,13 @@ std::string allpix::from_string_impl(std::string str, type_tag<std::string>) { return from_string_helper(str); } /** * First parse as normal string and then constrcut path from it. */ std::filesystem::path allpix::from_string_impl(std::string str, type_tag<std::filesystem::path>) { return std::filesystem::path(from_string<std::string>(str)); } /** * Both numerical (0, 1) and textual representations ("false", "true") are supported for booleans. No enclosing quotation * marks should be used. Loading
src/core/utils/text.h +9 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #define ALLPIX_TEXT_H #include <cctype> #include <filesystem> #include <sstream> #include <string> #include <type_traits> Loading Loading @@ -71,6 +72,14 @@ namespace allpix { * @throws std::invalid_argument If string without enclosing quotation marks, but more data after whitespace is found */ std::string from_string_impl(std::string str, type_tag<std::string>); /** * @ingroup StringConversions * @brief Conversion handler for filesystem paths * @throws std::invalid_argument If no closing quotation mark as last character after an opening quotation mark * @throws std::invalid_argument If string without enclosing quotation marks, but more data after whitespace is found */ std::filesystem::path from_string_impl(std::string str, type_tag<std::filesystem::path>); /** * @ingroup StringConversions * @brief Conversion handler for booleans Loading