| 1415 | }; |
| 1416 | |
| 1417 | class KeyValue |
| 1418 | { |
| 1419 | public: |
| 1420 | KeyValue(std::string key_, std::string value_) |
| 1421 | : m_key(std::move(key_)) |
| 1422 | , m_value(std::move(value_)) |
| 1423 | { |
| 1424 | } |
| 1425 | |
| 1426 | CXXOPTS_NODISCARD |
| 1427 | const std::string& |
| 1428 | key() const |
| 1429 | { |
| 1430 | return m_key; |
| 1431 | } |
| 1432 | |
| 1433 | CXXOPTS_NODISCARD |
| 1434 | const std::string& |
| 1435 | value() const |
| 1436 | { |
| 1437 | return m_value; |
| 1438 | } |
| 1439 | |
| 1440 | template <typename T> |
| 1441 | T |
| 1442 | as() const |
| 1443 | { |
| 1444 | T result; |
| 1445 | values::parse_value(m_value, result); |
| 1446 | return result; |
| 1447 | } |
| 1448 | |
| 1449 | private: |
| 1450 | std::string m_key; |
| 1451 | std::string m_value; |
| 1452 | }; |
| 1453 | |
| 1454 | using ParsedHashMap = std::unordered_map<size_t, OptionValue>; |
| 1455 | using NameHashMap = std::unordered_map<std::string, size_t>; |