mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 12:37:08 +11:00
🐛 added JsonCast back
This commit is contained in:
parent
0b9a8a1541
commit
e07a393485
1 changed files with 22 additions and 2 deletions
|
|
@ -1,9 +1,29 @@
|
||||||
#include "bank_f.h"
|
#include "bank_f.h"
|
||||||
|
|
||||||
#define JSON(V) callback(HttpResponse::newHttpJsonResponse(V));
|
#define JSON(V) callback(HttpResponse::newHttpJsonResponse(JsonCast(V)));
|
||||||
#define INLINE __attribute__((always_inline)) inline
|
|
||||||
#define PASS_HEADER req->getHeader("Password")
|
#define PASS_HEADER req->getHeader("Password")
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
constexpr Json::Value JsonCast(T &&val)
|
||||||
|
{
|
||||||
|
if constexpr (std::is_same_v<T, int_fast8_t>)
|
||||||
|
{
|
||||||
|
return (int)val; //becuase of json lib interpreting 67 as 'A' for example
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_same_v<T, uint64_t>)
|
||||||
|
{
|
||||||
|
return (Json::Int64)val;
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_same_v<T, int64_t>)
|
||||||
|
{
|
||||||
|
return (Json::Int64)val;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BankF::BankF(Bank *b) : bank(*b) {}
|
BankF::BankF(Bank *b) : bank(*b) {}
|
||||||
|
|
||||||
void BankF::Help(req_args) const
|
void BankF::Help(req_args) const
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue