8 #include <hilti/rt/extension-points.h> 9 #include <hilti/rt/util.h> 16 HILTI_RT_ENUM_WITH_DEFAULT(DecodeErrorStrategy, IGNORE,
30 size_t size(
const std::string& s, DecodeErrorStrategy errors = DecodeErrorStrategy::REPLACE);
40 std::string lower(
const std::string& s, DecodeErrorStrategy errors = DecodeErrorStrategy::REPLACE);
50 std::string upper(
const std::string& s, DecodeErrorStrategy errors = DecodeErrorStrategy::REPLACE);
54 namespace detail::adl {
55 inline std::string
to_string(
const std::string& x, adl::tag ) {
56 return fmt(
"\"%s\"", escapeUTF8(x,
true,
true,
true));
59 inline std::string
to_string(std::string_view x, adl::tag ) {
60 return fmt(
"\"%s\"", escapeUTF8(x,
true,
true,
true));
63 template<
typename CharT,
size_t N>
64 inline std::string
to_string(
const CharT (&x)[N], adl::tag ) {
65 return fmt(
"\"%s\"", escapeUTF8(x,
true,
true,
true));
71 inline std::string detail::to_string_for_print<std::string>(
const std::string& x) {
72 return escapeUTF8(x,
false,
false,
true);
76 inline std::string detail::to_string_for_print<std::string_view>(
const std::string_view& x) {
77 return escapeUTF8(x,
false,
false,
true);
std::string to_string(T &&x)
Definition: extension-points.h:26
std::string fmt(const char *fmt, const Args &... args)
Definition: fmt.h:13