JWT header impl

This commit is contained in:
Arun M 2017-11-01 17:04:09 +05:30
parent 063a0af131
commit 3e867d77f1
13 changed files with 358 additions and 20 deletions

36
include/jwt/impl/jwt.ipp Normal file
View file

@ -0,0 +1,36 @@
#ifndef JWT_IPP
#define JWT_IPP
namespace jwt {
template <typename T>
std::string to_json_str(const T& obj, bool pretty)
{
return pretty ? obj.create_json_obj().dump(2)
: obj.create_json_obj().dump()
;
}
template <typename T>
std::ostream& write(std::ostream& os, const T& obj, bool pretty)
{
pretty ? (os << std::setw(2) << obj.create_json_obj())
: (os << obj.create_json_obj())
;
return os;
}
template <typename T>
std::ostream& operator<< (std::ostream& os, const T& obj)
{
os << obj.create_json_obj();
return os;
}
} // END namespace jwt
#endif