userver: userver/utils/from_string.hpp File Reference
Loading...
Searching...
No Matches
from_string.hpp File Reference

Detailed Description

Extract the number contained in the string. No space characters or other extra characters allowed. Supported types:

Definition in file from_string.hpp.

Go to the source code of this file.

#include <cctype>
#include <cerrno>
#include <charconv>
#include <cstdint>
#include <cstdlib>
#include <string>
#include <string_view>
#include <type_traits>
#include <typeinfo>
#include <userver/utils/expected.hpp>
#include <userver/utils/zstring_view.hpp>
+ This graph shows which files directly or indirectly include this file:

Classes

class  utils::FromStringException
 Function utils::FromString exception type. More...
 

Namespaces

namespace  utils
 Utilities.
 

Enumerations

enum class  utils::FromStringErrorCode {
  utils::kLeadingSpaces = 1 ,
  utils::kTrailingJunk = 2 ,
  utils::kNoNumber = 3 ,
  utils::kOverflow = 4
}
 Conversion error code. More...
 

Functions

constexpr std::string_view utils::ToString (FromStringErrorCode code) noexcept
 Converts code to string representation.
 
template<typename T , typename StringType , typename = std::enable_if_t<std::is_convertible_v<StringType, std::string_view>>>
utils::FromString (const StringType &str)
 Extract the number contained in the string. No space characters or other extra characters allowed. Supported types:
 
template<typename T , typename StringType , typename = std::enable_if_t<std::is_convertible_v<StringType, std::string_view>>>
expected< T, FromStringErrorCodeutils::FromStringNoThrow (const StringType &str) noexcept
 Extract the number contained in the string. No space characters or other extra characters allowed. Supported types:
 
std::int64_t utils::FromHexString (std::string_view str)