Seastar
High performance C++ framework for concurrent servers
Static Public Member Functions | List of all members
seastar::json::formatter Class Reference

Detailed Description

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<typename... Args>
static sstring to_json (const std::vector< Args... > &vec)
 
template<typename... Args>
static sstring to_json (const std::map< Args... > &map)
 
template<typename... Args>
static sstring to_json (const std::unordered_map< Args... > &map)
 
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<typename... Args>
static future write (output_stream< char > &s, const std::vector< Args... > &vec)
 
template<typename... Args>
static future write (output_stream< char > &s, const std::map< Args... > &map)
 
template<typename... Args>
static future write (output_stream< char > &s, const std::unordered_map< Args... > &map)
 
static future write (output_stream< char > &s, const date_time &d)
 
static future write (output_stream< char > &s, const jsonable &obj)
 
static future write (output_stream< char > &s, unsigned long l)
 

Member Function Documentation

◆ to_json() [1/13]

static sstring seastar::json::formatter::to_json ( bool  d)
static

return a json formatted bool

Parameters
dthe bool to format
Returns
the given bool in a json format

◆ to_json() [2/13]

static sstring seastar::json::formatter::to_json ( const char *  str)
static

return a json formatted char* (treated as string), assuming there are no zero-chars in the middle

Parameters
strthe char* to format
Returns
the given char* in a json format
Deprecated:
A more robust overload should be preferred: to_json(const char*, size_t)

◆ to_json() [3/13]

static sstring seastar::json::formatter::to_json ( const char *  str,
size_t  len 
)
static

return a json formatted char* (treated as string), possibly with zero-chars in the middle

Parameters
strthe char* to format
lennumber of bytes to read from the str
Returns
the given char* in a json format

◆ to_json() [4/13]

static sstring seastar::json::formatter::to_json ( const date_time &  d)
static

return a json formatted date_time

Parameters
dthe date_time to format
Returns
the given date_time in a json format

◆ to_json() [5/13]

static sstring seastar::json::formatter::to_json ( const jsonable obj)
static

return a json formatted json object

Parameters
objthe date_time to format
Returns
the given json object in a json format

◆ to_json() [6/13]

static sstring seastar::json::formatter::to_json ( const sstring &  str)
static

return a json formatted string

Parameters
strthe string to format
Returns
the given string in a json format

◆ to_json() [7/13]

template<typename... Args>
static sstring seastar::json::formatter::to_json ( const std::vector< Args... > &  vec)
inlinestatic

return a json formatted list of a given vector of params

Parameters
vecthe vector to format
Returns
the given vector in a json format

◆ to_json() [8/13]

static sstring seastar::json::formatter::to_json ( double  d)
static

return a json formatted double

Parameters
dthe double to format
Returns
the given double in a json format

◆ to_json() [9/13]

static sstring seastar::json::formatter::to_json ( float  f)
static

return a json formatted float

Parameters
fthe float to format
Returns
the given float in a json format

◆ to_json() [10/13]

static sstring seastar::json::formatter::to_json ( int  n)
static

return a json formatted int

Parameters
nthe int to format
Returns
the given int in a json format

◆ to_json() [11/13]

static sstring seastar::json::formatter::to_json ( long  n)
static

return a json formatted long

Parameters
nthe long to format
Returns
the given long in a json format

◆ to_json() [12/13]

static sstring seastar::json::formatter::to_json ( unsigned long  l)
static

return a json formatted unsigned long

Parameters
lunsigned long to format
Returns
the given unsigned long in a json format

◆ to_json() [13/13]

static sstring seastar::json::formatter::to_json ( unsigned  n)
static

return a json formatted unsigned

Parameters
nthe unsigned to format
Returns
the given unsigned in a json format

◆ write() [1/11]

static future seastar::json::formatter::write ( output_stream< char > &  s,
bool  d 
)
inlinestatic

return a json formatted bool

Parameters
dthe bool to format
Returns
the given bool in a json format

◆ write() [2/11]

static future seastar::json::formatter::write ( output_stream< char > &  s,
const char *  str 
)
inlinestatic

return a json formatted char* (treated as string)

Parameters
strthe char* to format
Returns
the given char* in a json format

◆ write() [3/11]

static future seastar::json::formatter::write ( output_stream< char > &  s,
const date_time &  d 
)
inlinestatic

return a json formatted date_time

Parameters
dthe date_time to format
Returns
the given date_time in a json format

◆ write() [4/11]

static future seastar::json::formatter::write ( output_stream< char > &  s,
const jsonable obj 
)
inlinestatic

return a json formatted json object

Parameters
objthe date_time to format
Returns
the given json object in a json format

◆ write() [5/11]

static future seastar::json::formatter::write ( output_stream< char > &  s,
const sstring &  str 
)
inlinestatic

return a json formatted string

Parameters
strthe string to format
Returns
the given string in a json format

◆ write() [6/11]

template<typename... Args>
static future seastar::json::formatter::write ( output_stream< char > &  s,
const std::vector< Args... > &  vec 
)
inlinestatic

return a json formatted list of a given vector of params

Parameters
vecthe vector to format
Returns
the given vector in a json format

◆ write() [7/11]

static future seastar::json::formatter::write ( output_stream< char > &  s,
double  d 
)
inlinestatic

return a json formatted double

Parameters
dthe double to format
Returns
the given double in a json format

◆ write() [8/11]

static future seastar::json::formatter::write ( output_stream< char > &  s,
float  f 
)
inlinestatic

return a json formatted float

Parameters
fthe float to format
Returns
the given float in a json format

◆ write() [9/11]

static future seastar::json::formatter::write ( output_stream< char > &  s,
int  n 
)
inlinestatic

return a json formatted int

Parameters
nthe int to format
Returns
the given int in a json format

◆ write() [10/11]

static future seastar::json::formatter::write ( output_stream< char > &  s,
long  n 
)
inlinestatic

return a json formatted long

Parameters
nthe long to format
Returns
the given long in a json format

◆ write() [11/11]

static future seastar::json::formatter::write ( output_stream< char > &  s,
unsigned long  l 
)
inlinestatic

return a json formatted unsigned long

Parameters
lunsigned long to format
Returns
the given unsigned long in a json format

The documentation for this class was generated from the following file: