| 253 | std::vector<std::unique_ptr<ArgumentBase>> args_; |
| 254 | |
| 255 | static std::vector<std::string> splitFlags(const std::string& flags) { |
| 256 | std::vector<std::string> result; |
| 257 | |
| 258 | size_t start = 0; |
| 259 | size_t pos = 0; |
| 260 | |
| 261 | while ((pos = flags.find('|', start)) != std::string::npos) { |
| 262 | std::string token = flags.substr(start, pos - start); |
| 263 | if (!token.empty()) { result.push_back(token); } |
| 264 | start = pos + 1; |
| 265 | } |
| 266 | std::string lastToken = flags.substr(start); |
| 267 | if (!lastToken.empty()) { result.push_back(lastToken); } |
| 268 | |
| 269 | if (!flags.empty() && result.empty()) result.push_back(flags); |
| 270 | return result; |
| 271 | } |
| 272 | |
| 273 | static Argparse& instance() { |
| 274 | static Argparse inst; |