mirror of
https://github.com/matrix-construct/construct
synced 2024-09-28 19:58:53 +02:00
ircd::json: Add mutable_buffer print() overload.
This commit is contained in:
parent
fb498ed2f2
commit
6c04739634
1 changed files with 13 additions and 0 deletions
|
@ -92,6 +92,7 @@ namespace ircd::json
|
|||
/// you pass to the template.
|
||||
template<class... T> string_view stringify(const mutable_buffer &&mb, T&&... t);
|
||||
template<class... T> size_t print(char *const &buf, const size_t &max, T&&... t);
|
||||
template<class... T> size_t print(const mutable_buffer &buf, T&&... t);
|
||||
template<class... T> std::string string(T&&... t);
|
||||
|
||||
size_t serialized(const string_view &);
|
||||
|
@ -126,6 +127,18 @@ ircd::json::stringify(const mutable_buffer &&mb,
|
|||
return stringify(mbc, std::forward<T>(t)...);
|
||||
}
|
||||
|
||||
///
|
||||
/// Convenience template using the syntax print(mutable_buffer, ...)
|
||||
/// which stringifies with null termination into buffer.
|
||||
///
|
||||
template<class... T>
|
||||
size_t
|
||||
ircd::json::print(const mutable_buffer &buf,
|
||||
T&&... t)
|
||||
{
|
||||
return print(data(buf), size(buf), std::forward<T>(t)...);
|
||||
}
|
||||
|
||||
///
|
||||
/// Convenience template using the syntax print(buf, sizeof(buf), ...)
|
||||
/// which stringifies with null termination into buffer.
|
||||
|
|
Loading…
Reference in a new issue