Struct write_interface
Defined in File jwt.hpp
Inheritance Relationships
Derived Types
public jwt::jwt_header(Struct jwt_header)public jwt::jwt_payload(Struct jwt_payload)
Struct Documentation
-
struct write_interface
A helper class providing the necessary functionalities for: a) converting an object into JSON string. b) writing to a standard output stream in JSON format. c) writing to standard console in JSON format using overloaded ‘<<’ operator.
Note
: The JWT component classes inherits from this class to get the above functionalities.
Subclassed by jwt::jwt_header, jwt::jwt_payload
Friends
-
template<typename T, typename Cond>
friend std::string to_json_str(const T &obj, bool pretty) Converts an object of type
Tto its JSON string format.
For pretty print, pass second parameter as
true.Note
: Type
Tmust have a member function namedcreate_json_obj. The check is made at compile time. Checkmeta::has_create_json_obj_memberfor more details. This check is done inCondtemplate parameter.
-
template<typename T>
friend std::ostream &write(std::ostream &os, const T &obj, bool pretty) Writes the object of instance
Tin JSON format to standard output stream. The requirements on typeTis same as that forto_json_strAPI.
-
template<typename T, typename Cond>
friend std::ostream &operator<<(std::ostream &os, const T &obj) An overloaded operator for writing to standard ostream in JSON format. The requirements on type
Tis same as that forto_json_strAPI.This API is same in functionality as that of
writeAPI. Only difference is that, there is no option to write the JSON representation in pretty format.
-
template<typename T, typename Cond>