| 70 | |
| 71 | template <typename T> |
| 72 | bool ListOption<T>::parse(std::string value) |
| 73 | { |
| 74 | _is_set = true; |
| 75 | |
| 76 | try |
| 77 | { |
| 78 | std::stringstream stream{value}; |
| 79 | std::string item; |
| 80 | |
| 81 | while (!std::getline(stream, item, ',').fail()) |
| 82 | { |
| 83 | std::stringstream item_stream(item); |
| 84 | T typed_value{}; |
| 85 | |
| 86 | item_stream >> typed_value; |
| 87 | |
| 88 | if (!item_stream.fail()) |
| 89 | { |
| 90 | _values.emplace_back(typed_value); |
| 91 | } |
| 92 | |
| 93 | _is_set = _is_set && !item_stream.fail(); |
| 94 | } |
| 95 | |
| 96 | return _is_set; |
| 97 | } |
| 98 | catch (const std::invalid_argument &) |
| 99 | { |
| 100 | return false; |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | template <typename T> |
| 105 | inline std::string ListOption<T>::help() const |
no outgoing calls
no test coverage detected