| 394 | |
| 395 | template <typename DST> |
| 396 | inline nonstd::expected<DST, std::string> Any::convert(EnableString<DST>) const |
| 397 | { |
| 398 | const auto& type = _any.type(); |
| 399 | |
| 400 | if(type == typeid(SafeAny::SimpleString)) |
| 401 | { |
| 402 | return linb::any_cast<SafeAny::SimpleString>(_any).toStdString(); |
| 403 | } |
| 404 | else if(type == typeid(int64_t)) |
| 405 | { |
| 406 | return std::to_string(linb::any_cast<int64_t>(_any)); |
| 407 | } |
| 408 | else if(type == typeid(uint64_t)) |
| 409 | { |
| 410 | return std::to_string(linb::any_cast<uint64_t>(_any)); |
| 411 | } |
| 412 | else if(type == typeid(double)) |
| 413 | { |
| 414 | return std::to_string(linb::any_cast<double>(_any)); |
| 415 | } |
| 416 | |
| 417 | return nonstd::make_unexpected(errorMsg<DST>()); |
| 418 | } |
| 419 | |
| 420 | template <typename T> |
| 421 | inline nonstd::expected<T, std::string> Any::stringToNumber() const |
no test coverage detected