mirror of
https://github.com/arun11299/cpp-jwt.git
synced 2025-05-15 01:08:31 +00:00
JWT header impl
This commit is contained in:
parent
063a0af131
commit
3e867d77f1
13 changed files with 358 additions and 20 deletions
36
include/jwt/impl/jwt.ipp
Normal file
36
include/jwt/impl/jwt.ipp
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue