1#ifndef BEAST_MODULE_CORE_TEXT_LEXICALCAST_H_INCLUDED
2#define BEAST_MODULE_CORE_TEXT_LEXICALCAST_H_INCLUDED
4#include <xrpl/beast/utility/instrumentation.h>
6#include <boost/core/detail/string_view.hpp>
22template <
class Out,
class In>
31 template <
class Arithmetic = In>
39 template <
class Enumeration = In>
50template <
typename Out>
57 "beast::LexicalCast can only be used with integral types");
59 template <
class Integral = Out>
65 auto first = in.data();
66 auto last = in.data() + in.size();
68 if (first != last && *first ==
'+')
73 return ret.ec ==
std::errc() && ret.ptr == last;
84 return std::tolower(static_cast<unsigned char>(c));
87 if (result ==
"1" || result ==
"true")
93 if (result ==
"0" || result ==
"false")
115 operator()(Out& out, boost::core::basic_string_view<char> in)
const
144 in,
"beast::detail::LexicalCast(char const*) : non-null input");
159 XRPL_ASSERT(in,
"beast::detail::LexicalCast(char*) : non-null input");
179template <
class Out,
class In>
192template <
class Out,
class In>
207template <
class Out,
class In>
T back_inserter(T... args)
Out lexicalCastThrow(In in)
Convert from one type to another, throw on error.
Out lexicalCast(In in, Out defaultValue=Out())
Convert from one type to another.
bool lexicalCastChecked(Out &out, In in)
Intelligently convert from one type to another.
Thrown when a conversion is not possible with LexicalCast.
bool operator()(Out &out, boost::core::basic_string_view< char > in) const
bool operator()(Out &out, char *in) const
bool operator()(Out &out, char const *in) const
bool operator()(Out &out, std::string in) const
std::enable_if_t< std::is_integral_v< Integral > &&!std::is_same_v< Integral, bool >, bool > operator()(Integral &out, std::string_view in) const
bool operator()(bool &out, std::string_view in) const
std::enable_if_t< std::is_arithmetic_v< Arithmetic >, bool > operator()(std::string &out, Arithmetic in)
std::enable_if_t< std::is_enum_v< Enumeration >, bool > operator()(std::string &out, Enumeration in)