| 567 | } |
| 568 | |
| 569 | bool ParamValue::operator==(const std::string& value_str) const { |
| 570 | // LogDebug() << "Compare " << value_str() << " and " << rhs.value_str(); |
| 571 | if (std::get_if<uint8_t>(&_value)) { |
| 572 | return std::get<uint8_t>(_value) == std::stoi(value_str); |
| 573 | } else if (std::get_if<int8_t>(&_value)) { |
| 574 | return std::get<int8_t>(_value) == std::stoi(value_str); |
| 575 | } else if (std::get_if<uint16_t>(&_value)) { |
| 576 | return std::get<uint16_t>(_value) == std::stoi(value_str); |
| 577 | } else if (std::get_if<int16_t>(&_value)) { |
| 578 | return std::get<int16_t>(_value) == std::stoi(value_str); |
| 579 | } else if (std::get_if<uint32_t>(&_value)) { |
| 580 | return std::get<uint32_t>(_value) == std::stoul(value_str); |
| 581 | } else if (std::get_if<int32_t>(&_value)) { |
| 582 | return std::get<int32_t>(_value) == std::stol(value_str); |
| 583 | } else if (std::get_if<uint64_t>(&_value)) { |
| 584 | return std::get<uint64_t>(_value) == std::stoull(value_str); |
| 585 | } else if (std::get_if<int64_t>(&_value)) { |
| 586 | return std::get<int64_t>(_value) == std::stoll(value_str); |
| 587 | } else if (std::get_if<float>(&_value)) { |
| 588 | return std::get<float>(_value) == std::stof(value_str); |
| 589 | } else if (std::get_if<double>(&_value)) { |
| 590 | return std::get<double>(_value) == std::stod(value_str); |
| 591 | } else { |
| 592 | // This also covers custom_type_t |
| 593 | return false; |
| 594 | } |
| 595 | } |
| 596 | |
| 597 | std::ostream& operator<<(std::ostream& strm, const ParamValue& obj) { |
| 598 | strm << "ParamValue{" << obj.typestr() << ":" << obj.get_string() << "}"; |
nothing calls this directly
no outgoing calls
no test coverage detected