| 117 | // The iterator is moved to the last parsed token. |
| 118 | template <typename T> |
| 119 | bool parse_flag(Flag<T>& flag, bool is_short_flag, const char*** iterator) { |
| 120 | const std::string raw_flag(**iterator); |
| 121 | std::string raw_value; |
| 122 | const size_t equal_index = raw_flag.find('='); |
| 123 | |
| 124 | if (is_short_flag || equal_index == std::string::npos) { |
| 125 | if ((*iterator)[1] == nullptr) { |
| 126 | return false; |
| 127 | } |
| 128 | |
| 129 | // This is a bi-token flag. Moving iterator to the last parsed token. |
| 130 | raw_value = (*iterator)[1]; |
| 131 | *iterator += 1; |
| 132 | } else { |
| 133 | // This is a mono-token flag, no need to move the iterator. |
| 134 | raw_value = raw_flag.substr(equal_index + 1); |
| 135 | } |
| 136 | |
| 137 | return parse_flag_value(flag, raw_value); |
| 138 | } |
| 139 | |
| 140 | } // namespace |
| 141 |
no test coverage detected