mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd::json: Minor simplifications.
ircd::rfc3986: Minor simplifications. ircd::fmt: Minor cleanup.
This commit is contained in:
parent
9213d31f1d
commit
ec0471934a
3 changed files with 94 additions and 59 deletions
81
ircd/fmt.cc
81
ircd/fmt.cc
|
@ -549,10 +549,13 @@ const
|
||||||
using karma::eps;
|
using karma::eps;
|
||||||
using karma::maxwidth;
|
using karma::maxwidth;
|
||||||
|
|
||||||
static const auto throw_illegal([]
|
static const auto throw_illegal{[]
|
||||||
{
|
{
|
||||||
throw illegal("Not a pointer");
|
throw illegal
|
||||||
});
|
{
|
||||||
|
"Not a pointer"
|
||||||
|
};
|
||||||
|
}};
|
||||||
|
|
||||||
struct generator
|
struct generator
|
||||||
:karma::grammar<char *, uintptr_t()>
|
:karma::grammar<char *, uintptr_t()>
|
||||||
|
@ -619,10 +622,13 @@ const
|
||||||
using karma::eps;
|
using karma::eps;
|
||||||
using karma::maxwidth;
|
using karma::maxwidth;
|
||||||
|
|
||||||
static const auto throw_illegal([]
|
static const auto throw_illegal{[]
|
||||||
{
|
{
|
||||||
throw illegal("Not a printable character");
|
throw illegal
|
||||||
});
|
{
|
||||||
|
"Not a printable character"
|
||||||
|
};
|
||||||
|
}};
|
||||||
|
|
||||||
struct generator
|
struct generator
|
||||||
:karma::grammar<char *, char()>
|
:karma::grammar<char *, char()>
|
||||||
|
@ -658,10 +664,13 @@ const
|
||||||
using karma::eps;
|
using karma::eps;
|
||||||
using karma::maxwidth;
|
using karma::maxwidth;
|
||||||
|
|
||||||
static const auto throw_illegal([]
|
static const auto throw_illegal{[]
|
||||||
{
|
{
|
||||||
throw illegal("Failed to print signed value");
|
throw illegal
|
||||||
});
|
{
|
||||||
|
"Failed to print signed value"
|
||||||
|
};
|
||||||
|
}};
|
||||||
|
|
||||||
const auto closure([&](const bool &boolean)
|
const auto closure([&](const bool &boolean)
|
||||||
{
|
{
|
||||||
|
@ -696,10 +705,13 @@ ircd::fmt::signed_specifier::operator()(char *&out,
|
||||||
const arg &val)
|
const arg &val)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
static const auto throw_illegal([]
|
static const auto throw_illegal{[]
|
||||||
{
|
{
|
||||||
throw illegal("Failed to print signed value");
|
throw illegal
|
||||||
});
|
{
|
||||||
|
"Failed to print signed value"
|
||||||
|
};
|
||||||
|
}};
|
||||||
|
|
||||||
const auto closure([&out, &max, &spec, &val]
|
const auto closure([&out, &max, &spec, &val]
|
||||||
(const long &integer)
|
(const long &integer)
|
||||||
|
@ -768,10 +780,13 @@ ircd::fmt::unsigned_specifier::operator()(char *&out,
|
||||||
const arg &val)
|
const arg &val)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
static const auto throw_illegal([]
|
static const auto throw_illegal{[]
|
||||||
{
|
{
|
||||||
throw illegal("Failed to print unsigned value");
|
throw illegal
|
||||||
});
|
{
|
||||||
|
"Failed to print unsigned value"
|
||||||
|
};
|
||||||
|
}};
|
||||||
|
|
||||||
const auto closure([&out, &max, &spec, &val]
|
const auto closure([&out, &max, &spec, &val]
|
||||||
(const ulong &integer)
|
(const ulong &integer)
|
||||||
|
@ -840,10 +855,13 @@ ircd::fmt::hex_lowercase_specifier::operator()(char *&out,
|
||||||
const arg &val)
|
const arg &val)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
static const auto throw_illegal([]
|
static const auto throw_illegal{[]
|
||||||
{
|
{
|
||||||
throw illegal("Failed to print hexadecimal value");
|
throw illegal
|
||||||
});
|
{
|
||||||
|
"Failed to print hexadecimal value"
|
||||||
|
};
|
||||||
|
}};
|
||||||
|
|
||||||
const auto closure([&](const ulong &integer)
|
const auto closure([&](const ulong &integer)
|
||||||
{
|
{
|
||||||
|
@ -911,10 +929,13 @@ ircd::fmt::hex_uppercase_specifier::operator()(char *&out,
|
||||||
const arg &val)
|
const arg &val)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
static const auto throw_illegal([]
|
static const auto throw_illegal{[]
|
||||||
{
|
{
|
||||||
throw illegal("Failed to print hexadecimal value");
|
throw illegal
|
||||||
});
|
{
|
||||||
|
"Failed to print hexadecimal value"
|
||||||
|
};
|
||||||
|
}};
|
||||||
|
|
||||||
const auto closure([&](const ulong &integer)
|
const auto closure([&](const ulong &integer)
|
||||||
{
|
{
|
||||||
|
@ -984,10 +1005,13 @@ ircd::fmt::float_specifier::operator()(char *&out,
|
||||||
const arg &val)
|
const arg &val)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
static const auto throw_illegal([]
|
static const auto throw_illegal{[]
|
||||||
{
|
{
|
||||||
throw illegal("Failed to print floating point value");
|
throw illegal
|
||||||
});
|
{
|
||||||
|
"Failed to print floating point value"
|
||||||
|
};
|
||||||
|
}};
|
||||||
|
|
||||||
thread_local uint _precision_;
|
thread_local uint _precision_;
|
||||||
_precision_ = s.precision;
|
_precision_ = s.precision;
|
||||||
|
@ -1045,10 +1069,13 @@ const
|
||||||
using karma::maxwidth;
|
using karma::maxwidth;
|
||||||
using karma::unused_type;
|
using karma::unused_type;
|
||||||
|
|
||||||
static const auto throw_illegal([]
|
static const auto throw_illegal{[]
|
||||||
{
|
{
|
||||||
throw illegal("Not a printable string");
|
throw illegal
|
||||||
});
|
{
|
||||||
|
"Not a printable string"
|
||||||
|
};
|
||||||
|
}};
|
||||||
|
|
||||||
struct generator
|
struct generator
|
||||||
:karma::grammar<char *, string_view>
|
:karma::grammar<char *, string_view>
|
||||||
|
|
57
ircd/json.cc
57
ircd/json.cc
|
@ -2258,11 +2258,11 @@ const
|
||||||
|
|
||||||
namespace ircd::json
|
namespace ircd::json
|
||||||
{
|
{
|
||||||
using vector_rule = parser::rule<string_view>;
|
[[gnu::visibility("internal")]]
|
||||||
|
extern const parser::rule<string_view>
|
||||||
[[gnu::visibility("internal")]] extern const vector_rule vector_object;
|
vector_object,
|
||||||
[[gnu::visibility("internal")]] extern const vector_rule vector_next_parse;
|
vector_next_parse,
|
||||||
[[gnu::visibility("internal")]] extern const vector_rule vector_begin_parse;
|
vector_begin_parse;
|
||||||
}
|
}
|
||||||
|
|
||||||
decltype(ircd::json::vector_object)
|
decltype(ircd::json::vector_object)
|
||||||
|
@ -2421,13 +2421,13 @@ catch(const qi::expectation_failure<const char *> &e)
|
||||||
|
|
||||||
namespace ircd::json
|
namespace ircd::json
|
||||||
{
|
{
|
||||||
using object_rule = parser::rule<object::member>;
|
[[gnu::visibility("internal")]]
|
||||||
|
extern const parser::rule<object::member>
|
||||||
[[gnu::visibility("internal")]] extern const object_rule object_member;
|
object_member,
|
||||||
[[gnu::visibility("internal")]] extern const object_rule object_next;
|
object_next,
|
||||||
[[gnu::visibility("internal")]] extern const object_rule object_begin;
|
object_begin,
|
||||||
[[gnu::visibility("internal")]] extern const object_rule object_next_parse;
|
object_next_parse,
|
||||||
[[gnu::visibility("internal")]] extern const object_rule object_begin_parse;
|
object_begin_parse;
|
||||||
}
|
}
|
||||||
|
|
||||||
decltype(ircd::json::object::max_recursion_depth)
|
decltype(ircd::json::object::max_recursion_depth)
|
||||||
|
@ -2792,13 +2792,13 @@ ircd::json::sorted(const object::member *const &begin,
|
||||||
|
|
||||||
namespace ircd::json
|
namespace ircd::json
|
||||||
{
|
{
|
||||||
using array_rule = parser::rule<string_view>;
|
[[gnu::visibility("internal")]]
|
||||||
|
extern const parser::rule<string_view>
|
||||||
[[gnu::visibility("internal")]] extern const array_rule array_value;
|
array_value,
|
||||||
[[gnu::visibility("internal")]] extern const array_rule array_next;
|
array_next,
|
||||||
[[gnu::visibility("internal")]] extern const array_rule array_begin;
|
array_begin,
|
||||||
[[gnu::visibility("internal")]] extern const array_rule array_next_parse;
|
array_next_parse,
|
||||||
[[gnu::visibility("internal")]] extern const array_rule array_begin_parse;
|
array_begin_parse;
|
||||||
}
|
}
|
||||||
|
|
||||||
decltype(ircd::json::array::max_recursion_depth)
|
decltype(ircd::json::array::max_recursion_depth)
|
||||||
|
@ -3981,8 +3981,10 @@ ircd::json::operator==(const value &a, const value &b)
|
||||||
|
|
||||||
namespace ircd::json
|
namespace ircd::json
|
||||||
{
|
{
|
||||||
[[gnu::visibility("internal")]] extern const parser::rule<> validation;
|
[[gnu::visibility("internal")]]
|
||||||
[[gnu::visibility("internal")]] extern const parser::rule<> validation_expect;
|
extern const parser::rule<>
|
||||||
|
validation,
|
||||||
|
validation_expect;
|
||||||
}
|
}
|
||||||
|
|
||||||
decltype(ircd::json::validation)
|
decltype(ircd::json::validation)
|
||||||
|
@ -3997,12 +3999,13 @@ ircd::json::validation_expect
|
||||||
expect[validation]
|
expect[validation]
|
||||||
};
|
};
|
||||||
|
|
||||||
const ircd::string_view ircd::json::literal_null { "null" };
|
const ircd::string_view
|
||||||
const ircd::string_view ircd::json::literal_true { "true" };
|
ircd::json::literal_null { "null" },
|
||||||
const ircd::string_view ircd::json::literal_false { "false" };
|
ircd::json::literal_true { "true" },
|
||||||
const ircd::string_view ircd::json::empty_string { "\"\"" };
|
ircd::json::literal_false { "false" },
|
||||||
const ircd::string_view ircd::json::empty_object { "{}" };
|
ircd::json::empty_string { "\"\"" },
|
||||||
const ircd::string_view ircd::json::empty_array { "[]" };
|
ircd::json::empty_object { "{}" },
|
||||||
|
ircd::json::empty_array { "[]" };
|
||||||
|
|
||||||
decltype(ircd::json::undefined_number)
|
decltype(ircd::json::undefined_number)
|
||||||
ircd::json::undefined_number
|
ircd::json::undefined_number
|
||||||
|
|
|
@ -621,11 +621,16 @@ ircd::rfc3986::encode(const mutable_buffer &buf,
|
||||||
|
|
||||||
namespace ircd::rfc3986
|
namespace ircd::rfc3986
|
||||||
{
|
{
|
||||||
[[gnu::visibility("internal")]] extern const parser::rule<string_view> host_literal;
|
[[gnu::visibility("internal")]]
|
||||||
[[gnu::visibility("internal")]] extern const parser::rule<string_view> host_non_literal;
|
extern const parser::rule<string_view>
|
||||||
[[gnu::visibility("internal")]] extern const parser::rule<string_view> host_alternative;
|
host_literal,
|
||||||
[[gnu::visibility("internal")]] extern const parser::rule<string_view> host_parse;
|
host_non_literal,
|
||||||
[[gnu::visibility("internal")]] extern const parser::rule<uint16_t> port_parse;
|
host_alternative,
|
||||||
|
host_parse;
|
||||||
|
|
||||||
|
[[gnu::visibility("internal")]]
|
||||||
|
extern const parser::rule<uint16_t>
|
||||||
|
port_parse;
|
||||||
}
|
}
|
||||||
|
|
||||||
decltype(ircd::rfc3986::host_literal)
|
decltype(ircd::rfc3986::host_literal)
|
||||||
|
|
Loading…
Reference in a new issue