Seastar
High performance C++ framework for concurrent servers
|
The formatter prints json values in a json format it overload to_json method for each of the supported format all to_json parameters are passed as a pointer
#include <seastar/json/formatter.hh>
Static Public Member Functions | |
static sstring | to_json (const sstring &str) |
static sstring | to_json (int n) |
static sstring | to_json (unsigned n) |
static sstring | to_json (long n) |
static sstring | to_json (float f) |
static sstring | to_json (double d) |
static sstring | to_json (const char *str, size_t len) |
static sstring | to_json (const char *str) |
static sstring | to_json (bool d) |
template<std::ranges::input_range Range> requires (!internal::is_string_like<Range>) | |
static sstring | to_json (const Range &range) |
static sstring | to_json (const date_time &d) |
static sstring | to_json (const jsonable &obj) |
static sstring | to_json (unsigned long l) |
static future | write (output_stream< char > &s, const sstring &str) |
static future | write (output_stream< char > &s, int n) |
static future | write (output_stream< char > &s, long n) |
static future | write (output_stream< char > &s, float f) |
static future | write (output_stream< char > &s, double d) |
static future | write (output_stream< char > &s, const char *str) |
static future | write (output_stream< char > &s, bool d) |
template<std::ranges::input_range Range> requires (!internal::is_string_like<Range>) | |
static future | write (output_stream< char > &s, const Range &range) |
static future | write (output_stream< char > &s, const date_time &d) |
template<std::derived_from< jsonable > Jsonable> | |
static future | write (output_stream< char > &s, Jsonable obj) |
static future | write (output_stream< char > &s, unsigned long l) |
|
static |
return a json formatted bool
d | the bool to format |
|
static |
return a json formatted char* (treated as string), assuming there are no zero-chars in the middle
str | the char* to format |
|
static |
return a json formatted char* (treated as string), possibly with zero-chars in the middle
str | the char* to format |
len | number of bytes to read from the str |
|
static |
return a json formatted date_time
d | the date_time to format |
|
static |
return a json formatted json object
obj | the date_time to format |
|
inlinestatic |
converts a given range to a JSON-formatted string
range | A standard range type |
|
static |
return a json formatted string
str | the string to format |
|
static |
return a json formatted double
d | the double to format |
|
static |
return a json formatted float
f | the float to format |
|
static |
return a json formatted int
n | the int to format |
|
static |
return a json formatted long
n | the long to format |
|
static |
return a json formatted unsigned long
l | unsigned long to format |
|
static |
return a json formatted unsigned
n | the unsigned to format |
|
inlinestatic |
return a json formatted bool
d | the bool to format |
|
inlinestatic |
return a json formatted char* (treated as string)
str | the char* to format |
|
inlinestatic |
return a json formatted date_time
d | the date_time to format |
|
inlinestatic |
Converts a range to a JSON array or object and writes it to an output stream.
s | The output stream that will receive the JSON-formatted string |
range | The range to convert. If the range contains key-value pairs (like std::map), it will be formatted as a JSON object. Otherwise, it will be formatted as a JSON array. |
|
inlinestatic |
return a json formatted string
str | the string to format |
|
inlinestatic |
return a json formatted double
d | the double to format |
|
inlinestatic |
return a json formatted float
f | the float to format |
|
inlinestatic |
return a json formatted int
n | the int to format |
|
inlinestatic |
return a json formatted json object
obj | the date_time to format |
|
inlinestatic |
return a json formatted long
n | the long to format |
|
inlinestatic |
return a json formatted unsigned long
l | unsigned long to format |