0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 02:02:38 +01:00

ircd::resource::response::chunked::json: Use template for top object or array type.

This commit is contained in:
Jason Volk 2023-02-05 19:50:08 -08:00
parent db974f6c50
commit 10de5ea52d

View file

@ -84,7 +84,7 @@ struct ircd::resource::response
struct ircd::resource::response::chunked struct ircd::resource::response::chunked
:resource::response :resource::response
{ {
struct json; template<class top_type> struct json;
static conf::item<size_t> default_buffer_size; static conf::item<size_t> default_buffer_size;
@ -119,24 +119,31 @@ struct ircd::resource::response::chunked
/// constructed in a response handler using chunked encoding to stream /// constructed in a response handler using chunked encoding to stream
/// json::object content. /// json::object content.
/// ///
template<class top_type = ircd::json::stack::object>
struct ircd::resource::response::chunked::json struct ircd::resource::response::chunked::json
:resource::response::chunked :resource::response::chunked
{ {
ircd::json::stack out; ircd::json::stack out;
ircd::json::stack::object top; top_type top;
operator ircd::json::stack &() operator ircd::json::stack &()
{ {
return out; return out;
} }
explicit operator top_type &()
{
return top;
}
template<class... args> template<class... args>
json(args&&... a); json(args&&... a);
}; };
template<class top_type>
template<class... args> template<class... args>
inline inline
ircd::resource::response::chunked::json::json(args&&... a) ircd::resource::response::chunked::json<top_type>::json(args&&... a)
:resource::response::chunked :resource::response::chunked
{ {
std::forward<args>(a)... std::forward<args>(a)...